Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: empty compaction prompt catch (#9836)
amysguanbb7c50625c8c
diff --git a/letta/services/summarizer/compact.py b/letta/services/summarizer/compact.pyindex b87d18bb1..68c721b8f 100644--- a/letta/services/summarizer/compact.py+++ b/letta/services/summarizer/compact.py@@ -163,6 +163,8 @@ async def compact_messages()summarization_mode_used = summarizer_config.mode+ if summarizer_config.prompt is None:+ summarizer_config.prompt = get_default_prompt_for_mode(summarizer_config.mode)if summarizer_config.mode == "self_compact_all":try:summary, compacted_messages = await self_summarize_all(diff --git a/letta/services/summarizer/summarizer.py b/letta/services/summarizer/summarizer.pyindex 4408e628b..77150014d 100644--- a/letta/services/summarizer/summarizer.py+++ b/letta/services/summarizer/summarizer.py@@ -17,7 +17,6 @@ from letta.helpers.message_helper import convert_message_creates_to_messagesfrom letta.llm_api.llm_client import LLMClientfrom letta.log import get_loggerfrom letta.otel.tracing import trace_method-from letta.prompts import gpt_summarizefrom letta.schemas.enums import AgentType, LLMCallType, MessageRole, ProviderTypefrom letta.schemas.letta_message_content import ImageContent, TextContentfrom letta.schemas.llm_config import LLMConfig@@ -466,6 +465,7 @@ async def simple_summary(Intentionally kept functional due to the simplicity of the prompt."""+ from letta.prompts.summarizer_prompt import ALL_PROMPTfrom letta.services.telemetry_manager import TelemetryManager# Create an LLMClient from the config@@ -491,7 +491,7 @@ async def simple_summary()# Prepare the messages payload to send to the LLM- system_prompt = prompt or gpt_summarize.SYSTEM+ system_prompt = prompt or ALL_PROMPT# Build the initial transcript without clamping to preserve fidelity# TODO proactively clip here?summary_transcript = simple_formatter(messages)