From 01adfaa4be7cadd7adc190776ffe4cf640706d08 Mon Sep 17 00:00:00 2001 From: Sarah Wooders Date: Thu, 9 Nov 2023 14:49:23 -0800 Subject: [PATCH] Return empty list if archival memory search over empty local index (#402) --- memgpt/connectors/local.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/memgpt/connectors/local.py b/memgpt/connectors/local.py index 233856c8..72fd6c5b 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(