You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
769 B
33 lines
769 B
import httpx
|
|
|
|
content = "简单讲解一下mvc模型上下文"
|
|
key = "sk-mepewzmlykchrjosberepdvvbnrjbhoamewefnckokitveqf"
|
|
model = "THUDM/GLM-4.1V-9B-Thinking"
|
|
url = "https://api.siliconflow.cn/v1/chat/completions"
|
|
|
|
headers = {
|
|
"Authorization": f"Bearer {key}",
|
|
"Content-Type": "application/json"
|
|
}
|
|
payload = {
|
|
"model": model,
|
|
"messages": [{"role": "user", "content": content}]
|
|
}
|
|
|
|
with httpx.Client(timeout=999) as client:
|
|
response = client.post(url, headers=headers, json=payload)
|
|
if response.json()["choices"][0]["message"]["content"]:
|
|
content = response.json()["choices"][0]["message"]["content"]
|
|
content = content.split("\n")
|
|
for i in content:
|
|
print(i)
|
|
else:
|
|
print(response.json())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|