Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

feat: added /summarize command (#667)

Charles Packerd366e91c7065
diff --git a/memgpt/main.py b/memgpt/main.py
index af2033b14..d456bf925 100644
--- a/memgpt/main.py
+++ b/memgpt/main.py
@@ -21,6 +21,7 @@ from memgpt.interface import CLIInterface as interface # for printing to termin
import memgpt.agent as agent
import memgpt.system as system
import memgpt.constants as constants
+import memgpt.errors as errors
from memgpt.cli.cli import run, attach, version, server, open_folder, quickstart
from memgpt.cli.cli_config import configure, list, add
from memgpt.cli.cli_load import app as load_app
@@ -205,6 +206,22 @@ def run_agent_loop(memgpt_agent, first, no_verify=False, cfg=None, strip_ui=Fals
break
continue
+ elif user_input.lower() == "/summarize":
+ try:
+ memgpt_agent.summarize_messages_inplace()
+ typer.secho(
+ f"/summarize succeeded",
+ fg=typer.colors.GREEN,
+ bold=True,
+ )
+ except errors.LLMError as e:
+ typer.secho(
+ f"/summarize failed:\n{e}",
+ fg=typer.colors.RED,
+ bold=True,
+ )
+ continue
+
# No skip options
elif user_input.lower() == "/wipe":
memgpt_agent = agent.Agent(interface)