赞
踩
GPT-3.5.py
: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)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。