atlasbot: select metric facts

This commit is contained in:
Brad Stein 2026-02-01 12:00:42 -03:00
parent 97fa07ed98
commit 42be65cbcf

View File

@ -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],