API openai.ChatCompletion error

When i use “openai.Completion.create” , there no problem, all run good. But when i want to use openai.ChatCompletion.create there a error : AttributeError: module ‘openai’ has no attribute ‘ChatCompletion’

I want to use gpt-3.5-turbo and i need ChatCompletion . What can i do ?

Welcome to the forums.

Step 1… Read rules of the community.
Step 2… Search forums for similar topics…

step1

Step 3… ???
Step 4… Profit!

In all seriousness, you likely need to update your openai module… without more details, it’s hard to help you…

Hope this helps.

1 Like

You should post your code which you use to call the OpenAI API chatcompletion method so we can help you.

Post code and data here using Markdown using triple backticks like this:

```
# your property formatted and indented code and data here
```

:slight_smile:

I found the problem, uninstalled openai (-pip uninstall openai) and reinstalled. I had an older version. Now everything is ok, thank you!

1 Like

I’m beginner here,I have the same issue of using openai api in python programming while using the Google processor . I have tried all the suggest above about the same error(module ‘openai’ has no attribute ‘chatcompletion’. Please help me if anyone knows I stuck here for last 2 weeks .

You have a old version openai, just uninstall and re-install openai or do this :

pip install openai --upgrade
2 Likes