Skip to content

Commit

Permalink
fix: LocalArchivalMemory prints ref_doc_info on if not using EmptyIndex
Browse files Browse the repository at this point in the history
Currently, if you run the /memory command the application breaks if the LocalArchivalMemory
has no existing archival storage and defaults to the EmptyIndex. This is caused by EmptyIndex
not having a ref_doc_info implementation and throwing an Exception when that is used to print
the memory information to the console. This hot fix simply makes sure that we do not try to
use the function if using EmptyIndex and instead prints a message to the console indicating
an EmptyIndex is used.
  • Loading branch information
goetzrobin committed Nov 2, 2023
1 parent 51726ac commit bc2ba98
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions memgpt/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,5 +736,8 @@ async def a_search(self, query_string, count=None, start=None):
return self.search(query_string, count, start)

def __repr__(self) -> str:
print(self.index.ref_doc_info)
return ""
if isinstance(self.index, EmptyIndex):
memory_str = "<empty>"
else:
memory_str = self.index.ref_doc_info
return f"\n### ARCHIVAL MEMORY ###" + f"\n{memory_str}"

0 comments on commit bc2ba98

Please sign in to comment.