One of the main documentation pages (top link for developers) has one simple example which fails with the most recent api version:
https://openai.com/product#made-for-developers
completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What are some famous astronomical observatories?"}
]
)
Traceback (most recent call last):
File “C:\Users\x\sandbox\aish\learning_sandbox\api_examples\fc3_old_completion_style.py”, line 2, in
completion = openai.ChatCompletion.create(
File “C:\Users\x\AppData\Local\Programs\Python\Python310\lib\site-packages\openai\lib_old_api.py”, line 39, in call
raise APIRemovedInV1(symbol=self._symbol)
openai.lib._old_api.APIRemovedInV1:
You tried to access openai.ChatCompletion, 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
Please update the documentation.