"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "79c720c062605bd982d8ecae588f725bc1521a98"
Unverified Commit b46bd8b9 authored by Aymeric Roucher's avatar Aymeric Roucher Committed by GitHub
Browse files

Fix error when streaming to gradio with non-string tool arguments (#32360)

Fix error when streaming agent run to gradio with non-string tool arguments
parent ef177a5e
...@@ -34,7 +34,7 @@ def pull_message(step_log: dict): ...@@ -34,7 +34,7 @@ def pull_message(step_log: dict):
yield ChatMessage( yield ChatMessage(
role="assistant", role="assistant",
metadata={"title": f"🛠️ Used tool {step_log['tool_call']['tool_name']}"}, metadata={"title": f"🛠️ Used tool {step_log['tool_call']['tool_name']}"},
content=content, content=str(content),
) )
if step_log.get("observation"): if step_log.get("observation"):
yield ChatMessage(role="assistant", content=f"```\n{step_log['observation']}\n```") yield ChatMessage(role="assistant", content=f"```\n{step_log['observation']}\n```")
...@@ -72,4 +72,4 @@ def stream_to_gradio(agent: ReactAgent, task: str, **kwargs): ...@@ -72,4 +72,4 @@ def stream_to_gradio(agent: ReactAgent, task: str, **kwargs):
content={"path": step_log.to_string(), "mime_type": "audio/wav"}, content={"path": step_log.to_string(), "mime_type": "audio/wav"},
) )
else: else:
yield ChatMessage(role="assistant", content=step_log) yield ChatMessage(role="assistant", content=str(step_log))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment