atlasbot: enforce metric facts
This commit is contained in:
parent
a8e9bc53de
commit
387eea1399
@ -405,7 +405,7 @@ class AnswerEngine:
|
||||
model=plan.model,
|
||||
tag="focus_fix",
|
||||
)
|
||||
if classify.get("question_type") in {"metric", "diagnostic"} and metric_facts and not re.search(r"\\d", reply):
|
||||
if classify.get("question_type") in {"metric", "diagnostic"} and metric_facts:
|
||||
best_line = None
|
||||
lowered_keywords = [kw.lower() for kw in keyword_tokens if kw]
|
||||
for line in metric_facts:
|
||||
@ -414,6 +414,9 @@ class AnswerEngine:
|
||||
best_line = line
|
||||
break
|
||||
best_line = best_line or metric_facts[0]
|
||||
reply_numbers = set(re.findall(r"\\d+(?:\\.\\d+)?", reply))
|
||||
fact_numbers = set(re.findall(r"\\d+(?:\\.\\d+)?", " ".join(metric_facts)))
|
||||
if not reply_numbers or (fact_numbers and not (reply_numbers & fact_numbers)):
|
||||
reply = f"From the latest snapshot: {best_line}."
|
||||
|
||||
if plan.use_critic:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user