d3 / call_demo /hg.py
sanbo
update sth. at 2024-11-14 16:08:54
b23eeaf
raw
history blame contribute delete
588 Bytes
import requests
import json
url = 'https://sanbo1200-duck2api.hf.space/completions'
headers = {
'Content-Type': 'application/json'
}
data = {
"model": "gpt-4o-mini",
"messages": [
{"role": "system", "content": "你是一个辅助机器人"},
{"role": "user", "content": "你的知识库最后什么日期"}
],
"stream": False
}
response = requests.post(url, headers=headers, data=json.dumps(data), stream=True)
response.encoding = 'utf-8'
# 打印返回的数据流
for line in response.iter_lines():
if line:
print(line.decode('utf-8'))