atlasbot: use structured answers before LLM
This commit is contained in:
parent
b7f454b790
commit
159c9cfe68
@ -16,7 +16,7 @@ spec:
|
||||
labels:
|
||||
app: atlasbot
|
||||
annotations:
|
||||
checksum/atlasbot-configmap: manual-atlasbot-36
|
||||
checksum/atlasbot-configmap: manual-atlasbot-37
|
||||
vault.hashicorp.com/agent-inject: "true"
|
||||
vault.hashicorp.com/role: "comms"
|
||||
vault.hashicorp.com/agent-inject-secret-turn-secret: "kv/data/atlas/comms/turn-shared-secret"
|
||||
|
||||
@ -1744,6 +1744,17 @@ class _AtlasbotHandler(BaseHTTPRequestHandler):
|
||||
snapshot = _snapshot_state()
|
||||
inventory = _snapshot_inventory(snapshot) or node_inventory_live()
|
||||
workloads = _snapshot_workloads(snapshot)
|
||||
metrics_summary = snapshot_context(prompt, snapshot)
|
||||
structured = structured_answer(
|
||||
prompt,
|
||||
inventory=inventory,
|
||||
metrics_summary=metrics_summary,
|
||||
snapshot=snapshot,
|
||||
workloads=workloads,
|
||||
)
|
||||
if structured:
|
||||
self._write_json(200, {"answer": structured})
|
||||
return
|
||||
context = build_context(
|
||||
prompt,
|
||||
allow_tools=False,
|
||||
@ -2065,6 +2076,19 @@ def sync_loop(token: str, room_id: str):
|
||||
if not inventory:
|
||||
inventory = _snapshot_inventory(snapshot)
|
||||
workloads = _snapshot_workloads(snapshot)
|
||||
metrics_summary = snapshot_context(body, snapshot)
|
||||
structured = structured_answer(
|
||||
body,
|
||||
inventory=inventory,
|
||||
metrics_summary=metrics_summary,
|
||||
snapshot=snapshot,
|
||||
workloads=workloads,
|
||||
)
|
||||
if structured:
|
||||
history[hist_key].append(f"Atlas: {structured}")
|
||||
history[hist_key] = history[hist_key][-80:]
|
||||
send_msg(token, rid, structured)
|
||||
continue
|
||||
context = build_context(
|
||||
body,
|
||||
allow_tools=allow_tools,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user