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: improve summarization prompts (#8764)

Sarah Woodersef0f8e20d991
diff --git a/letta/prompts/summarizer_prompt.py b/letta/prompts/summarizer_prompt.py
index cb9d12d4a..62d6746f0 100644
--- a/letta/prompts/summarizer_prompt.py
+++ b/letta/prompts/summarizer_prompt.py
@@ -37,7 +37,7 @@ This summary will appear BEFORE the remaining recent messages in context, provid
1. **What happened**: The conversations, tasks, and exchanges that took place. What did the user ask for? What did you do? How did things progress?
-2. **Key outcomes**: Decisions made, tasks completed, files created (with paths), information gathered, problems solved, and any commitments made.
+2. **High level goals**: If there is an existing summary in the transcript, make sure to take it into consideration to continue tracking the higher level goals and long-term progress. Make sure to not lose track of higher level goals or the ongoing task.
3. **Important details**: Specific names, data, configurations, or facts that were discussed. Don't omit details that might be referenced later.
diff --git a/letta/services/summarizer/summarizer.py b/letta/services/summarizer/summarizer.py
index d8566a77c..78a97a917 100644
--- a/letta/services/summarizer/summarizer.py
+++ b/letta/services/summarizer/summarizer.py
@@ -328,7 +328,7 @@ def simple_formatter(
[message for message in messages if message.role != MessageRole.system or include_system],
tool_return_truncation_chars=tool_return_truncation_chars,
)
- return "\n".join(json.dumps(msg) for msg in parsed_messages)
+ return "<start_transcript>\n" + "\n".join(json.dumps(msg) for msg in parsed_messages) + "\n<end_transcript>\n. Generate the summary."
def middle_truncate_text(
@@ -607,6 +607,7 @@ async def simple_summary(
raise llm_client.handle_llm_error(fallback_error_b)
logger.info(f"Summarized {len(messages)}: {summary}")
+
return summary
diff --git a/letta/services/summarizer/summarizer_config.py b/letta/services/summarizer/summarizer_config.py
index 0a5f78786..540464fa4 100644
--- a/letta/services/summarizer/summarizer_config.py
+++ b/letta/services/summarizer/summarizer_config.py
@@ -33,7 +33,7 @@ class CompactionSettings(BaseModel):
default=False, description="Whether to include an acknowledgement post-prompt (helps prevent non-summary outputs)."
)
clip_chars: int | None = Field(
- default=2000, description="The maximum length of the summary in characters. If none, no clipping is performed."
+ default=50000, description="The maximum length of the summary in characters. If none, no clipping is performed."
)
mode: Literal["all", "sliding_window"] = Field(default="sliding_window", description="The type of summarization technique use.")