diff --git a/atlasbot/engine/answerer.py b/atlasbot/engine/answerer.py index fbcfe16..91ed684 100644 --- a/atlasbot/engine/answerer.py +++ b/atlasbot/engine/answerer.py @@ -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 diff --git a/atlasbot/llm/prompts.py b/atlasbot/llm/prompts.py index 37a6834..f5a2fb8 100644 --- a/atlasbot/llm/prompts.py +++ b/atlasbot/llm/prompts.py @@ -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\": []}}." )