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: memgpt agent ignores user messages #679

Merged

Conversation

javiersastre
Copy link
Contributor

@javiersastre javiersastre commented Dec 22, 2023

Please describe the purpose of this pull request.
Fix a bug

How to test
When running the original code, creating a user proxy and a single memgpt agent,

Have you tested this PR?
Debugged code before and after change. Used MemGPTAgent in an app that had an AutoGen UserProxy and a single MemGPTAgent (no groupchat). First message from user is just "hi", then second user message gets ignored and MemGPTAgent just returns the default reply.

Related issues or PRs
No related issues or PRs found.

Is your PR over 500 lines of code?
No, it is under 10 lines.

Additional context

  • In script memgpt/autogen/memgpt_agent.py, line 289, the new messages entered by the user are retrieved.
  • While MemGPTAgent is processing these messages, additional messages are appended to the list of new messages; however these additional messages are not stored in a way that the next time the new messages are retrieved, they will be taken into account.
  • In line 332, variable messages_processed_up_to_idx is the updated to a too high value due to these additional messages
  • In the next interaction round (when the user enters another message), MemGPTAgent tries to retrieve the list of new messages, but it gets an empty list of messages, skipping the new user message due to a too high value of variable messages_processed_up_to_idx. As there are no new messages to process, MemGPTAgent just returns the default reply.

Apart from the bug, pre-commit added some missing newlines at the end of some files, and I added directory test_chroma to .gitignore as this is being created by running the unit tests.

@javiersastre javiersastre changed the title Fix/memgpt agent ignores user messages fix/memgpt agent ignores user messages Dec 22, 2023
@javiersastre javiersastre changed the title fix/memgpt agent ignores user messages fix: memgpt agent ignores user messages Dec 22, 2023
@cpacker cpacker merged commit ccf7bf6 into letta-ai:main Dec 24, 2023
2 of 3 checks passed
sarahwooders pushed a commit that referenced this pull request Dec 26, 2023
* Fixed bug making MemGPT ignore some user messages

* Fixed bug making MemGPTAgent ignore some user messages

* Added pre-commit fixes
@javiersastre javiersastre deleted the fix/memgpt_agent_ignores_user_messages branch December 29, 2023 12:00
norton120 pushed a commit to norton120/MemGPT that referenced this pull request Feb 15, 2024
* Fixed bug making MemGPT ignore some user messages

* Fixed bug making MemGPTAgent ignore some user messages

* Added pre-commit fixes
mattzh72 pushed a commit that referenced this pull request Oct 9, 2024
* Fixed bug making MemGPT ignore some user messages

* Fixed bug making MemGPTAgent ignore some user messages

* Added pre-commit fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants