33 lines
1.7 KiB
Python
33 lines
1.7 KiB
Python
import json, time, urllib.request, urllib.error
|
|
|
|
MODELS = ["gpt-6.1-sol", "gpt-6-sol", "gpt-6-astra", "gpt-6-luna", "claude-opus-5.5", "claude-opus-5",
|
|
"claude-sonnet-5.5", "claude-haiku-5.5", "claude-fable-5.1", "kimi-k3", "glm-5.3",
|
|
"glm-5.3-flash", "deepseek-v4.1-flash", "qwen3.8-max", "qwen3.8-27b", "grok-4.7",
|
|
"gemini-3.8-flash", "gemini-4-argon", "minimax-m3", "gpt-5.6-sol", "gpt-5.6-terra",
|
|
"gpt-5.6-luna", "kimi-k3.1-pro", "gpt-image-2.5"]
|
|
OUT = []
|
|
|
|
|
|
def call(model, prompt="Столица Франции — одним словом", mt=64, timeout=100):
|
|
body = json.dumps({"model": model, "messages": [{"role": "user", "content": prompt}], "max_tokens": mt}).encode()
|
|
h = {"Content-Type": "application/json", "User-Agent": "Mozilla/5.0 Chrome/156"}
|
|
t0 = time.time()
|
|
try:
|
|
r = urllib.request.urlopen(urllib.request.Request("http://127.0.0.1:48023/v1/chat/completions",
|
|
data=body, headers=h), timeout=timeout)
|
|
d = json.loads(r.read())
|
|
ch = (d.get("choices") or [{}])[0]
|
|
txt = (ch.get("message") or {}).get("content") or ""
|
|
return 200, round(time.time() - t0, 1), (txt or "")[:60].replace("\n", " ")
|
|
except urllib.error.HTTPError as e:
|
|
return e.code, round(time.time() - t0, 1), e.read()[:90].decode("utf-8", "replace")
|
|
except Exception as e:
|
|
return -1, round(time.time() - t0, 1), type(e).__name__
|
|
|
|
|
|
for m in MODELS:
|
|
code, dt, txt = call(m)
|
|
OUT.append({"model": m, "code": code, "sec": dt, "sample": txt})
|
|
print("%-22s %-4s %5.1fs %s" % (m, code, dt, txt[:70]), flush=True)
|
|
json.dump(OUT, open("/root/souz/model_probe.json", "w"), ensure_ascii=False, indent=1)
|
|
print("saved") |