diff --git a/atlasbot/engine/answerer.py b/atlasbot/engine/answerer.py index 78974c5..b30862f 100644 --- a/atlasbot/engine/answerer.py +++ b/atlasbot/engine/answerer.py @@ -215,6 +215,7 @@ class AnswerEngine: classify.setdefault("focus_entity", "unknown") classify.setdefault("focus_metric", "unknown") _debug_log("route_parsed", {"classify": classify, "normalized": normalized}) + force_metric = bool(re.search(r"\bhow many\b|\bcount\b|\btotal\b", normalized.lower())) cluster_terms = ( "atlas", "cluster", @@ -305,7 +306,7 @@ class AnswerEngine: max_lines=max(4, plan.max_subquestions * 2), ) metric_facts: list[str] = [] - if classify.get("question_type") in {"metric", "diagnostic"}: + if classify.get("question_type") in {"metric", "diagnostic"} or force_metric: if observer: observer("retrieve", "extracting fact types") fact_types = await _extract_fact_types( @@ -541,7 +542,7 @@ class AnswerEngine: model=plan.model, tag="focus_fix", ) - if classify.get("question_type") in {"metric", "diagnostic"} and metric_facts: + if (classify.get("question_type") in {"metric", "diagnostic"} or force_metric) and metric_facts: best_line = None lowered_keywords = [kw.lower() for kw in keyword_tokens if kw] for line in metric_facts: