Spaces:
Sleeping
Sleeping
Download app/agents/explainer_agent.py from TheJackBright/polyguard-openenv: direct link, hf CLI and curl.
- Browser
- Download file 772 Bytes
-
https://huggingface.co/spaces/TheJackBright/polyguard-openenv/resolve/main/app/agents/explainer_agent.py
- Command line
-
hf download hf://spaces/TheJackBright/polyguard-openenv/app/agents/explainer_agent.py
-
curl -L -o explainer_agent.py https://huggingface.co/spaces/TheJackBright/polyguard-openenv/resolve/main/app/agents/explainer_agent.py
772 Bytes
| """Explanation agent.""" | |
| from __future__ import annotations | |
| from app.common.types import PolyGuardAction, PolyGuardState | |
| class ExplainerAgent: | |
| name = "ExplainerAgent" | |
| def run(self, state: PolyGuardState, action: PolyGuardAction, critic_report: dict) -> dict: | |
| return { | |
| "explanation": ( | |
| f"Action {action.action_type.value} selected for mode {action.mode.value}. " | |
| f"Burden score={state.burden_score:.3f}, meds={len(state.patient.medications)}. " | |
| f"Critic legal={critic_report.get('legal', False)}." | |
| ), | |
| "grounded_facts": { | |
| "burden_score": state.burden_score, | |
| "polypharmacy_count": len(state.patient.medications), | |
| }, | |
| } | |