小编CWY*_*YOO的帖子

OPENAI API 完成不返回文本

我正在使用node.js并想使用openai API

我刚刚从 openai Playground 复制了代码,它看起来像这样

export const askOpenAi = async () => {
const response = await openai.createCompletion("text-davinci-001", {
    prompt: "\ninput: What is human life expectancy in the United States?\n",
    temperature: 0,
    max_tokens: 100,
    top_p: 1,
    frequency_penalty: 0,
    presence_penalty: 0,
    stop: ["\n", "\ninput:"],
});
return response.data;
}
Run Code Online (Sandbox Code Playgroud)

openai的返回数据是这样的

{
  id: '~~~',
  object: 'text_completion',
  created: ~~~,
  model: 'text-davinci:001',
  choices: [ { text: '', index: 0, logprobs: null, finish_reason: 'stop' } ]
}
Run Code Online (Sandbox Code Playgroud)

在操场上,这段代码运行得很好。

在操场上,这段代码运行得很好。

我怎样才能得到正确的回应?

node.js openai-api

16
推荐指数
1
解决办法
2万
查看次数

标签 统计

node.js ×1

openai-api ×1