Skip to content

Commit 37d973d

Browse files
committed
Ignore self in search results
1 parent f66c07d commit 37d973d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

agent_memory_server/long_term_memory.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,9 @@ async def deduplicate_by_semantic_search(
10131013

10141014
vector_search_result = search_result.memories if search_result else []
10151015

1016+
# Filter out the memory itself from the search results (avoid self-duplication)
1017+
vector_search_result = [m for m in vector_search_result if m.id != memory.id]
1018+
10161019
if vector_search_result and len(vector_search_result) > 0:
10171020
# Found semantically similar memories
10181021
similar_memory_ids = [memory.id for memory in vector_search_result]
@@ -1079,8 +1082,6 @@ async def promote_working_memory_to_long_term(
10791082
logger.debug(f"No working memory found for session {session_id}")
10801083
return 0
10811084

1082-
print("Current working memory: ", current_working_memory)
1083-
10841085
# Find memories with no persisted_at (eligible for promotion)
10851086
unpersisted_memories = [
10861087
memory

0 commit comments

Comments
 (0)