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.

Return empty list if archival memory search over empty local index (#402)

Sarah Wooders01adfaa4be7c
diff --git a/memgpt/connectors/local.py b/memgpt/connectors/local.py
index 233856c8d..72fd6c5b4 100644
--- a/memgpt/connectors/local.py
+++ b/memgpt/connectors/local.py
@@ -111,6 +111,8 @@ class LocalStorageConnector(StorageConnector):
), f"expected {orig_size + len(passages)} nodes, got {len(self.get_nodes())} nodes"
def query(self, query: str, query_vec: List[float], top_k: int = 10) -> List[Passage]:
+ if isinstance(self.index, EmptyIndex): # empty index
+ return []
# TODO: this may be super slow?
# the nice thing about creating this here is that now we can save the persistent storage manager
retriever = VectorIndexRetriever(