From 32803c89a393406926658d8a52f7f7195df46712 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 9 May 2025 22:52:17 +0100 Subject: [PATCH] fix: truncate tool call results to 50 characters for cleaner output --- application/agents/classic_agent.py | 4 ++++ application/agents/react_agent.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/application/agents/classic_agent.py b/application/agents/classic_agent.py index b96a77fc..b371123b 100644 --- a/application/agents/classic_agent.py +++ b/application/agents/classic_agent.py @@ -57,4 +57,8 @@ class ClassicAgent(BaseAgent): ) yield {"sources": retrieved_data} + # clean tool_call_data only send first 50 characters of tool_call['result'] + for tool_call in self.tool_calls: + if len(str(tool_call["result"])) > 50: + tool_call["result"] = str(tool_call["result"])[:50] + "..." yield {"tool_calls": self.tool_calls.copy()} diff --git a/application/agents/react_agent.py b/application/agents/react_agent.py index a5d47850..5fce00b3 100644 --- a/application/agents/react_agent.py +++ b/application/agents/react_agent.py @@ -87,6 +87,10 @@ class ReActAgent(BaseAgent): ) yield {"sources": retrieved_data} + # clean tool_call_data only send first 50 characters of tool_call['result'] + for tool_call in self.tool_calls: + if len(str(tool_call["result"])) > 50: + tool_call["result"] = str(tool_call["result"])[:50] + "..." yield {"tool_calls": self.tool_calls.copy()} final_answer = self._create_final_answer(query, self.observations, log_context)