| from dataclasses import Field | |
| from langgraph.pregel.main import Topic | |
| from typing_extensions import Annotated,Sequence,List,TypedDict | |
| from pydantic import BaseModel ,Field | |
| from langchain_core.messages import BaseMessage | |
| from langgraph.graph.message import add_messages | |
| from typing import Literal | |
| class AgentState(TypedDict): | |
| """ | |
| Represents the state of the agent. | |
| Attributes: | |
| messages (Annotated[Sequence[BaseMessage], add_messages]): The sequence of messages in the conversation. | |
| """ | |
| messages: Annotated[Sequence[BaseMessage], add_messages] | |
| search_results: List[str] | |
| search_content:str | |
| query: str | |
| class search_keys(BaseModel): | |
| query:str = Field(description='this is the query that the user want to search') | |
| Topic:Literal["general", "news", "finance"] = Field(description='this is the topic that the user want to search about') | |