Spaces:
Runtime error
Runtime error
Download src/genai/analytics_chatbot/agent.py from subashdvorak/trygithubactions: direct link, hf CLI and curl.
- Browser
- Download file 693 Bytes
-
https://huggingface.co/spaces/subashdvorak/trygithubactions/resolve/main/src/genai/analytics_chatbot/agent.py
- Command line
-
hf download hf://spaces/subashdvorak/trygithubactions/src/genai/analytics_chatbot/agent.py
-
curl -L -o agent.py https://huggingface.co/spaces/subashdvorak/trygithubactions/resolve/main/src/genai/analytics_chatbot/agent.py
693 Bytes
| from langgraph.graph import StateGraph, START, END | |
| from langgraph.checkpoint.memory import MemorySaver | |
| from .utils.state import State | |
| from .utils.nodes import ChatbotNode, FetchDataNode | |
| class ChatbotAgent: | |
| def __init__(self): | |
| self.memory = MemorySaver() | |
| def chatbot_graph(self): | |
| graph_builder= StateGraph(State) | |
| graph_builder.add_node("chatbot", ChatbotNode().run) | |
| graph_builder.add_node("fetch_data", FetchDataNode().run) | |
| graph_builder.add_edge(START, "chatbot") | |
| graph_builder.add_edge("chatbot", 'fetch_data') | |
| graph_builder.add_edge("fetch_data", END) | |
| return graph_builder.compile(checkpointer=self.memory) |