m-bano commited on
Commit
428f18e
·
verified ·
1 Parent(s): 8c5c24b

Unwrap final_answer in Gradio_UI

Browse files

There is a bug in Gradio_UI.py: line 157 calls handle_agent_output_types(final_answer), but this function does not unwrap final_answer (which can contain an AgentText, an AgentImage, an AgentAudio or another object). Since this object is never unwrapped from final_answer, the checks in lines 159 - 173 all fail. This means whatever is inside final_answer just gets output as a string (instead of an image, audio file, etc.). This fix exposes the contents of final_answer and lets Gradio handle them appropriately.

Files changed (1) hide show
  1. Gradio_UI.py +1 -1
Gradio_UI.py CHANGED
@@ -154,7 +154,7 @@ def stream_to_gradio(
154
  yield message
155
 
156
  final_answer = step_log # Last log is the run's final_answer
157
- final_answer = handle_agent_output_types(final_answer)
158
 
159
  if isinstance(final_answer, AgentText):
160
  yield gr.ChatMessage(
 
154
  yield message
155
 
156
  final_answer = step_log # Last log is the run's final_answer
157
+ final_answer = handle_agent_output_types(final_answer.final_answer)
158
 
159
  if isinstance(final_answer, AgentText):
160
  yield gr.ChatMessage(