From 7bfa29fa815a8707f011377576c77daa74fa0db4 Mon Sep 17 00:00:00 2001 From: hopeless <99332743+pwnless@users.noreply.github.com> Date: Sat, 22 Feb 2025 12:13:14 +0800 Subject: [PATCH] Update payload.py Fixes ollama native tool calling because native tool calling content will be str '', and tool call processing will be completely ignored. --- backend/open_webui/utils/payload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/utils/payload.py b/backend/open_webui/utils/payload.py index 4c1bbad9a..869e70895 100644 --- a/backend/open_webui/utils/payload.py +++ b/backend/open_webui/utils/payload.py @@ -124,7 +124,7 @@ def convert_messages_openai_to_ollama(messages: list[dict]) -> list[dict]: tool_call_id = message.get("tool_call_id", None) # Check if the content is a string (just a simple message) - if isinstance(content, str): + if isinstance(content, str) and not tool_calls: # If the content is a string, it's pure text new_message["content"] = content