jcleee commited on
Commit
20d3915
·
verified ·
1 Parent(s): 6421802

Update Gradio_UI.py

Browse files
Files changed (1) hide show
  1. Gradio_UI.py +7 -4
Gradio_UI.py CHANGED
@@ -155,11 +155,14 @@ 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
 
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
 
 
155
 
156
  final_step = step_log # this is the final ActionStep
157
  final_output = getattr(final_step, "tool_output", None)
158
+
159
+ # If no tool_output, fallback to first final_answer call
160
+ if not final_output and final_step.tool_calls:
161
+ for call in final_step.tool_calls:
162
+ if call.name == "final_answer":
163
+ final_output = call.arguments.get("answer")
164
+ break
165
 
 
 
 
 
166
 
167
  final_output = handle_agent_output_types(final_output)
168