mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[PR #18375] [CLOSED] fix: native tool calling message updates for sequential tool calls #47818
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/18375
Author: @jmleksan
Created: 10/16/2025
Status: ❌ Closed
Base:
dev← Head:fix/native-tool-calling-message-updates📝 Commits (3)
73dd626Native tool calling message updates9f16eedRefactor awaitable result handling in tools.py91d79e4Remove unnecessary blank lines in tools.py📊 Changes
2 files changed (+54 additions, -4 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+26 -4)📝
backend/open_webui/utils/tools.py(+28 -0)📄 Description
Pull Request Checklist
Before submitting, make sure you've checked the following:
devbranch. Not targeting thedevbranch may lead to immediate closure of the PR.Changelog Entry
Description
Description
Fixed native tool calling to support sequential tool calls with shared context
In native function calling mode, tools were unable to access conversation history from previous tool calls within the same conversation. This prevented workflows like:
This occurred because tool functions were created with frozen
__messages__parameters usingfunctools.partial, which captured only the initial conversation state. Subsequent tool calls in the same conversation continued using the stale frozen parameters instead of the updated message history.Solution: Modified the tool calling system to dynamically update context parameters (
__messages__,__files__) on each tool execution in native mode by storing a reference to the original unwrapped function and re-applying parameters with current state.Fixed
__messages__and__files__parameters to tools on each executionChanged
backend/open_webui/utils/tools.py:get_async_tool_function_and_apply_extra_params()to store references to original function and initial parametersget_tool_function_with_updated_params()helper function to re-call tools with updated contextbackend/open_webui/utils/middleware.py:form_data["messages"]Additional Information
__original_function__fall back to normal execution.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.