From ce7d86e0df1f14185f1e26e857b682d881c0c1ca Mon Sep 17 00:00:00 2001 From: finecwg <114256425+finecwg@users.noreply.github.com> Date: Mon, 1 Jul 2024 12:19:36 +0900 Subject: [PATCH] Update tool_usage.py (#828) fixed error for some cases with Pandas DataFrame: ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all(). --- src/crewai/tools/tool_usage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crewai/tools/tool_usage.py b/src/crewai/tools/tool_usage.py index ce773b80b..cb7757d84 100644 --- a/src/crewai/tools/tool_usage.py +++ b/src/crewai/tools/tool_usage.py @@ -98,7 +98,7 @@ class ToolUsage: tool_string: str, tool: BaseTool, calling: Union[ToolCalling, InstructorToolCalling], - ) -> None: # TODO: Fix this return type + ) -> str: # TODO: Fix this return type --> finecwg : I updated return type to str if self._check_tool_repeated_usage(calling=calling): # type: ignore # _check_tool_repeated_usage of "ToolUsage" does not return a value (it only ever returns None) try: result = self._i18n.errors("task_repeated_usage").format( @@ -123,7 +123,7 @@ class ToolUsage: tool=calling.tool_name, input=calling.arguments ) - if not result: + if result is None: #! finecwg: if not result --> if result is None try: if calling.tool_name in [ "Delegate work to coworker",