Download src/core/state.py from DiabetesCareChatbot/dmChatbotBackend: direct link, hf CLI and curl.
- Browser
- Download file 1.8 kB
-
https://huggingface.co/spaces/DiabetesCareChatbot/dmChatbotBackend/resolve/main/src/core/state.py
- Command line
-
hf download hf://spaces/DiabetesCareChatbot/dmChatbotBackend/src/core/state.py
-
curl -L -o state.py https://huggingface.co/spaces/DiabetesCareChatbot/dmChatbotBackend/resolve/main/src/core/state.py
1.8 kB
| from typing import TypedDict, Annotated, List, Union | |
| from langchain_core.messages import BaseMessage | |
| import operator | |
| class AgentState(TypedDict): | |
| # Standard message history | |
| messages: Annotated[List[BaseMessage], operator.add] | |
| # Metadata for routing | |
| user_role: str # patient, clinician, researcher | |
| intent_type: str # diagnosis, treatment, monitoring, general | |
| trace_id: str | |
| # CDM / FHIR Data | |
| session_id: str | |
| patient_id: str | |
| fhir_data: List[dict] | |
| trend_analysis: str | |
| trend_data: dict | |
| cdm_trend_analysis: dict | |
| current_medications: List[dict] | |
| # Validation status | |
| is_valid: bool | |
| is_safe: bool | |
| # Intermediate outputs | |
| patient_response: str | |
| clinician_outputs: List[str] | |
| research_output: str | |
| # Recovery loop counter | |
| attempts: int | |
| # Sources for information | |
| sources: Annotated[List[str], operator.add] | |
| # Evidence citations for clinical recommendations (Bug 12.3) | |
| evidence_citations: Annotated[List[dict], operator.add] | |
| # Execution logs | |
| logs: Annotated[List[str], operator.add] | |
| # Metrics (tokens, time) | |
| metrics: Annotated[List[dict], operator.add] | |
| # Phase 0 skill runtime metadata | |
| active_skill_id: str | |
| active_skill_version: str | |
| manager_route: dict | |
| skill_plan: List[dict] | |
| skill_trace: List[dict] | |
| request_id: str | |
| authorization_subject: str | |
| data_access_scope: List[str] | |
| consent_status: str | |
| response_artifacts: List[dict] | |
| retrieved_sources: Annotated[List[dict], operator.add] | |
| memory_context: List[dict] | |
| memory_proposals: Annotated[List[dict], operator.add] | |
| memory_commit_results: Annotated[List[dict], operator.add] | |
| gates: dict | |
| termination_reason: str | |
| runtime_mode: str | |