| | from typing import List, Dict, Any, Optional, Union, Annotated |
| | from typing_extensions import TypedDict |
| | from langchain_core.messages import BaseMessage |
| | from pydantic import BaseModel, Field |
| | from langgraph.graph.message import add_messages |
| |
|
| | |
| |
|
| | class KeyIssue(BaseModel): |
| | """Represents a single generated Key Issue.""" |
| | id: int = Field(..., description="Sequential ID for the key issue") |
| | title: str = Field(..., description="A concise title for the key issue") |
| | description: str = Field(..., description="Detailed description of the key issue") |
| | challenges: List[str] = Field(default_factory=list, description="Specific challenges associated with this issue") |
| | potential_impact: Optional[str] = Field(None, description="Potential impact if the issue is not addressed") |
| | |
| | |
| |
|
| |
|
| | |
| |
|
| | class GraphConfig(TypedDict): |
| | """Configuration passed to the graph execution.""" |
| | thread_id: str |
| | |
| |
|
| | class BaseState(TypedDict): |
| | """Base state common across potentially multiple graphs.""" |
| | messages: Annotated[List[BaseMessage], add_messages] |
| | error: Optional[str] |
| |
|
| | class PlannerState(BaseState): |
| | """State specific to the main planner graph.""" |
| | user_query: str |
| | plan: List[str] |
| | current_plan_step_index: int |
| | |
| | |
| | step_outputs: Dict[int, Any] |
| | |
| | key_issues: List[KeyIssue] |
| |
|
| |
|
| | class DataRetrievalState(TypedDict): |
| | """State for a potential data retrieval sub-graph.""" |
| | query_for_retrieval: str |
| | retrieved_docs: List[Dict[str, Any]] |
| | evaluated_docs: List[Dict[str, Any]] |
| | cypher_queries: List[str] |
| |
|
| | class ProcessingState(TypedDict): |
| | """State for a potential document processing sub-graph.""" |
| | docs_to_process: List[Dict[str, Any]] |
| | processed_docs: List[Union[str, Dict[str, Any]]] |
| | processing_steps_config: List[Union[str, dict]] |