atlasbot: enforce fast answer body

This commit is contained in:
Brad Stein 2026-01-28 03:17:46 -03:00
parent 971848558a
commit be82109d4e

View File

@ -2926,6 +2926,7 @@ def _open_ended_system() -> str:
"If the question asks for a list, embed the list inline in a sentence (comma-separated). "
"If the question is ambiguous, pick a reasonable interpretation and state it briefly. "
"Avoid repeating the exact same observation as the last response if possible; vary across metrics, workload, or hardware details. "
"Always include at least one substantive answer sentence before the score lines. "
"When the fact pack includes hottest_cpu/ram/net/io lines, use them to answer hottest/busiest node questions. "
"When the fact pack includes postgres_hottest_db, use it for questions about the busiest database. "
"Do not invent numbers or facts. "
@ -3801,6 +3802,24 @@ def _fast_fact_lines(
return selected
def _has_body_lines(answer: str) -> bool:
lines = [line.strip() for line in (answer or "").splitlines() if line.strip()]
for line in lines:
lowered = line.lower()
if lowered.startswith("confidence"):
continue
if lowered.startswith("relevance"):
continue
if lowered.startswith("satisfaction"):
continue
if lowered.startswith("hallucinationrisk"):
continue
if lowered.startswith("hallucination risk"):
continue
return True
return False
def _open_ended_fast_single(
prompt: str,
*,
@ -3818,6 +3837,15 @@ def _open_ended_fast_single(
system_override=_open_ended_system(),
model=model,
)
if not _has_body_lines(reply):
reply = _ollama_call(
("atlasbot_fast", "atlasbot_fast"),
prompt + " Provide one clear sentence before the score lines.",
context=context,
use_history=False,
system_override=_open_ended_system(),
model=model,
)
if state:
state.update("done", step=_open_ended_total_steps("fast"))
return _ensure_scores(reply)