AttributeError: module 'openai' has no attribute 'ChatCompletion'

import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")

completion = openai.ChatCompletion.create(
  model="gpt-3.5-turbo",
  messages=[
    {"role": "user", "content": "Tell the world about the ChatGPT API in the style of a pirate."}
  ]
)

print(completion.choices[0].message.content)

Всех приветствую, столкнулся с такой проблемой, при попытке запустить код выходит ошибка: AttributeError: module 'openai' has no attribute 'ChatCompletion'. Версия openai: 0.27.6, версия Python: 3.11.3

В чем может быть проблема?


Ответы (0 шт):