mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 08:21:12 -05:00
[GH-ISSUE #21914] issue: Non-native tool calling broken. Else block misindented in process_chat_payload (middleware.py) #90353
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?
Originally created by @ege-gungordu on GitHub (Feb 27, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21914
Check Existing Issues
Installation Method
Git Clone
Open WebUI Version
v0.8.5
Ollama Version (if applicable)
No response
Operating System
Ubuntu 22.04
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
When tools are present and function calling is set to default (non-native), chat_completion_tools_handler should be called to process the tools.
Actual Behavior
chat_completion_tools_handler is never called when tools are present. The else block is paired with the outer if tools_dict: check instead of the inner if function_calling == "native" check, so it only executes when tools_dict is empty.
Steps to Reproduce
Logs & Screenshots
Not needed. clear indentation issue.
Additional Information
In backend/open_webui/utils/middleware.py, the else block for non-native tool calling is indented at the same level as if tools_dict:, making Python pair it with the outer check instead of the inner if function_calling == "native":
@Classic298 commented on GitHub (Feb 27, 2026):
The seventh duplicate. Check for existing issues first!
Fixed in dev