Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: patch /rewrite #1034

Merged
merged 7 commits into from
Feb 22, 2024
Merged

fix: patch /rewrite #1034

merged 7 commits into from
Feb 22, 2024

Conversation

cpacker
Copy link
Collaborator

@cpacker cpacker commented Feb 20, 2024

Please describe the purpose of this pull request.

  • /rewrite allows rewriting the message an agent sent
  • it's currently broken on main since it assumes function call format (not tool call format)
  • also, it was always "broken" in the sense that the rewrites did not persist (they were written to the agent buffer, but were not written out to the persistence manager state and would be erased on loads)
  • this PR rewrites the /rewrite command to instead modify the underlying Message DB object, so it will properly persist

How to test

Try /rewrite and see if (1) the message is rewritten in the buffer (is in /dump), and (2) that it persists on a load (/exit and reopen the agent, then /dump)

Have you tested this PR?

Yes, with the SQLite + Chroma backend:

  1. Call /rewrite on a fresh agent
image
  1. Confirm the rewrite worked, at least in the buffer
image
  1. Confirm the rewrite persists to the next session
image image

@@ -615,6 +615,15 @@ def run(
# create agent
try:
preset = ms.get_preset(preset_name=agent_state.preset, user_id=user.id)
if preset is None:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this I think the user will get an error until they run memgpt configure when going from 0.3.x -> 0.3.3

@@ -491,6 +491,24 @@ def insert(self, record: Record, exists_ok=True):
self.insert_many([record], exists_ok=exists_ok)


def update(self, record: RecordType):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is untested (though the unit test should theoretically check it?)

@cpacker cpacker merged commit e6c55ec into main Feb 22, 2024
4 checks passed
@cpacker cpacker deleted the patch-rewrite branch February 22, 2024 07:52
mattzh72 pushed a commit that referenced this pull request Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant