From 0de6419a29d5c8c2234befd6eada28de7a0ae9d5 Mon Sep 17 00:00:00 2001 From: Samuel Date: Sat, 2 Nov 2024 13:50:14 +0000 Subject: [PATCH] fixhandle arguments in ollama --- backend/open_webui/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index fe47c42f8..6883d1d13 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -595,7 +595,11 @@ async def handle_nonstreaming_response(request: Request, response: Response, if not tool_call["function"]["arguments"]: tool_function_params = {} else: - tool_function_params = json.loads(tool_call["function"]["arguments"]) + if is_openai: + tool_function_params = json.loads(tool_call["function"]["arguments"]) + if is_ollama: + tool_function_params = tool_call["function"]["arguments"] + try: tool_output = await tools[tool_function_name]["callable"](**tool_function_params)