atlasbot: enforce metric facts
This commit is contained in:
parent
a8e9bc53de
commit
387eea1399
@ -405,7 +405,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 and not re.search(r"\\d", reply):
|
if classify.get("question_type") in {"metric", "diagnostic"} 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:
|
||||||
@ -414,7 +414,10 @@ class AnswerEngine:
|
|||||||
best_line = line
|
best_line = line
|
||||||
break
|
break
|
||||||
best_line = best_line or metric_facts[0]
|
best_line = best_line or metric_facts[0]
|
||||||
reply = f"From the latest snapshot: {best_line}."
|
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:
|
if plan.use_critic:
|
||||||
if observer:
|
if observer:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user