OpenAI gpt-3.5-turbo:请求失败,状态代码 400
<p>node.js 中的这个方法不再起作用了吗?因为当时它工作正常,但现在它不再工作了,而且此代码也基于他们的官方文档,即 https://platform.openai.com/docs/api-reference/completions/create</ p>
<p><strong>我的服务器端代码:</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>我尝试发送的数据:</strong></p>
<pre class="brush:json;toolbar:false;">{
"prompt": [
{
"role": "bot",
"content": "Something went wrong."
},
{
"role": "user",
"content": "What is wrong?"
}
]
}
</pre>
<p><strong>我遇到了这种错误:</strong>
|
消息提示的输出位于终端中,以防您想检查我是否发送了正确的消息提示。</p>
<p>我还尝试添加组织 ID,但仍然不起作用,也尝试将其从 v3.2.1 更新到 v3.3.0,但根本不起作用。我的账户里还有余额。</p>