-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(openai): a few refactors (#134)
* Add openai lib * change git clone in the readme to the public url * add description to package.json * update mklib.sh to include a description in package.json * fix PR comment about peerDependencies * tweaks * remove author from template * Update openai.test.w * fix test * another fix to test * more cleanups * Update package.json * Update openai.test.w * Rename openai/example.main.w to openai/examples/example.main.w * fix bring statement in examples * remove unused files --------- Co-authored-by: Shai Ber <[email protected]>
- Loading branch information
Showing
8 changed files
with
47 additions
and
63 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
bring expect; | ||
bring "./openai.w" as openai; | ||
bring "../openai.w" as openai; | ||
|
||
bring cloud; | ||
|
||
let oai = new openai.OpenAI(apiKey: "my-openai-key"); | ||
|
||
new cloud.Function(inflight () => { | ||
let answer = oai.createCompletion("tell me a short joke", model: "gpt-3.5-turbo", max_tokens: 2048); | ||
let answer = oai.createCompletion("tell me a short joke", model: "gpt-3.5-turbo", maxTokens: 2048); | ||
log(answer); | ||
}) as "tell me a joke"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
export default interface extern { | ||
createNewInflightClient: (apiKey: string, org?: (string) | undefined) => Promise<IOpenAI$Inflight>, | ||
createNewInflightClient: (apiKey: string, org?: (string) | undefined) => Promise<IClient$Inflight>, | ||
} | ||
export interface CompletionParams { | ||
readonly max_tokens: number; | ||
readonly model: string; | ||
} | ||
export interface IOpenAI$Inflight { | ||
readonly createCompletion: (prompt: string, params?: (CompletionParams) | undefined) => Promise<string>; | ||
export interface IClient$Inflight { | ||
readonly createCompletion: (params: Readonly<any>) => Promise<Readonly<any>>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.