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
This commit is contained in:
Classic298 2026-09-29 13:12:33 +02:00
parent 176d31d1db
commit 05b46934da

View file

@ -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()