From b5909ffe978e1aa443d2d1ba26adae33d8e82d62 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sun, 30 Mar 2025 02:39:23 -0700 Subject: [PATCH] enh: tool args parse json fallback --- backend/open_webui/utils/middleware.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 40bca75ad..8c92dc3cd 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -1846,6 +1846,15 @@ async def process_chat_response( ) except Exception as e: log.debug(e) + # Fallback to JSON parsing + try: + tool_function_params = json.loads( + tool_call.get("function", {}).get("arguments", "{}") + ) + except Exception as e: + log.debug( + f"Error parsing tool call arguments: {tool_call.get('function', {}).get('arguments', '{}')}" + ) tool_result = None