Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: enum choices for list command argument (issue #732) (#746)
Jim Lloyd7ffb3c0149ec
diff --git a/memgpt/cli/cli_config.py b/memgpt/cli/cli_config.pyindex d17e70372..fc5025999 100644--- a/memgpt/cli/cli_config.py+++ b/memgpt/cli/cli_config.py@@ -4,6 +4,8 @@ from prettytable import PrettyTableimport typerimport osimport shutil+from typing import Annotated+from enum import Enum# from memgpt.cli import appfrom memgpt import utils@@ -475,9 +477,16 @@ def configure():config.save()+class ListChoice(str, Enum):+ agents = "agents"+ humans = "humans"+ personas = "personas"+ sources = "sources"++@app.command()-def list(option: str):- if option == "agents":+def list(arg: Annotated[ListChoice, typer.Argument]):+ if arg == ListChoice.agents:"""List all agents"""table = PrettyTable()table.field_names = ["Name", "Model", "Persona", "Human", "Data Source", "Create Time"]@@ -495,7 +504,7 @@ def list(option: str):])print(table)- elif option == "humans":+ elif arg == ListChoice.humans:"""List all humans"""table = PrettyTable()table.field_names = ["Name", "Text"]@@ -504,7 +513,7 @@ def list(option: str):name = os.path.basename(human_file).replace("txt", "")table.add_row([name, text])print(table)- elif option == "personas":+ elif arg == ListChoice.personas:"""List all personas"""table = PrettyTable()table.field_names = ["Name", "Text"]@@ -514,7 +523,7 @@ def list(option: str):name = os.path.basename(persona_file).replace(".txt", "")table.add_row([name, text])print(table)- elif option == "sources":+ elif arg == ListChoice.sources:"""List all data sources"""table = PrettyTable()table.field_names = ["Name", "Location", "Agents"]@@ -536,7 +545,7 @@ def list(option: str):table.add_row([data_source, location, agents])print(table)else:- raise ValueError(f"Unknown option {option}")+ raise ValueError(f"Unknown argument {arg}")@app.command()