#TypeError Cannot read properties of undefined (reading 'create')

4 messages · Page 1 of 1 (latest)

agile kettle
#

Code:

  if (message.author.id !== client.user.id) {
    // Use the ChatGPT model to generate a response
    openai.completions.create({
      engine: 'gpt-3',
      prompt: message.content,
      max_tokens: 2048,
      temperature: 0.5
    }, function(error, response) {
      if (error) {
        console.error(error);
      } else {
        message.channel.send(response.choices[0].text);
      }
    });
  }
});```

Error:
```TypeError: Cannot read properties of undefined (reading 'create')```
#

How do I fix this? Discord.js v13

stable talon
#

Hi there, there is no engine called gpt-3, you can use the current most powerful model “davinci-003”