kenqia commited on
Commit
1fbdfbb
·
verified ·
1 Parent(s): 58a54f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -118,6 +118,7 @@ class BasicAgent:
118
  except Exception as e:
119
  print(f"Agent error: {e}", flush=True)
120
  return ""
 
121
  def assistant(self, state: AgentState):
122
  sys_msg = SystemMessage(content="""
123
  You are a precise question-answering agent.
@@ -260,6 +261,13 @@ class BasicAgent:
260
 
261
  return "final_process"
262
 
 
 
 
 
 
 
 
263
 
264
  def retry_with_feedback(self, state: AgentState):
265
  notes = state.get("verification_notes", "")
 
118
  except Exception as e:
119
  print(f"Agent error: {e}", flush=True)
120
  return ""
121
+
122
  def assistant(self, state: AgentState):
123
  sys_msg = SystemMessage(content="""
124
  You are a precise question-answering agent.
 
261
 
262
  return "final_process"
263
 
264
+ def route_after_assistant(self, state: AgentState):
265
+ last_message = state["messages"][-1]
266
+
267
+ if getattr(last_message, "tool_calls", None):
268
+ return "tools"
269
+
270
+ return "final_process"
271
 
272
  def retry_with_feedback(self, state: AgentState):
273
  notes = state.get("verification_notes", "")