Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix(core): preserve thought_signature on TextContent in Gemini streaming path (#9461)

Kian Jones4126fdadeafe
diff --git a/letta/interfaces/gemini_streaming_interface.py b/letta/interfaces/gemini_streaming_interface.py
index 9656977cb..e7f45040b 100644
--- a/letta/interfaces/gemini_streaming_interface.py
+++ b/letta/interfaces/gemini_streaming_interface.py
@@ -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