Spaces:
Runtime error
Runtime error
Update agents/understanding.py
Browse files- agents/understanding.py +16 -1
agents/understanding.py
CHANGED
|
@@ -67,4 +67,19 @@ def understanding_agent(anthropic_client, state: Dict[str, Any]) -> Dict[str, An
|
|
| 67 |
# Parse the structured intent from the response
|
| 68 |
# This would be more sophisticated in production
|
| 69 |
new_state["user_intent"] = {
|
| 70 |
-
"understood":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
# Parse the structured intent from the response
|
| 68 |
# This would be more sophisticated in production
|
| 69 |
new_state["user_intent"] = {
|
| 70 |
+
"understood": True,
|
| 71 |
+
"description": agent_response.replace("INTENT_COMPLETE", "").strip(),
|
| 72 |
+
"time": time.time()
|
| 73 |
+
} # Added the missing closing brace here
|
| 74 |
+
new_state["current_agent"] = "planning_agent"
|
| 75 |
+
else:
|
| 76 |
+
# Need more information, stay with understanding agent
|
| 77 |
+
new_state["current_agent"] = "understanding_agent"
|
| 78 |
+
|
| 79 |
+
# Add agent's response to messages
|
| 80 |
+
new_messages = add_messages(state, [
|
| 81 |
+
{"role": "assistant", "content": agent_response.replace("INTENT_COMPLETE", "").strip()}
|
| 82 |
+
])
|
| 83 |
+
new_state["messages"] = new_messages
|
| 84 |
+
|
| 85 |
+
return new_state
|