fix: request no reasoning for liveness and handle empty text
Build and deploy / build-deploy (push) Waiting to run
Build and deploy / build-deploy (push) Waiting to run
This commit is contained in:
+8
-2
@@ -37,6 +37,7 @@ def check_model(model_id: str) -> tuple[bool, int | None, str | None, dict]:
|
||||
"model": model_id,
|
||||
"messages": [{"role": "user", "content": "2+2=?"}],
|
||||
"max_tokens": 5,
|
||||
"reasoning_effort": "none",
|
||||
}).encode()
|
||||
req = urllib.request.Request(
|
||||
f"{OMNIROUTE_URL}/v1/chat/completions",
|
||||
@@ -50,8 +51,13 @@ def check_model(model_id: str) -> tuple[bool, int | None, str | None, dict]:
|
||||
resp = json.loads(r.read())
|
||||
# Usage — до любой валидации контента.
|
||||
usage = extract_usage(resp)
|
||||
content = resp["choices"][0]["message"]["content"]
|
||||
ok = bool(content.strip())
|
||||
# HTTP 200 может содержать только reasoning и content=null.
|
||||
# Это не успешный текстовый ответ и не ошибка Python.
|
||||
choice = resp["choices"][0]
|
||||
content = choice["message"].get("content")
|
||||
ok = isinstance(content, str) and bool(content.strip())
|
||||
if not ok:
|
||||
error = f"Empty text response (finish_reason={choice.get('finish_reason')})"
|
||||
except Exception as e:
|
||||
error = f"{type(e).__name__}: {e}"
|
||||
print(f" ✗ {model_id}: {error}", file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user