Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -799,30 +799,30 @@ Your goal: Provide the EXACT answer in the EXACT format requested.
|
|
| 799 |
|
| 800 |
return {"messages": [ai_message], "turn": current_turn}
|
| 801 |
|
| 802 |
-
|
| 803 |
-
|
| 804 |
-
|
| 805 |
-
|
| 806 |
-
|
| 807 |
-
|
| 808 |
-
|
| 809 |
-
|
| 810 |
-
|
| 811 |
-
|
| 812 |
-
|
| 813 |
-
|
| 814 |
-
|
| 815 |
-
|
| 816 |
-
|
| 817 |
-
|
| 818 |
-
|
| 819 |
-
|
| 820 |
-
|
| 821 |
-
|
| 822 |
-
|
| 823 |
-
|
| 824 |
-
|
| 825 |
-
|
| 826 |
def __call__(self, question: str) -> str:
|
| 827 |
print(f"\n--- Starting Agent Run for Question ---")
|
| 828 |
print(f"Agent received question (first 100 chars): {question[:100]}...")
|
|
|
|
| 799 |
|
| 800 |
return {"messages": [ai_message], "turn": current_turn}
|
| 801 |
|
| 802 |
+
# --- Tool Node ---
|
| 803 |
+
tool_node = ToolNode(self.tools)
|
| 804 |
+
|
| 805 |
+
# --- Build Graph ---
|
| 806 |
+
print("Building agent graph...")
|
| 807 |
+
graph_builder = StateGraph(AgentState)
|
| 808 |
+
graph_builder.add_node("agent", agent_node)
|
| 809 |
+
graph_builder.add_node("tools", tool_node)
|
| 810 |
+
|
| 811 |
+
graph_builder.add_edge(START, "agent")
|
| 812 |
+
graph_builder.add_edge("tools", "agent")
|
| 813 |
+
|
| 814 |
+
graph_builder.add_conditional_edges(
|
| 815 |
+
"agent",
|
| 816 |
+
should_continue,
|
| 817 |
+
{
|
| 818 |
+
"tools": "tools",
|
| 819 |
+
"agent": "agent",
|
| 820 |
+
END: END
|
| 821 |
+
}
|
| 822 |
+
)
|
| 823 |
+
|
| 824 |
+
self.graph = graph_builder.compile()
|
| 825 |
+
print("✅ Graph compiled successfully")
|
| 826 |
def __call__(self, question: str) -> str:
|
| 827 |
print(f"\n--- Starting Agent Run for Question ---")
|
| 828 |
print(f"Agent received question (first 100 chars): {question[:100]}...")
|