openai.lib._old_api.APIRemovedInV1

try to call to api

import openai

# Set the API key
openai.api_key = "sk-proj-xxxxxxxxxxxxx"

response = openai.Completion.create(
    engine="text-davinci-003",
    prompt="You are a helpful assistant.\nUser: Hello, how are you?",
    temperature=1,
    max_tokens=256,
    top_p=1,
    frequency_penalty=0,
    presence_penalty=0
)

print(response.choices[0].text.strip())

but i have error

Traceback (most recent call last):
  File ".\main.py", line 13, in <module>
    presence_penalty=0
  File "C:\Users\gal.dahan\Desktop\project\chatgpt\env\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.Completion, but this is no longer supported in openai>=1.0.0 - see the README at https://github.com/openai/openai-python 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: https://github.com/openai/openai-python/discussions/742```

Welcome to the dev forum!

Here’s your clue…

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

Basically, text-davinci-003 was deprecated and no longer in service. The replacement is gpt-3.5-turbo-instruct OR upgrading to more modern chat completion (ChatML)…

Are you running old code you found?