Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -148,19 +148,19 @@ class AgentState(TypedDict):
|
|
| 148 |
messages: Annotated[list[AnyMessage], add_messages]
|
| 149 |
|
| 150 |
|
| 151 |
-
|
| 152 |
-
return {
|
| 153 |
-
"messages": chat.invoke(state["messages"]),
|
| 154 |
-
}
|
| 155 |
|
| 156 |
def build_agent(chat):
|
| 157 |
tools = [get_file_path_tool, get_content_tool, search_web_tool, extract_text_tool, play_chess_tool, run_code_tool]
|
| 158 |
chat_with_tools = chat.bind_tools(tools, parallel_tool_calls=False)
|
| 159 |
# The graph
|
| 160 |
builder = StateGraph(AgentState)
|
| 161 |
-
|
|
|
|
|
|
|
|
|
|
| 162 |
# Define nodes: these do the work
|
| 163 |
-
builder.add_node("assistant", assistant
|
| 164 |
builder.add_node("tools", ToolNode([get_file_path_tool]))
|
| 165 |
|
| 166 |
# Define edges: these determine how the control flow moves
|
|
|
|
| 148 |
messages: Annotated[list[AnyMessage], add_messages]
|
| 149 |
|
| 150 |
|
| 151 |
+
|
|
|
|
|
|
|
|
|
|
| 152 |
|
| 153 |
def build_agent(chat):
|
| 154 |
tools = [get_file_path_tool, get_content_tool, search_web_tool, extract_text_tool, play_chess_tool, run_code_tool]
|
| 155 |
chat_with_tools = chat.bind_tools(tools, parallel_tool_calls=False)
|
| 156 |
# The graph
|
| 157 |
builder = StateGraph(AgentState)
|
| 158 |
+
def assistant(state: AgentState):
|
| 159 |
+
return {
|
| 160 |
+
"messages": chat.invoke(state["messages"]),
|
| 161 |
+
}
|
| 162 |
# Define nodes: these do the work
|
| 163 |
+
builder.add_node("assistant", assistant)
|
| 164 |
builder.add_node("tools", ToolNode([get_file_path_tool]))
|
| 165 |
|
| 166 |
# Define edges: these determine how the control flow moves
|