atlasbot: force metric fallback for count questions
This commit is contained in:
parent
67302b052a
commit
a6d4518177
@ -215,6 +215,7 @@ class AnswerEngine:
|
|||||||
classify.setdefault("focus_entity", "unknown")
|
classify.setdefault("focus_entity", "unknown")
|
||||||
classify.setdefault("focus_metric", "unknown")
|
classify.setdefault("focus_metric", "unknown")
|
||||||
_debug_log("route_parsed", {"classify": classify, "normalized": normalized})
|
_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 = (
|
cluster_terms = (
|
||||||
"atlas",
|
"atlas",
|
||||||
"cluster",
|
"cluster",
|
||||||
@ -305,7 +306,7 @@ class AnswerEngine:
|
|||||||
max_lines=max(4, plan.max_subquestions * 2),
|
max_lines=max(4, plan.max_subquestions * 2),
|
||||||
)
|
)
|
||||||
metric_facts: list[str] = []
|
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:
|
if observer:
|
||||||
observer("retrieve", "extracting fact types")
|
observer("retrieve", "extracting fact types")
|
||||||
fact_types = await _extract_fact_types(
|
fact_types = await _extract_fact_types(
|
||||||
@ -541,7 +542,7 @@ class AnswerEngine:
|
|||||||
model=plan.model,
|
model=plan.model,
|
||||||
tag="focus_fix",
|
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
|
best_line = None
|
||||||
lowered_keywords = [kw.lower() for kw in keyword_tokens if kw]
|
lowered_keywords = [kw.lower() for kw in keyword_tokens if kw]
|
||||||
for line in metric_facts:
|
for line in metric_facts:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user