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```