OpenAI gpt-3.5-turbo: Request failed with status code 400
<p>Does this method in node.js no longer work? Because then it worked fine but now it doesn't work anymore and also this code is based on their official documentation which is https://platform.openai.com/docs/api-reference/completions/create</ p>
<p><strong>My server-side code: </strong></p>
<pre class="brush:js;toolbar:false;"> 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
});
//....
</pre>
<p><strong>Data I am trying to send: </strong></p>
<pre class="brush:json;toolbar:false;">{
"prompt": [
{
"role": "bot",
"content": "Something went wrong."
},
{
"role": "user",
"content": "What is wrong?"
}
]
}
</pre>
<p><strong>I encountered this error: </strong>
|
The output of the message prompt is in the terminal, in case you want to check if I'm sending the correct message prompt. </p>
<p>I also tried adding the organization ID but still didn't work, also tried updating it from v3.2.1 to v3.3.0 but it didn't work at all. I still have a balance in my account. </p>