1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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);
|