-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed as not planned
Description
The pypi page shows this example
from openai import OpenAI
client = OpenAI(
# defaults to os.environ.get("OPENAI_API_KEY")
api_key="My API Key",
)
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content": "Say this is a test",
}
],
model="gpt-3.5-turbo",
)
Similar examples using openai.OpenAI can be found in official docs for Dalle-3:
from openai import OpenAI
client = OpenAI()
response = client.images.generate(
model="dall-e-3",
prompt="a white siamese cat",
size="1024x1024",
quality="standard",
n=1,
)
image_url = response.data[0].url
However, this code will cause the following error (with openai==1.1.1):
ImportError: cannot import name 'OpenAI' from 'openai'
Tested this on both local Windows and a Databricks notebook.
Metadata
Metadata
Assignees
Labels
No labels