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

I added commands to shape the conversation: #218

Merged
merged 3 commits into from
Nov 4, 2023

Conversation

oderwat
Copy link
Contributor

@oderwat oderwat commented Oct 31, 2023

/rethink <text> will change the internal dialog of the last assistant message.
/rewrite <text> will change the last answer of the assistant.

Both commands can be used to change how the conversation continues in some pretty drastic and powerful ways.

@cpacker
Copy link
Collaborator

cpacker commented Oct 31, 2023

@oderwat would you mind running black on your code to make it pass the formatting check so we can merge it more easily? https://github.com/cpacker/MemGPT#development

Alternatively if you add me as a contributor to your fork repository I can add this for you.

Thank you for another great PR btw!

EDIT: if you use VSCode, you can just install the Microsoft Black Formatter extension, then add this to your settings.json:

...
    "[python]": {
        "editor.defaultFormatter": "ms-python.black-formatter",
        "editor.formatOnSave": true
    },
    "black-formatter.args": ["-l", "140"],
...

Then go into the files that the github actions is saying are bad, and save them inside VSCode which will auto-format them to the black style so that the PR passes the check (in this case you would go to main.py and save to format):

image

@cpacker cpacker self-requested a review October 31, 2023 18:53
Copy link
Collaborator

@cpacker cpacker left a comment

Choose a reason for hiding this comment

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

Needs black reformatting (or add me as a collaborator to your fork @oderwat and I can patch it)

@oderwat
Copy link
Contributor Author

oderwat commented Oct 31, 2023

I use PyCharm Professional and just enabled the integrated Black formatter. I will go through the PRs and update them.

@oderwat
Copy link
Contributor Author

oderwat commented Oct 31, 2023

OK. This did not work well. I also think that the setup of Black may be different. Have to investigate.

@oderwat
Copy link
Contributor Author

oderwat commented Oct 31, 2023

OK. I guess it worked now. I also added @cpacker as collaborator, just in case.

@oderwat oderwat force-pushed the rethink_rewrite branch 6 times, most recently from 1cc3dc2 to 051610f Compare October 31, 2023 22:03
@oderwat
Copy link
Contributor Author

oderwat commented Oct 31, 2023

OK. I was in rebase hell because for some stupid reason I could not get upstream to my local origin. I hope that now everything is fine. There are two unrelated problems though: 1. Black reports an error in utils (but I did not change that) and main.py uses print_messages without importing it.

`/rethink <text>` will change the internal dialog of the last assistant message.
`/rewrite <text>` will change the last answer of the assistant.

Both commands can be used to change how the conversation continues in
some pretty drastic and powerfull ways.
@@ -482,6 +483,32 @@ async def run_agent_loop(memgpt_agent, first, no_verify=False, cfg=None, legacy=
memgpt_agent.messages.pop()
continue

elif user_input.lower() == "/rethink" or user_input.lower().startswith("/rethink "):
# TODO this needs to also modify the persistence manager
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just as an FYI @oderwat , your implementation here isn't also overwriting the persistence manager's history, so if the agent uses conversation_search to look into the past, they'll find the original unedited message.

However, it is a significant amount of work to get the persistence manager to also be in sync (since the persistence manager can have many implementations), so I think it's OK to have this issue and just leave a disclaimer, since the commands as-is are still quite useful.

@cpacker cpacker merged commit 3296af7 into letta-ai:main Nov 4, 2023
1 of 2 checks passed
@cpacker
Copy link
Collaborator

cpacker commented Nov 4, 2023

Thank you for your contribution!

mattzh72 pushed a commit that referenced this pull request Oct 9, 2024
* I added commands to shape the conversation:

`/rethink <text>` will change the internal dialog of the last assistant message.
`/rewrite <text>` will change the last answer of the assistant.

Both commands can be used to change how the conversation continues in
some pretty drastic and powerfull ways.

* remove magic numbers

* add disclaimer

---------

Co-authored-by: cpacker <[email protected]>
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.

2 participants