atlasbot: prefer hottest node facts

This commit is contained in:
Brad Stein 2026-02-01 12:34:57 -03:00
parent ab7a7d3bd3
commit ccd47ea02a
2 changed files with 6 additions and 1 deletions

View File

@ -985,6 +985,7 @@ def _metric_candidate_lines(lines: list[str], keywords: list[str] | None, limit:
if not lines:
return []
lowered = [kw.lower() for kw in (keywords or []) if kw]
prefer_node = any("node" in kw for kw in lowered) or "hottest" in lowered
metric_tokens = {
"cpu",
"ram",
@ -1004,6 +1005,8 @@ def _metric_candidate_lines(lines: list[str], keywords: list[str] | None, limit:
candidates: list[str] = []
for line in lines:
line_lower = line.lower()
if prefer_node and "pod_" in line_lower:
continue
if "hottest:" in line_lower:
candidates.append(line)
continue

View File

@ -215,7 +215,9 @@ FACT_SELECT_SYSTEM = (
FACT_SELECT_PROMPT = (
"Pick up to {max_lines} lines from Candidates that best answer the question. "
"If the question asks for highest/hottest and Candidates include a line starting with 'hottest:', prefer that line. "
"If the question asks for highest/hottest and Candidates include a line starting with 'hottest:', you must include that line. "
"If the question mentions nodes and a 'hottest:' line exists, prefer node-level facts over pod-level lines. "
"Avoid pod_* lines unless the question explicitly mentions pods. "
"Return JSON with field: lines (list of strings). If none apply, return {{\"lines\": []}}."
)