I'm new to using this api, but i keep getting that error. Here's my code:
const { Configuration, OpenAIApi } = require("openai");
const AIconfig = new Configuration({
apiKey: --<HIDDEN>--
});
const openai = new OpenAIApi(AIconfig);
async function main(message) {
const chatCompletion = await openai.createChatCompletion({
model: 'gpt-3.5-turbo',
messages: [
{ role: 'user', content: message }
]
});
return chatCompletion.data.choices[0].message.content;
}
module.exports = {
main
};