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:
+3
-2
@@ -81,9 +81,10 @@ class OmniMock:
|
||||
if not beh.get("no_usage"):
|
||||
resp["usage"] = beh.get("usage")
|
||||
if not beh.get("omit_choices"):
|
||||
resp["choices"] = [{"index": 0, "finish_reason": "stop",
|
||||
resp["choices"] = [{"index": 0, "finish_reason": beh.get("finish_reason", "stop"),
|
||||
"message": {"role": "assistant",
|
||||
"content": beh.get("content", "4")}}]
|
||||
"content": beh.get("content", "4"),
|
||||
"reasoning_content": beh.get("reasoning_content")}}]
|
||||
self._send_json(200, resp)
|
||||
|
||||
def do_GET(self):
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
"""Оба пути пробы запрашивают none и не падают на reasoning-only ответе."""
|
||||
import json
|
||||
import sqlite3
|
||||
|
||||
|
||||
def test_cron_disables_reasoning_and_reports_null_content(core, omni_server):
|
||||
omni_server.set_completions(content=None, reasoning_content="thinking", finish_reason="length",
|
||||
usage={"prompt_tokens": 12, "completion_tokens": 5, "total_tokens": 17})
|
||||
ok, latency, error, usage = core.probe.check_model("zai/test-model-a")
|
||||
assert ok is False
|
||||
assert error == "Empty text response (finish_reason=length)"
|
||||
assert usage["total_tokens"] == 17
|
||||
request = omni_server.requests[-1]["body"]
|
||||
assert request["reasoning_effort"] == "none"
|
||||
assert request["max_tokens"] == 5
|
||||
|
||||
|
||||
def test_manual_disables_reasoning_and_persists_empty_text(core, omni_server):
|
||||
omni_server.set_completions(content=None, reasoning_content="thinking", finish_reason="length",
|
||||
usage={"prompt_tokens": 12, "completion_tokens": 5, "total_tokens": 17})
|
||||
response = core.client.get("/api/check/zai/test-model-a")
|
||||
assert response.status_code == 200
|
||||
assert response.json()["ok"] is False
|
||||
assert omni_server.requests[-1]["body"]["reasoning_effort"] == "none"
|
||||
db = sqlite3.connect(core.db_path)
|
||||
row = db.execute("SELECT ok,error,total_tokens FROM checks ORDER BY id DESC LIMIT 1").fetchone()
|
||||
db.close()
|
||||
assert row == (0, "Empty text response (finish_reason=length)", 17)
|
||||
|
||||
|
||||
def test_text_response_still_succeeds(core, omni_server):
|
||||
omni_server.set_completions(content=" 4 ")
|
||||
assert core.probe.check_model("zai/test-model-a")[0] is True
|
||||
assert core.client.get("/api/check/zai/test-model-a").json()["ok"] is True
|
||||
Reference in New Issue
Block a user