@@ -259,6 +259,30 @@ def _flush(status: str, **extra: Any) -> None:
259259 report ["served_model_id" ] = model_id
260260 _log (f"served model id: { model_id } " )
261261
262+ # DEBUG: capture the raw server response for a simple control prompt, so
263+ # we can see finish_reason / structure (diagnose the empty-answer issue).
264+ for dbgname , dbgbody in (
265+ ("debug_simple_chat" , {
266+ "model" : model_id ,
267+ "messages" : [{"role" : "user" ,
268+ "content" : "What is the capital of France? Answer in one short sentence." }],
269+ "max_tokens" : 32 , "temperature" : 0.0 }),
270+ ("debug_simple_completion" , {
271+ "model" : model_id ,
272+ "prompt" : "<start_of_turn>user\n What is the capital of France?<end_of_turn>\n <start_of_turn>model\n " ,
273+ "max_tokens" : 32 , "temperature" : 0.0 , "stop" : ["<end_of_turn>" ]}),
274+ ):
275+ path = ("/v1/chat/completions" if "chat" in dbgname
276+ else "/v1/completions" )
277+ try :
278+ dbg = _post (base_url , path , dbgbody , args .req_timeout )
279+ report [dbgname ] = json .dumps (dbg )[:900 ]
280+ except urllib .error .HTTPError as exc :
281+ report [dbgname ] = f"HTTP { exc .code } : { exc .read ().decode ('utf-8' ,'replace' )[:300 ]} "
282+ except Exception as exc : # noqa: BLE001
283+ report [dbgname ] = f"{ type (exc ).__name__ } : { exc } "
284+ _log (f"{ dbgname } : { report [dbgname ][:300 ]} " )
285+
262286 items = _build_niah_items (args .sessions , args .haystack_lines )
263287
264288 # Warmup (lazy MLX graph compile) — not measured.
0 commit comments