From 42be65cbcf69977615af3f8279c9df1bd728314c Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Sun, 1 Feb 2026 12:00:42 -0300 Subject: [PATCH] atlasbot: select metric facts --- atlasbot/engine/answerer.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/atlasbot/engine/answerer.py b/atlasbot/engine/answerer.py index e9c33c4..fbcfe16 100644 --- a/atlasbot/engine/answerer.py +++ b/atlasbot/engine/answerer.py @@ -262,11 +262,14 @@ class AnswerEngine: selected = _select_chunks(chunks, scored, plan, keyword_tokens) key_facts = _key_fact_lines(summary_lines, keyword_tokens) metric_facts = [line for line in key_facts if re.search(r"\d", line)] - if classify.get("question_type") in {"metric", "diagnostic"} and not metric_facts: + if classify.get("question_type") in {"metric", "diagnostic"}: metric_candidates = _metric_candidate_lines(summary_lines, keyword_tokens) - metric_facts = await _select_metric_facts(call_llm, normalized, metric_candidates, plan) - if metric_facts: + selected_facts = await _select_metric_facts(call_llm, normalized, metric_candidates, plan) + if selected_facts: + metric_facts = selected_facts key_facts = _merge_fact_lines(metric_facts, key_facts) + if self._settings.debug_pipeline: + _debug_log("metric_facts_selected", {"facts": metric_facts}) if self._settings.debug_pipeline: scored_preview = sorted( [{"id": c["id"], "score": scored.get(c["id"], 0.0), "summary": c["summary"]} for c in chunks],