Skip to content

Commit

Permalink
feat: added /summarize command (#667)
Browse files Browse the repository at this point in the history
* added /summarize command

* patch and test
  • Loading branch information
cpacker authored Dec 21, 2023
1 parent c29b861 commit f8710a2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions memgpt/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f8710a2

Please sign in to comment.