mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 14:39:31 -05:00
[PR #24827] [CLOSED] fix: handle decoded Ollama tool call arguments #131542
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/24827
Author: @pragnyanramtha
Created: 5/17/2026
Status: ❌ Closed
Base:
dev← Head:codex/ollama-tool-call-arguments-v2📝 Commits (2)
106f919Handle decoded Ollama tool call arguments95704eftest: cover Ollama tools forwarding📊 Changes
2 files changed (+107 additions, -2 deletions)
View changed files
➕
backend/open_webui/test/utils/test_payload.py(+97 -0)📝
backend/open_webui/utils/payload.py(+10 -2)📄 Description
Summary
toolsforwarded through the full OpenAI-to-Ollama payload conversion path, with regression coverage for the native tool-calling shape from #23907.Relates to #23907.
Why
Some OpenAI-compatible chat/tool flows can produce
function.argumentsas an object or omit it. The Ollama conversion path previously calledjson.loadsunconditionally, which raised before the request could be sent.The full payload regression also covers the native Ollama tool-calling boundary so a resolved
tools: [...]array remains present when Open WebUI converts an OpenAI-style chat payload for/api/chat.Changelog Entry
Description
toolsarray to Ollama payloads.Added
convert_messages_openai_to_ollama.convert_payload_openai_to_ollamapreserving native tool definitions.Changed
Deprecated
Removed
Fixed
json.loadsfrom raising when tool-call arguments are already a dictionary or are omitted.Security
Breaking Changes
Additional Information
Validation:
python3 -m py_compile backend/open_webui/utils/payload.py backend/open_webui/test/utils/test_payload.pygit diff --check upstream/dev...HEADTMPDIR=/tmp PYTHONPATH=$PWD/backend uv run --no-project --python 3.12 --with pytest --with python-mimeparse --with Markdown --with beautifulsoup4 --with cryptography --with-requirements backend/requirements-min.txt pytest backend/open_webui/test/utils/test_payload.py -q->4 passedTMPDIR=/tmp uv run --no-project --python 3.12 --with 'ruff>=0.15.5' ruff format --check backend/open_webui/utils/payload.py backend/open_webui/test/utils/test_payload.pyTMPDIR=/tmp uv run --no-project --python 3.12 --with 'ruff>=0.15.5' ruff check backend/open_webui/test/utils/test_payload.pyScreenshots or Videos
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.