From c1fd8d6df1dca94cd347107d1c580f336d0073e0 Mon Sep 17 00:00:00 2001 From: Sarah Wooders Date: Fri, 3 Nov 2023 14:13:44 -0700 Subject: [PATCH] Make CLI agent flag errors more clear, and dont throw error if flags dont contradict existing agent config (#290) --- memgpt/cli/cli.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/memgpt/cli/cli.py b/memgpt/cli/cli.py index 7a2a2101..20dc1bdb 100644 --- a/memgpt/cli/cli.py +++ b/memgpt/cli/cli.py @@ -108,9 +108,12 @@ def run( printd("Index path:", agent_config.save_agent_index_dir()) # persistence_manager = LocalStateManager(agent_config).load() # TODO: implement load # TODO: load prior agent state - assert not any( - [persona, human, model] - ), f"Cannot override existing agent state with command line arguments: {persona}, {human}, {model}" + if persona and persona != agent_config.persona: + raise ValueError(f"Cannot override {agent_config.name} existing persona {agent_config.persona} with {persona}") + if human and human != agent_config.human: + raise ValueError(f"Cannot override {agent_config.name} existing human {agent_config.human} with {human}") + if model and model != agent_config.model: + raise ValueError(f"Cannot override {agent_config.name} existing model {agent_config.model} with {model}") # load existing agent memgpt_agent = AgentAsync.load_agent(memgpt.interface, agent_config)