you’re way behind on your openai version for that code. current is >1 : pip install -U openai
2
this is the example if you follow the docs to github:
import os
from openai import OpenAI
client = OpenAI(
# This is the default and can be omitted
api_key=os.environ.get("OPENAI_API_KEY"), #you can put the key here directy
)
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content": "Say this is a test",
}
],
model="gpt-3.5-turbo",
)