jcleee commited on
Commit
3731b9f
·
verified ·
1 Parent(s): bba9171

Update Gradio_UI.py

Browse files
Files changed (1) hide show
  1. Gradio_UI.py +6 -0
Gradio_UI.py CHANGED
@@ -155,6 +155,12 @@ def stream_to_gradio(
155
 
156
  final_step = step_log # this is the final ActionStep
157
  final_output = getattr(final_step, "tool_output", None)
 
 
 
 
 
 
158
  final_output = handle_agent_output_types(final_output)
159
 
160
  if isinstance(final_output, AgentText):
 
155
 
156
  final_step = step_log # this is the final ActionStep
157
  final_output = getattr(final_step, "tool_output", None)
158
+
159
+ # ✅ Fallback if tool_output is None and a final_answer tool was called
160
+ if final_output is None and hasattr(final_step, "tool_calls") and final_step.tool_calls:
161
+ if final_step.tool_calls[0].name == "final_answer":
162
+ final_output = final_step.tool_calls[0].arguments.get("answer", None)
163
+
164
  final_output = handle_agent_output_types(final_output)
165
 
166
  if isinstance(final_output, AgentText):