Skip to content

Commit

Permalink
update instruct -> instructor + clean up exports
Browse files Browse the repository at this point in the history
  • Loading branch information
roodboi committed Jan 2, 2024
1 parent 1001867 commit 781b51e
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 243 deletions.
4 changes: 2 additions & 2 deletions examples/test.ts → examples/extract_user/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Instruct } from "@/instructor"
import Instructor from "@/instructor"
import OpenAI from "openai"
import { z } from "zod"

Expand All @@ -16,7 +16,7 @@ const oai = new OpenAI({
organization: process.env.OPENAI_ORG_ID ?? undefined
})

const client = new Instruct({
const client = new Instructor({
client: oai,
mode: "FUNCTIONS"
})
Expand Down
24 changes: 0 additions & 24 deletions examples/extract_user/run.ts

This file was deleted.

12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
"name": "instructor-js",
"version": "0.0.1",
"description": "structured outputs for llms",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"main": "./dist/instructor.js",
"module": "./dist/instructor.mjs",
"types": "./dist/instructor.d.ts",
"exports": {
".": {
"import": "./dist/instructor.mjs",
"require": "./dist/instructor.js"
}
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsup",
Expand Down
2 changes: 0 additions & 2 deletions src/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/instructor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ type PatchedChatCompletionCreateParams = ChatCompletionCreateParamsNonStreaming
max_retries?: number
}

export class Instruct {
export default class Instructor {
private client: OpenAI
private mode: MODE

/**
* Creates an instance of the `Instruct` class.
* Creates an instance of the `Instructor` class.
* @param {OpenAI} client - The OpenAI client.
* @param {string} mode - The mode of operation.
*/
Expand Down
208 changes: 0 additions & 208 deletions src/patch.ts

This file was deleted.

4 changes: 2 additions & 2 deletions tests/functions.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Instruct } from "@/instructor"
import Instructor from "@/instructor"
import { describe, expect, test } from "bun:test"
import OpenAI from "openai"
import { z } from "zod"
Expand All @@ -18,7 +18,7 @@ async function extractUser() {
organization: process.env.OPENAI_ORG_ID ?? undefined
})

const client = new Instruct({
const client = new Instructor({
client: oai,
mode: "FUNCTIONS"
})
Expand Down

0 comments on commit 781b51e

Please sign in to comment.