I want to use gpt-3.5-turbo model for which the API in nodeJS seems to be createChatCompletion which throws request error in nextJS. Im able to get the response with textdavinci model in creatCompletion API. Not sure since if the API is not working since it is in beta.
My code:
// Prepare the messages for the chat conversation
const inputs = [
{
role: “system”,
content: “You are an AI assistant who is helpful, creative, clever, and very friendly.”,
},
{ role: “user”, content: userInput },
];
try {
const response = await openai.createChatCompletion({
model: “gpt-3.5-turbo”,
messages: inputs, // Use the messages parameter
max_tokens: 20,
temperature: 0.7,
});
res.status(200).json({
result: response.data.choices[0].message.content
});