Skip to content

feat:Adds new Param in getChatMessages for better context handling #4273

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

whysosaket
Copy link
Contributor

This is a proposal to introduce a new parameter in the getChatMessages function that allows us to retrieve the latest user message, enabling more accurate memory retrieval. Currently, Mem0 Memory uses get_all to fetch all user memories, but this change would allow us to perform a semantic search, which is more efficient for handling context.

I'd like to understand if there's a better approach to achieve this, and whether it makes sense to apply the same logic to other components as well. Thanks!

Changelog

  • Enhanced getChatMessages Method: Introduced a new parameter currentMessages to allow for dynamic message retrieval based on the latest user input, improving the context handling during chat sessions.
  • Improved Message Handling: Updated logic to prepend messages from currentMessages to the chat history, ensuring that the latest user input is considered when fetching the memories.

@whysosaket
Copy link
Contributor Author

Hi @chungyau97,
Could you please review this and confirm that this method works or is there a better way to handle this use-case?

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