Skip to content

Commit

Permalink
updated CLI interface to properly print searches on archival memory +…
Browse files Browse the repository at this point in the history
… recall memory (#731)
  • Loading branch information
cpacker authored Dec 28, 2023
1 parent 4fae3e9 commit 0a894c8
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions memgpt/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,11 @@ def printd_function_message(icon, msg, color=Fore.RED):
if match:
function_name = match.group(1)
function_args = match.group(2)
if "memory" in function_name:
print_function_message("🧠", f"updating memory with {function_name}")
if function_name in ["archival_memory_insert", "archival_memory_search"]:
if function_name == "archival_memory_insert":
print_function_message("🧠", f"updating memory with {function_name}")
elif function_name == "archival_memory_search":
print_function_message("🧠", f"searching memory with {function_name}")
try:
msg_dict = eval(function_args)
if function_name == "archival_memory_search":
Expand All @@ -186,6 +189,19 @@ def printd_function_message(icon, msg, color=Fore.RED):
printd(str(e))
printd(msg_dict)
pass
elif function_name in ["conversation_search", "conversation_search_date"]:
print_function_message("🧠", f"searching memory with {function_name}")
try:
msg_dict = eval(function_args)
output = f'\tquery: {msg_dict["query"]}, page: {msg_dict["page"]}'
if STRIP_UI:
print(output)
else:
print(f"{Fore.RED}{output}{Style.RESET_ALL}")
except Exception as e:
printd(str(e))
printd(msg_dict)
pass
else:
printd(f"{CLI_WARNING_PREFIX}did not recognize function message")
printd_function_message("", msg)
Expand Down

0 comments on commit 0a894c8

Please sign in to comment.