mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #19862] [CLOSED] fix: preserve parameters through tool calling loops #40997
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/19862
Author: @Haervwe
Created: 12/10/2025
Status: ❌ Closed
Base:
dev← Head:fix/tool-calling-parameter-persistence📝 Commits (7)
fe6783cMerge pull request #19030 from open-webui/devfc05e0aMerge pull request #19405 from open-webui/deve3faec6Merge pull request #19416 from open-webui/dev9899293Merge pull request #19448 from open-webui/dev140605eMerge pull request #19462 from open-webui/dev6f1486fMerge pull request #19466 from open-webui/devdf1786ffix: preserve parameters through tool calling loops📊 Changes
1 file changed (+7 additions, -4 deletions)
View changed files
📝
backend/open_webui/utils/payload.py(+7 -4)📄 Description
Pull Request Checklist
Before submitting, make sure you've checked the following:
devbranch. ✅ Branch is based onupstream/devbody["options"]["think"] = Falseand verified parameter persists through tool call loopsfix:prefixDescription
Fixes parameter reset issue during native tool calls where filter-set or UI-set parameters (like Ollama's
think) were being lost after tool execution, causing inconsistent behavior in hybrid models during tool calling loops.Problem
When parameters are set via filters or frontend settings, they get reset after native tool calls. The
convert_payload_openai_to_ollama()function was:This caused hybrid models to ignore configured parameters during tool execution, leading to inconsistent thinking behavior.
Solution
Modified
convert_payload_openai_to_ollama()inbackend/open_webui/utils/payload.py:Preserve all fields during conversion:
This maintains root-level parameters like
thinkacross multiple conversions.Fix options dict mutation:
Creates proper copy to avoid mutating the original payload.
Fix incorrect deletion target:
Deletes from the correct dictionary.
Testing Performed
body["options"]["think"] = FalseImpact
Changelog Entry
Description
Fixed parameter preservation in Ollama payload conversion function to ensure filter-set and UI-set parameters persist through native tool calling loops, resolving inconsistent behavior where parameters like
thinkwere being reset after tool execution.Added
Changed
convert_payload_openai_to_ollama()now preserves all fields by copying entire payload instead of creating empty dictopenai_payloadtoollama_payloadformax_tokensDeprecated
Removed
Fixed
convert_payload_openai_to_ollama()losing root-level parameters likethinkduring multiple conversionsmax_tokensSecurity
Breaking Changes
Additional Information
Root Cause Analysis:
The conversion function was creating a new empty dictionary (
ollama_payload = {}) and only copying specific known fields. During tool calling loops, this function is called multiple times:thinkparameter moves from options to root levelthinkAdditionally, using
ollama_options = openai_payload["options"]created a reference, causing mutations to affect the original payload.Files Modified:
backend/open_webui/utils/payload.py(7 insertions, 4 deletions)Related Context:
think,keep_alive,formatScreenshots or Videos
BEFORE:
AFTER:
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
`
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.