From 4daa88fa59f22e77c5ba83b2c457c9ab0de9c9b0 Mon Sep 17 00:00:00 2001 From: Stefano Baccianella <4247706+mangiucugna@users.noreply.github.com> Date: Fri, 21 Mar 2025 19:25:19 +0100 Subject: [PATCH] As explained in https://github.com/mangiucugna/json_repair?tab=readme-ov-file#performance-considerations we can skip a wasteful json.loads() here and save quite some time (#2397) Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> Co-authored-by: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com> --- src/crewai/tools/tool_usage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crewai/tools/tool_usage.py b/src/crewai/tools/tool_usage.py index 25e4b126a..9c924027d 100644 --- a/src/crewai/tools/tool_usage.py +++ b/src/crewai/tools/tool_usage.py @@ -455,7 +455,7 @@ class ToolUsage: # Attempt 4: Repair JSON try: - repaired_input = repair_json(tool_input) + repaired_input = repair_json(tool_input, skip_json_loads=True) self._printer.print( content=f"Repaired JSON: {repaired_input}", color="blue" )