Spaces:
Paused
Paused
Download agents/state.py from 3SCError404/miracle: direct link, hf CLI and curl.
- Browser
- Download file 1.84 kB
-
https://huggingface.co/spaces/3SCError404/miracle/resolve/main/agents/state.py
- Command line
-
hf download hf://spaces/3SCError404/miracle/agents/state.py
-
curl -L -o state.py https://huggingface.co/spaces/3SCError404/miracle/resolve/main/agents/state.py
1.84 kB
| from typing import TypedDict, List, Optional, Any, Dict, Annotated | |
| from uuid import UUID | |
| def merge_list(current: List[Any], new: List[Any]) -> List[Any]: | |
| return (current or []) + (new or []) | |
| def merge_dict(current: Dict[str, Any], new: Dict[str, Any]) -> Dict[str, Any]: | |
| _c = current.copy() if current else {} | |
| if new: | |
| _c.update(new) | |
| return _c | |
| class AgentState(TypedDict): | |
| """ | |
| Shared state for the Customer Portal Agentic Workflow. | |
| """ | |
| # Source Info | |
| ticket_id: UUID | |
| workspace_id: UUID | |
| thread_id: Optional[UUID] | |
| title: str | |
| description: str | |
| attachments: Optional[List[Any]] # Serialized attachment data (id, filename, ai_caption) | |
| # --- Consolidated AI Ingestion --- | |
| embedding: Optional[List[float]] # Shared Centroid Vector (Nomic-768) | |
| vision_context: Optional[List[Dict[str, Any]]] # Image Captions/Refs | |
| # Processed Results | |
| category: Optional[str] | |
| priority: Optional[str] | |
| sentiment: Optional[str] | |
| # Duplication Info | |
| is_duplicate: bool | |
| duplicate_of_id: Optional[UUID] | |
| # Generated Outputs | |
| assigned_to: Optional[UUID] | |
| status: Optional[str] | |
| kb_suggested_solution: Optional[str] | |
| root_cause_analysis: Optional[str] | |
| proposed_technical_solution: Optional[str] | |
| internal_summary: Optional[str] | |
| kb_extracts: Optional[List[Dict[str, Any]]] # Relevant KB articles or chunks | |
| is_new_topic: bool = False # Flag for KB expansion | |
| # Flow Control | |
| target_team: Optional[str] # Identified department (Engineering, SecOps, etc.) | |
| next_node: Optional[str] | |
| proposed_insights: Annotated[List[Dict[str, Any]], merge_list] | |
| errors: Annotated[List[str], merge_list] | |
| metadata: Annotated[Dict[str, Any], merge_dict] | |
| processed_steps: Annotated[List[Dict[str, Any]], merge_list] | |