python中的Chatgpt API错误,我真的不知道该怎么办[重复]

Chatgpt API ERROR in python, i really dont know what to do [duplicate]

提问人:Prajwol Acharya 提问时间:11/15/2023 更新时间:11/15/2023 访问量:86

问:

错误

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

法典

`response = openai.Completion.create(model="text-davinci-003",
                                    prompt=f"Hello ",
                                    temperature=1,
                                    max_tokens=256,
                                    top_p=1,
                                    frequency_penalty=0,
                                    presence_penalty=0)`

我仍然使用 0.8 版以避免错误,但我想切换到最新型号。 我没有读过文档。 所以,你能解决代码吗? 错误在

openai.Completion.create
``` I guess
python discord.py 机器人 openai-api chatgpt-api

评论

5赞 Sembei Norimaki 11/15/2023
你有没有做过经文中建议的任何事情?你说你还没有读过文档,现在是读的好时机。

答:

0赞 iifast2 11/15/2023 #1

根据我对你的错误的理解,你可以:

您可以升级代码库以使用 1.0.0 接口。

openai migrate

然后尝试旧版本:

pip install openai==0.28

尝试建议的解决方案,然后再次查看 CLI 提示的内容。