import { Configuration, OpenAIApi } from 'openai';
//....
const configuration = new Configuration({
apiKey: API_KEY,
});
//....
const openai = new OpenAIApi(configuration);
//....
const response = await openai.createChatCompletion({
model: "gpt-3.5-turbo",
messages: [
{
role: "system",
content: `You are a helpful assistant.` },
...prompt
],
temperature: 0.2,
max_tokens: 1500,
top_p: 1,
frequency_penalty: 0,
presence_penalty: 0,
});
//....
res.status(200).send({
bot: response.data.choices[0].message.content
});
//....
does this method in node.js doesn't work anymore?
i am getting this kind of error: