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 a "/retry" command to retry for getting another answer. #188

Merged
merged 3 commits into from
Nov 4, 2023

Conversation

oderwat
Copy link
Contributor

@oderwat oderwat commented Oct 30, 2023

I added a "/retry" command to retry for getting another answer.

  • Implemented by popping messages until hitting the last user message. Then extracting the users last message and sending it again. This will also work with state files and after manually popping messages.
  • Updated the README

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.

this LGTM (see comment)

@vivi
Copy link
Contributor

vivi commented Oct 30, 2023

Could you also update README.md? Thank you!

memgpt/main.py Outdated Show resolved Hide resolved
@cpacker
Copy link
Collaborator

cpacker commented Oct 30, 2023

Also thanks for this PR, /retry seems will be a useful function to have

@oderwat
Copy link
Contributor Author

oderwat commented Oct 30, 2023

Well, I am not even a Python programmer (more the Go person) and I just skimmed over the implementation. I guess that checking that one pops up to and including the last user message is fine. I would need to figure out how to do that :)

@oderwat
Copy link
Contributor Author

oderwat commented Oct 30, 2023

I decided to check out how to make a better implementation for '/retry'. I think I got it. But need your review.

@oderwat
Copy link
Contributor Author

oderwat commented Oct 30, 2023

I would love to make something like "/retry Yes, " or "/retry No, " where the string is being added as the start of the assistant reply to further shape the results. But I am unsure if that is possible with the current design. I guess one would need to extend the function calls with something like "prepend" for the agent?

@oderwat oderwat force-pushed the retry-last-answer branch 2 times, most recently from 81d5fd2 to 77a5a51 Compare October 31, 2023 21:32
@oderwat
Copy link
Contributor Author

oderwat commented Oct 31, 2023

I updated the README and formatted the code. I hope this fits now.

@oderwat
Copy link
Contributor Author

oderwat commented Oct 31, 2023

I added the update for the pop <count> in the README and made the default to 3 instead of 2 (so it removes fun/assistant/user) which seems cleaner to me.

@oderwat oderwat force-pushed the retry-last-answer branch 2 times, most recently from 1e19b6b to 1e99942 Compare October 31, 2023 22:13
- Implemented to pop messages until hitting the last user message. Then
  extracting the users last message and sending it again. This will also
  work with state files and after manually popping messages.
- Updated the README to include /retry
- Update the README for "pop" with parameter and changed default to 3 as
  this will pop "function/assistant/user" which is the usual turn
  around.
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.

Same FYI as the other PR @oderwat , but just know that this will not modify the persistence manager, only the state inside the agent messages list.

Otherwise, LGTM

image

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

cpacker commented Nov 4, 2023

Thank you for the contribution! /retry, /rethink, and /rewrite are all really cool commands that I'm sure many others will find very useful, thank you for adding them and opening PRs to contribute back into the main repo.

mattzh72 pushed a commit that referenced this pull request Oct 9, 2024
* I added a "/retry" command to retry for getting another answer.

- Implemented to pop messages until hitting the last user message. Then
  extracting the users last message and sending it again. This will also
  work with state files and after manually popping messages.
- Updated the README to include /retry
- Update the README for "pop" with parameter and changed default to 3 as
  this will pop "function/assistant/user" which is the usual turn
  around.

* disclaimer

---------

Co-authored-by: Charles Packer <[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.

3 participants