Files

18 lines
1.1 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# dengyuyun-joy: quick functional check against the trial API.
U=http://127.0.0.1:18100
curl -s -m 10 $U/v1/models | python3 -c "import json,sys;d=json.load(sys.stdin);print('models:',[(m['id'],m.get('max_model_len')) for m in d['data']])"
for q in "用一句话介绍你自己。" "计算 123456 × 789,只给出结果。" "Write a Python function that returns the n-th Fibonacci number, then explain it in one sentence."; do
python3 - "$q" <<'PY'
import json,sys,time,urllib.request
q=sys.argv[1]
body={"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":q}],"temperature":0,"max_tokens":512}
t=time.time()
r=urllib.request.urlopen(urllib.request.Request("http://127.0.0.1:18100/v1/chat/completions",json.dumps(body).encode(),{"Content-Type":"application/json"}),timeout=600)
d=json.load(r); dt=time.time()-t
m=d["choices"][0]["message"]; u=d.get("usage",{})
print("Q:",q); print("A:",(m.get("content") or "").strip()[:600]); print("reasoning chars:",len(m.get("reasoning_content") or m.get("reasoning") or ""))
print(f"usage={u} wall={dt:.1f}s ~{u.get('completion_tokens',0)/dt:.1f} tok/s"); print("-"*60)
PY
done