Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: Fix gemini streaming interface string growth [LET-6067] (#5975)
Matthew Zhou72e80395cc22
diff --git a/letta/interfaces/gemini_streaming_interface.py b/letta/interfaces/gemini_streaming_interface.pyindex 3b2ea4e36..c7245a8ed 100644--- a/letta/interfaces/gemini_streaming_interface.py+++ b/letta/interfaces/gemini_streaming_interface.py@@ -63,8 +63,9 @@ class SimpleGeminiStreamingInterface:# NOTE: signature only is included if tools are presentself.thinking_signature: str | None = None- # Regular text content too- self.text_content: str | None = None+ # Regular text content too (avoid O(n^2) by accumulating parts)+ self._text_parts: list[str] = []+ self.text_content: str | None = None # legacy; not used elsewhere# Premake IDs for database writesself.letta_message_id = Message.generate_id()@@ -221,7 +222,7 @@ class SimpleGeminiStreamingInterface:# Plain text content partelif part.text:content = part.text- self.text_content = content if self.text_content is None else self.text_content + content+ self._text_parts.append(content)if prev_message_type and prev_message_type != "assistant_message":message_index += 1yield AssistantMessage(