Update agent.py
Browse files
agent.py
CHANGED
|
@@ -192,17 +192,16 @@ model_with_tools = model.bind_tools(tools)
|
|
| 192 |
|
| 193 |
def assistant(state: AgentState):
|
| 194 |
response = model_with_tools.invoke(state["messages"])
|
|
|
|
|
|
|
|
|
|
| 195 |
for message in response["messages"]:
|
| 196 |
if hasattr(message, "tool_calls") and message.tool_calls:
|
| 197 |
print("--- Agent tool call ---")
|
| 198 |
-
|
| 199 |
-
print(f"tool name: {call['name']}")
|
| 200 |
-
print(f"parameter: {call['args']}")
|
| 201 |
if message.type == "tool":
|
| 202 |
print(f"--- tool response ({message.name}) ---")
|
| 203 |
print(message.content[:200])
|
| 204 |
-
print(response.content[0].get("thinking"))
|
| 205 |
-
print("-" * 50)
|
| 206 |
return {
|
| 207 |
"messages": [response],
|
| 208 |
"file_path": state["file_path"],
|
|
|
|
| 192 |
|
| 193 |
def assistant(state: AgentState):
|
| 194 |
response = model_with_tools.invoke(state["messages"])
|
| 195 |
+
print("~" * 50)
|
| 196 |
+
print(response.content[0].get("thinking"))
|
| 197 |
+
print("~" * 50)
|
| 198 |
for message in response["messages"]:
|
| 199 |
if hasattr(message, "tool_calls") and message.tool_calls:
|
| 200 |
print("--- Agent tool call ---")
|
| 201 |
+
print(message.tool_calls)
|
|
|
|
|
|
|
| 202 |
if message.type == "tool":
|
| 203 |
print(f"--- tool response ({message.name}) ---")
|
| 204 |
print(message.content[:200])
|
|
|
|
|
|
|
| 205 |
return {
|
| 206 |
"messages": [response],
|
| 207 |
"file_path": state["file_path"],
|