From 0f12c4d14f1eef01a221c58c2506d8215b26293c Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 10 Feb 2025 12:18:49 -0800 Subject: [PATCH] fix: ollama tool calling Co-Authored-By: Simone <6941100+seniorsimo@users.noreply.github.com> --- backend/open_webui/utils/response.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/utils/response.py b/backend/open_webui/utils/response.py index b16805bf3..4917d3852 100644 --- a/backend/open_webui/utils/response.py +++ b/backend/open_webui/utils/response.py @@ -73,7 +73,9 @@ async def convert_streaming_response_ollama_to_openai(ollama_streaming_response) "type": "function", "function": { "name": tool_call.get("function", {}).get("name", ""), - "arguments": f"{tool_call.get('function', {}).get('arguments', {})}", + "arguments": json.dumps( + tool_call.get("function", {}).get("arguments", {}) + ), }, } openai_tool_calls.append(openai_tool_call)