Skip to content

Preserve Gemini thought signatures through streamed tool calls - #206

Draft
fanny-riols wants to merge 1 commit into
mainfrom
pr/gemini-audio-native
Draft

Preserve Gemini thought signatures through streamed tool calls#206
fanny-riols wants to merge 1 commit into
mainfrom
pr/gemini-audio-native

Conversation

@fanny-riols

Copy link
Copy Markdown
Collaborator

ALMGeminiClient hits Gemini's raw OpenAI-compatible endpoint directly, where multi-turn thought signatures ride under extra_content.google on each tool_call. litellm.stream_chunk_builder's tool-call merge (used by _assemble_stream_chunks when streaming the LLM response) only knows how to carry over id/type/function/provider_specific_fields, so it silently dropped extra_content when reassembling streamed chunks -- causing Gemini 3.x audio-native models to fail on the next turn with "Function call is missing a thought_signature".

Add _merge_streamed_tool_call_extras to alm_base.py: rebuilds tool_calls from the raw stream chunks, preserving any key litellm's merge doesn't recognize, and is a no-op when no such extra keys are present (e.g. for vLLM-hosted models). Also update system.py's thought-signature log check to recognize extra_content alongside CASCADE's provider_specific_fields.

ALMGeminiClient hits Gemini's raw OpenAI-compatible endpoint directly,
where multi-turn thought signatures ride under extra_content.google on
each tool_call. litellm.stream_chunk_builder's tool-call merge (used by
_assemble_stream_chunks for the streaming path) only knows how to carry
over id/type/function/provider_specific_fields, so it silently dropped
extra_content when reassembling streamed chunks -- causing Gemini 3.x
audio-native models to fail on the next turn with "Function call is
missing a thought_signature".

Add _merge_streamed_tool_call_extras to alm_base.py: rebuilds tool_calls
from the raw stream chunks, preserving any key litellm's merge doesn't
recognize, and is a no-op when no such extra keys are present (e.g. for
vLLM-hosted models). Also update system.py's thought-signature log check
to recognize extra_content alongside CASCADE's provider_specific_fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant