1 Schnittstellencode
Nehmen Sie sich Zeit, mit dem Testen fortzufahren
import openai
# 填入你的api_key
openai.api_key = ""
models = openai.Model.list()
# 定义API参数
params = {'role': "user", "content": ''}
# 定义循环
while True:
# 获取用户输入
user_input = input("请输入您的消息:")
if user_input.lower() == "quit":
break
# 更新API参数
params["content"] = user_input
# 发送请求到API
#response = requests.get(url, params=params)
completion = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=[
params])
print(completion.choices[0].message.content)
2. Empfohlene Versionen von Jupiter
1 Installieren Sie Jupyter Notebook Version 6.4.5:
pip install notebook==6.4.5
2 Beachten Sie, dass hier möglicherweise Fehler auftreten. Fügen Sie die Installation hinzu:
pip install --force-reinstall -v "traitlets<5.10"