fix(core): preserve thought_signature on TextContent in Gemini streaming path (#9461)
get_content() was only setting signature on ReasoningContent items. When Gemini returns a function call with thought_signature but no ReasoningContent (e.g. include_thoughts=False), the signature was stored on self.thinking_signature but never attached to TextContent. This caused "missing thought_signature in functionCall parts" errors when the message was echoed back to Gemini on the next turn. 🐾 Generated with [Letta Code](https://letta.com) Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
@@ -97,9 +97,11 @@ class SimpleGeminiStreamingInterface:
|
||||
|
||||
def get_content(self) -> List[ReasoningContent | TextContent | ToolCallContent]:
|
||||
"""This is (unusually) in chunked format, instead of merged"""
|
||||
has_reasoning = any(isinstance(c, ReasoningContent) for c in self.content_parts)
|
||||
for content in self.content_parts:
|
||||
if isinstance(content, ReasoningContent):
|
||||
# This assumes there is only one signature per turn
|
||||
content.signature = self.thinking_signature
|
||||
elif isinstance(content, TextContent) and not has_reasoning and self.thinking_signature:
|
||||
content.signature = self.thinking_signature
|
||||
return self.content_parts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user