我的提示是 1360 个令牌,经 Playground 和 Tokenizer 验证。我不会显示提示,因为对于这个问题来说有点太长了。


这是我使用 openai npm 包在 Nodejs 中对 openai 的请求。


const response = await openai.createCompletion({

  model: 'text-davinci-003',

  prompt,

  max_tokens: 4000,

  temperature: 0.2

})

在 Playground 中进行测试时,响应后我的总代币数为 1374。


通过完成 API 提交提示时,我收到以下错误:


error: {

  message: "This model's maximum context length is 4097 tokens, however you requested 5360 tokens (1360 in your prompt; 4000 for the completion). Please reduce your prompt; or completion length.",

  type: 'invalid_request_error',

  param: null,

  code: null

}