openai-quickstart
openai-quickstart copied to clipboard
翻译pdf代码显示The server could not be reached [Errno 0] Error,是我的api错了或者模型选错了吗
trafficstars
我在笔记本上也出现你的情况,但换台主机后,就可以了,所以和代码无关,可能是网络等问题
from openai import OpenAI client = OpenAI()
completion = client.chat.completions.create( model="gpt-3.5-turbo", messages=[ {"role": "system", "content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."}, {"role": "user", "content": "Compose a poem that explains the concept of recursion in programming."} ] )
print(completion.choices[0].message)你可以先试一下这个,我笔记本这个他显示openai连接错误,只要这个代码你能运行,翻译的代码大概率也是可以直接运行不会报错的
原来是我的python解释器版本太低了,要使用openai最低得3.7.1才行