openai / openai-node

Official JavaScript / TypeScript library for the OpenAI API
https://www.npmjs.com/package/openai
Apache License 2.0
7.98k stars 871 forks source link

You requested a model that is not compatible with this engine #58

Closed gzgogo closed 1 year ago

gzgogo commented 1 year ago

Describe the bug

You requested a model that is not compatible with this engine

To Reproduce

i meet a error: "You requested a model that is not compatible with this engine" yesterday, but it can run normally before

Code snippets

const response = await openai.createCompletion({
      model: 'text-davinci-003',
      prompt: prompt,
      temperature: 0.7, 
      top_p: 1,
      max_tokens: 4000,
      frequency_penalty: 0.0,
      presence_penalty: 0.6,
      stop: [' Human:', ' AI:'],
    })

OS

macos

Node version

node v18

Library version

openai 3.1.0

liseri commented 1 year ago

I have the same error but with python

gefeiyanga commented 1 year ago

try to switch to node v18.10.0

liseri commented 1 year ago

I change paramer "model" to "engine", it is ok. I use python api. @gzgogo

response = openai.Completion.create(
            engine="text-davinci-003",
            prompt=question,
            max_tokens=1024,
            n=1,
            stop=None,
            temperature=0.5
        )
Lissy93 commented 1 year ago

In your code snippet, you're trying to use the text-davinci-003 model. But looking at the code, it appears the currently only gpt-3.5-turbo and gpt-3.5-turbo-0301 models are supported.

https://github.com/openai/openai-node/blob/0363de20747e272a92e41da4a4c4293104aa9461/dist/api.d.ts#L261-L266

The solution would be to make requests directly yourself, instead of using the openai-node package - here's how.