最近想试用一下通过API调用ChatGPT,在测试 gpt-3.5-turbo 的时候遇到了“openai.error.InvalidRequestError: This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions? ”的问题。
所以该尝试 text-davinci-003 ,代码如下:
import openai
import osopenai.api_key = "your key"response = openai.Completion.create(model='text-davinci-003',prompt = "你能背诵圆周率么?",temperature = 0.5,)print(response)
print("content:"+response["choices"][0]["text"])
结果输出如下:
输出极其诡异,想问问大家有遇到这种情况么?遇到的话应该怎么解决的?是有少设置了什么么?