Skip to content

Commit 2019b4a

Browse files
authored
feat: add topk for working mem (#476)
1 parent 9c6b1cc commit 2019b4a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/memos/memories/textual/tree_text_memory/retrieve/recall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def retrieve(
6666
working_memories = self.graph_store.get_all_memory_items(
6767
scope="WorkingMemory", include_embedding=False, user_name=user_name
6868
)
69-
return [TextualMemoryItem.from_dict(record) for record in working_memories]
69+
return [TextualMemoryItem.from_dict(record) for record in working_memories[:top_k]]
7070

7171
with ContextThreadPoolExecutor(max_workers=3) as executor:
7272
# Structured graph-based retrieval

src/memos/memories/textual/tree_text_memory/retrieve/searcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def post_retrieve(
108108
def search(
109109
self,
110110
query: str,
111-
top_k: int,
111+
top_k: int = 10,
112112
info=None,
113113
mode="fast",
114114
memory_type="All",

0 commit comments

Comments
 (0)