diff options
| author | bobzel <zzzman@gmail.com> | 2024-05-16 23:42:12 -0400 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2024-05-16 23:42:12 -0400 |
| commit | 99931c4ca423d51555c24533a98e921c83c941e1 (patch) | |
| tree | 07baab3cb627eae837c18fb2a6981a746765ec61 /src/client/apis/gpt/setup.ts | |
| parent | a197d8d37e62235bfa59bc8e3bb74c39381c30a4 (diff) | |
| parent | 69e286b504c2f1bbef7d489dc675b9e54ef8d983 (diff) | |
Merge branch 'restoringEslint' into eleanor-starter
Diffstat (limited to 'src/client/apis/gpt/setup.ts')
| -rw-r--r-- | src/client/apis/gpt/setup.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/client/apis/gpt/setup.ts b/src/client/apis/gpt/setup.ts new file mode 100644 index 000000000..831c97eaa --- /dev/null +++ b/src/client/apis/gpt/setup.ts @@ -0,0 +1,30 @@ +// import { Configuration, OpenAIApi } from 'openai'; +import { ClientOptions, OpenAI } from 'openai'; + +export enum GPTCallType { + SUMMARY = 'summary', + COMPLETION = 'completion', + EDIT = 'edit', +} + +export type GPTCallOpts = { + model: string; + maxTokens: number; + temp: number; + prompt: string; +}; + +export const callTypeMap: { [type: string]: GPTCallOpts } = { + summary: { model: 'text-davinci-003', maxTokens: 256, temp: 0.5, prompt: 'Summarize this text in simpler terms: ' }, + edit: { model: 'text-davinci-003', maxTokens: 256, temp: 0.5, prompt: 'Reword this: ' }, + completion: { model: 'text-davinci-003', maxTokens: 256, temp: 0.5, prompt: '' }, +}; + +const configuration: ClientOptions = { + apiKey: process.env.OPENAI_KEY, + dangerouslyAllowBrowser: true, +}; + +export const openai = new OpenAI(configuration); + +// export const openai = new OpenAIApi(configuration); |
