it always gives me this, and I follow the document it still doesn’t work.
You tried to access openai.Completion, but this is no longer supported in openai>=1.0.0 - see the README at GitHub - openai/openai-python: The official Python library for the OpenAI API for the API.
You can run
openai migrate to automatically upgrade your codebase to use the 1.0.0 interface.
Alternatively, you can pin your installation to the old version, e.g.
pip install openai==0.28
A detailed migration guide is available here: v1.0.0 Migration Guide · openai/openai-python · Discussion #742 · GitHub
Same here, lloking for a solution ASAP
Same over here its working locally but after creating the docker image this error occurs, is there a solution yet?
I have the same error… found an answer yet?
hi, i have it set as an env var for my app and still getting this error.
'''example completion with openai > 1.1'''
from openai import OpenAI
client = OpenAI()
prompt = "True or false: a banana is smaller than a lemon.\n\n"
response = client.completions.create(
for part in response:
print(part.choices.text or "")
It worked for me, thanks. Wasn’t referencing the message object under response
You can alternatively run
This will automatically update all your existing old code.