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.

feat: add ids to archival memory search [LET-6642] (#8355)

Ari Webb956e7783adc5
diff --git a/fern/openapi.json b/fern/openapi.json
index 193b4bd79..152275dcd 100644
--- a/fern/openapi.json
+++ b/fern/openapi.json
@@ -24532,6 +24532,11 @@
},
"ArchivalMemorySearchResult": {
"properties": {
+ "id": {
+ "type": "string",
+ "title": "Id",
+ "description": "Unique identifier of the archival memory passage"
+ },
"timestamp": {
"type": "string",
"title": "Timestamp",
@@ -24552,7 +24557,7 @@
}
},
"type": "object",
- "required": ["timestamp", "content"],
+ "required": ["id", "timestamp", "content"],
"title": "ArchivalMemorySearchResult"
},
"Archive": {
diff --git a/letta/functions/function_sets/base.py b/letta/functions/function_sets/base.py
index b5a614ce3..004fac5ad 100644
--- a/letta/functions/function_sets/base.py
+++ b/letta/functions/function_sets/base.py
@@ -217,7 +217,7 @@ async def archival_memory_search(
top_k: Maximum number of results to return (default: 10)
Returns:
- A list of relevant memories with timestamps and content, ranked by similarity.
+ A list of relevant memories with IDs, timestamps, and content, ranked by similarity.
Examples:
# Search for project discussions
diff --git a/letta/schemas/memory.py b/letta/schemas/memory.py
index fec5a9989..982a97aef 100644
--- a/letta/schemas/memory.py
+++ b/letta/schemas/memory.py
@@ -456,6 +456,7 @@ class CreateArchivalMemory(BaseModel):
class ArchivalMemorySearchResult(BaseModel):
+ id: str = Field(..., description="Unique identifier of the archival memory passage")
timestamp: str = Field(..., description="Timestamp of when the memory was created, formatted in agent's timezone")
content: str = Field(..., description="Text content of the archival memory passage")
tags: List[str] = Field(default_factory=list, description="List of tags associated with this memory")
diff --git a/letta/services/agent_manager.py b/letta/services/agent_manager.py
index 5ee15af93..2599e80dc 100644
--- a/letta/services/agent_manager.py
+++ b/letta/services/agent_manager.py
@@ -2461,7 +2461,7 @@ class AgentManager:
# Use ISO format if no timezone is set
formatted_timestamp = str(timestamp) if timestamp else "Unknown"
- result_dict = {"timestamp": formatted_timestamp, "content": passage.text, "tags": passage.tags or []}
+ result_dict = {"id": passage.id, "timestamp": formatted_timestamp, "content": passage.text, "tags": passage.tags or []}
# Add relevance metadata if available
if metadata: