// 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);