-
Notifications
You must be signed in to change notification settings - Fork 892
Python: Update Mem0Provider to use v2 search API filters parameter
#2766
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
base: main
Are you sure you want to change the base?
Conversation
filters parameterfilters parameter
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the Mem0Provider to use the v2 search API's filters parameter instead of individual parameters. The change aligns with the mem0 library's updated API while maintaining backward compatibility for the add() method.
Key changes:
- Added
_build_filters()method to construct filters dict from initialization parameters - Updated
invoking()method to passfiltersdict tomem0_client.search() - Updated all test assertions to verify the new
filtersparameter structure
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| python/packages/mem0/agent_framework_mem0/_provider.py | Added _build_filters() helper method and updated invoking() to use filters dict for search API; added documentation note about filter initialization |
| python/packages/mem0/tests/test_mem0_context_provider.py | Updated test assertions to verify filters dict parameter instead of individual params; added new test class for _build_filters() method |
| python/samples/getting_started/context_providers/mem0/mem0_basic.py | Added 12-second delay with explanatory comments to handle Mem0's asynchronous memory indexing |
eavanvalkenburg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question, does this need a particular version of the mem0 dependency?
Motivation and Context
Updates
Mem0Providerto use thefiltersparameter as required by mem0 v2 search API._build_filters()method to constructfiltersdict from initialization parametersinvoking()to passfiltersdict tomem0_client.search()instead of individual parametersfiltersdict parameter instead of individual paramsmem0_basicsample to give time for memories to be indexedResolves #2621
Description
Contribution Checklist