Browse Source

fix: ollama tool calling

Co-Authored-By: Simone <6941100+seniorsimo@users.noreply.github.com>
Timothy Jaeryang Baek 2 months ago
parent
commit
0f12c4d14f
1 changed files with 3 additions and 1 deletions
  1. 3 1
      backend/open_webui/utils/response.py

+ 3 - 1
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)