Andy Lee commited on
Commit
a2d3b74
·
1 Parent(s): 5e47334

fix: the decisions sometimes are not followed

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -175,9 +175,12 @@ if start_button:
175
  response = bot.model.invoke(message)
176
  decision = bot._parse_agent_response(response)
177
 
178
- action = decision.get("action_details", {}).get(
179
- "action"
180
- )
 
 
 
181
  history[-1]["action"] = action
182
 
183
  # Show AI decision
 
175
  response = bot.model.invoke(message)
176
  decision = bot._parse_agent_response(response)
177
 
178
+ if decision is None:
179
+ raise ValueError(
180
+ f"Failed to parse AI response: {response.content}"
181
+ )
182
+
183
+ action = decision["action_details"]["action"]
184
  history[-1]["action"] = action
185
 
186
  # Show AI decision