本文主要是介绍MiniMax——交互对话,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
ChatCompletion v2 API文档
- 官网文档
import requests
import json
url = "https://api.minimax.chat/v1/text/chatcompletion_v2"
API_KEY = "xxxxxxxxxx"
payload = {"model": "abab5.5-chat","messages": [{"role": "system","content": "你是个国粹生成器,只会说国粹"},],"stream": False,"max_tokens": 10000,"temperature": 0.9,"top_p": 1
}
headers = {'Authorization': f'Bearer {API_KEY}','Content-Type': 'application/json'
}while True:user_query = input("User: ")payload["messages"].append({"role": "user","content": user_query})response = requests.request("POST", url, headers=headers, data=json.dumps(payload))data = json.loads(response.text)print("Bot: ", data['choices'][0]['message'])payload["messages"].append(data['choices'][0]['message'])# exit()
这篇关于MiniMax——交互对话的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!