From 05b46934da1a8863948052e3cbf55aba6edc6097 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Tue, 29 Sep 2026 13:12:33 +0200 Subject: [PATCH] fix: prompt cache misses after a model calls tools one after another When a model called one tool, got its result and then called a second tool with no text in between, the next request merged both calls into an earlier assistant message that the provider had already seen. That changed the conversation's beginning, so the provider's prompt cache stopped matching from there for the rest of the chat. Each tool call and its result are now sent as their own messages, so the start of the conversation stays identical from one request to the next. Fixes #31588 --- backend/open_webui/utils/misc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/utils/misc.py b/backend/open_webui/utils/misc.py index 5c5dcce3a6..643d61dae3 100644 --- a/backend/open_webui/utils/misc.py +++ b/backend/open_webui/utils/misc.py @@ -479,7 +479,7 @@ def convert_output_to_messages( for item in output: item_type = item.get('type', '') - if item_type not in {'function_call', 'function_call_output'}: + if item_type != 'function_call_output': flush_tool_outputs() flush_tool_images()