mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
[GH-ISSUE #19121] issue: Duplicate instructions in tool selection calling prompt #34307
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 @matiboux on GitHub (Nov 11, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/19121
Check Existing Issues
Installation Method
Git Clone
Open WebUI Version
v0.6.36
Ollama Version (if applicable)
No response
Operating System
Ubuntu 24.04 LTS (WSL2)
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
When a tool is selected, the prompt sent to the model for tool selection and calling should be clean and not contain duplicate or unclear instructions.
Actual Behavior
When a tool is selected, the prompt sent to the model for tool selection contains duplicate and unclear instructions in the user message:
Primarily, the "Query:" instruction is duplicated in "Query: History:" and "Query:".
This is because of how the user message is formatted in the tool selection request:
Also, the query and last user message of the conversation is duplicated. The discussion is open as to whether this is a problem or not.
Steps to Reproduce
npm run devto start the frontend.sh dev.shfrom thebackend/directory to start the backend./chat/completionsendpoint to a real OpenAI-compatible API, and whose only other role is to print out:Note: Alternatively, you could add logs in the backend to print the request parameters, but using a custom API ensures backend code is untouched for this test.
Logs & Screenshots
Below is the actual output from the custom API proxy used during testing. This show the user message in the tool selection request.
Tool Selection Request:
Additional Information
Related code responsible for the "Query:" prefix duplication:
e0d5de1697/backend/open_webui/utils/middleware.py (L311-L321)Related code responsible for the last user message duplication:
e0d5de1697/backend/open_webui/utils/middleware.py (L303-L311)I will create a PR to attempt to resolve this issue.