atlasbot: strengthen lexicon and runbook fixes
This commit is contained in:
parent
a3e98c8632
commit
2386d5c832
@ -99,7 +99,9 @@ EVIDENCE_FIX_PROMPT = (
|
|||||||
"Check the draft against the context. "
|
"Check the draft against the context. "
|
||||||
"If the draft says data is missing but the context includes relevant values, "
|
"If the draft says data is missing but the context includes relevant values, "
|
||||||
"rewrite the answer to include those values. "
|
"rewrite the answer to include those values. "
|
||||||
"If data is truly missing, keep the draft concise and honest."
|
"If data is truly missing, keep the draft concise and honest. "
|
||||||
|
"If AllowedRunbooks are provided, use an exact path from that list when answering "
|
||||||
|
"documentation or checklist questions and do not invent new paths."
|
||||||
)
|
)
|
||||||
|
|
||||||
DRAFT_SELECT_PROMPT = (
|
DRAFT_SELECT_PROMPT = (
|
||||||
|
|||||||
@ -104,6 +104,7 @@ def build_summary(snapshot: dict[str, Any] | None) -> dict[str, Any]:
|
|||||||
summary.update(_build_workloads(snapshot))
|
summary.update(_build_workloads(snapshot))
|
||||||
summary.update(_build_flux(snapshot))
|
summary.update(_build_flux(snapshot))
|
||||||
_merge_cluster_summary(snapshot, summary)
|
_merge_cluster_summary(snapshot, summary)
|
||||||
|
_augment_lexicon(summary)
|
||||||
return summary
|
return summary
|
||||||
|
|
||||||
|
|
||||||
@ -131,6 +132,37 @@ def _merge_cluster_summary(snapshot: dict[str, Any], summary: dict[str, Any]) ->
|
|||||||
summary["cross_stats"] = cross_stats
|
summary["cross_stats"] = cross_stats
|
||||||
|
|
||||||
|
|
||||||
|
def _augment_lexicon(summary: dict[str, Any]) -> None:
|
||||||
|
lexicon = summary.get("lexicon")
|
||||||
|
if not isinstance(lexicon, dict):
|
||||||
|
lexicon = {"terms": [], "aliases": {}}
|
||||||
|
terms = list(lexicon.get("terms") or [])
|
||||||
|
aliases = dict(lexicon.get("aliases") or {})
|
||||||
|
hardware = summary.get("hardware") if isinstance(summary.get("hardware"), dict) else {}
|
||||||
|
hardware_map = {
|
||||||
|
"rpi5": "Raspberry Pi 5 nodes",
|
||||||
|
"rpi4": "Raspberry Pi 4 nodes",
|
||||||
|
"rpi": "Raspberry Pi nodes",
|
||||||
|
"jetson": "NVIDIA Jetson nodes",
|
||||||
|
"amd64": "AMD64 nodes",
|
||||||
|
}
|
||||||
|
existing_terms = {entry.get("term") for entry in terms if isinstance(entry, dict)}
|
||||||
|
for key, meaning in hardware_map.items():
|
||||||
|
if key not in hardware:
|
||||||
|
continue
|
||||||
|
if key not in existing_terms:
|
||||||
|
terms.append({"term": key, "meaning": meaning})
|
||||||
|
if key not in aliases:
|
||||||
|
aliases[key] = meaning
|
||||||
|
if "raspberry pi 5" not in aliases and "rpi5" in hardware:
|
||||||
|
aliases["raspberry pi 5"] = "rpi5"
|
||||||
|
if "raspberry pi 4" not in aliases and "rpi4" in hardware:
|
||||||
|
aliases["raspberry pi 4"] = "rpi4"
|
||||||
|
lexicon["terms"] = terms
|
||||||
|
lexicon["aliases"] = aliases
|
||||||
|
summary["lexicon"] = lexicon
|
||||||
|
|
||||||
|
|
||||||
def _nodes_detail(snapshot: dict[str, Any]) -> list[dict[str, Any]]:
|
def _nodes_detail(snapshot: dict[str, Any]) -> list[dict[str, Any]]:
|
||||||
items = snapshot.get("nodes_detail")
|
items = snapshot.get("nodes_detail")
|
||||||
return items if isinstance(items, list) else []
|
return items if isinstance(items, list) else []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user