From 325638cbac496c378f92ad9e8ae182465fd7d855 Mon Sep 17 00:00:00 2001 From: Freddi Date: Sun, 5 Jul 2026 23:03:11 +0200 Subject: [PATCH] Increase Ollama num_predict to fix JSON truncation on long headlines Manual scoring of 30 explanations surfaced two rows falling back to the offline placeholder even with Ollama reachable: the 220-token budget was cutting off the model's JSON reply mid-object on unusually long/quote-heavy headlines, so _extract_explanation had nothing parseable. Bumped to 350 to give the reasoning + explanation fields enough room to complete. --- agents/freddi_explanation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agents/freddi_explanation.py b/agents/freddi_explanation.py index 5dbb550..c8c94da 100644 --- a/agents/freddi_explanation.py +++ b/agents/freddi_explanation.py @@ -153,7 +153,7 @@ def _build_chain(model: str, base_url: str, timeout: float): model=model, base_url=base_url, temperature=0.3, # low: grounded, low-variance explanations - num_predict=220, # room for the JSON reasoning + explanation + num_predict=350, # room for the JSON reasoning + explanation keep_alive=DEFAULT_KEEP_ALIVE, client_kwargs={"timeout": timeout}, )