feat(vector-store): Add Valkey vector store support#3272
feat(vector-store): Add Valkey vector store support#3272parshvadaftari merged 15 commits intomem0ai:mainfrom
Conversation
Add support for Valkey, an open source (BSD) high-performance key/value datastore that supports vector search capabilities. Key features: - Full vector operations: insert, search, delete, update, get - Index management: create, list, delete, info, reset - HNSW and FLAT indexing algorithm support - Comprehensive filtering and search capabilities - Robust error handling and fallback mechanisms This implementation provides users with an additional high-performance vector store option for their Mem0 deployments. Includes: - ValkeyDB connector implementation - Configuration management - Comprehensive unit tests - Documentation and examples
madolson
left a comment
There was a problem hiding this comment.
Tried it out and worked. Just some suggestions based off my test.
…cation - Remove unnecessary query fallbacks - Add context-aware logging for index operations - Extract shared index schema builder to eliminate duplication - Simplify schema by removing redundant SEPARATOR clauses - Make index type validation explicit and defensive - Update tests for new idempotent behavior Reduces codebase by ~60 lines while improving maintainability.
|
any ETA on when this PR can be merged? |
|
@swarnaprakash @acarbonetto @meet-bhagdev Can you resolve merge conflicts? |
parshvadaftari
left a comment
There was a problem hiding this comment.
Please incorporate the requested changes inorder to get things started.
| {"name": "run_id", "type": "tag"}, | ||
| {"name": "user_id", "type": "tag"}, | ||
| {"name": "memory", "type": "tag"}, # Using TAG instead of TEXT for Valkey compatibility | ||
| {"name": "metadata", "type": "tag"}, # Using TAG instead of TEXT for Valkey compatibility |
There was a problem hiding this comment.
Why metadata is explicitly used here?
There was a problem hiding this comment.
This is needed so that metadata can be returned in the output without needing to issue an additional HGET query (i.e just relying on FT.SEARCH command output). If you have recommendation to index specific fields of metadata in addition let me know
tests/vector_stores/test_valkey.py
Outdated
| assert "@agent_id:{test_agent}" in query | ||
|
|
||
|
|
||
| def test_format_timestamp(valkey_db): |
There was a problem hiding this comment.
Why are we having this test explicitly?
There was a problem hiding this comment.
added it originally to get coverage in unit-test. removed it, assuming the test is too specific and mocked out to be useful
|
parshvadaftari@ - thank you for the comments. we will review and resolve the merge conflicts |
- Add _convert_bytes() method to recursively decode bytes from hgetall() - Fix get() method to return properly decoded string data - Implement list() method using dummy vector search approach - Update documentation to clarify filter behavior (no validation, wildcards allowed) - All three methods (search, get, list) now work correctly with proper string data
- Replace bare except with specific UnicodeDecodeError - Remove dead code after return statement - Format code with ruff
- Fix test_list to expect full search query with KNN part - Update test_list_with_missing_fields_and_defaults with valid mock data - Add missing vector_score attribute to mocks - All 43 tests now pass with 95% coverage
- Added Valkey support alongside new Databricks integration - Updated changelog to include Valkey in v0.1.117 release - Resolved dependency and factory conflicts
I have resolved all conflicts and incorporated all review comments (new outputdata format and fixes in get, get_all methods) |
|
@swarnaprakash Can you update the |
- Added Valkey to docs.json navigation structure - Added valkey dependency to Makefile install_all target
done @parshvadaftari |
parshvadaftari
left a comment
There was a problem hiding this comment.
Rest of the integration looks good. Do make the changes in the documentation for better consistency.
|
@swarnaprakash Thanks for the integration. Can you please incorporate the changes requested. Most of them revolve around docs for better readability and consistency. |
- Removed Valkey entries from changelog - Keep changelog clean for separate release planning
- Updated configuration example to use Memory.from_config() pattern - Added proper Python/TypeScript tabs with conversation examples - Replaced feature-focused content with parameter documentation - Follows same structure as Qdrant and Pinecone docs
parshvadaftari
left a comment
There was a problem hiding this comment.
Rest looks good to me.
- Remove TypeScript support (not available for Valkey) - Add link to valkey.io in introduction - Rename Configuration to Usage section for clarity
|
@parshvadaftari - thanks for the quick review. what's the next step here? |
|
Thanks a lot for the Valkey integration! |
|
@parshvadaftari Thanks for all the review feedback and accepting this PR! |
Description
Add support for Valkey vector store to mem0. Valkey is an open source (BSD) high-performance key/value datastore that supports vector search capabilities. This implementation provides users with an additional vector store option alongside existing options like Qdrant, Redis, and others.
This contribution adds:
Fixes # (no specific issue - new feature contribution)
Type of change
How Has This Been Tested?
tests/vector_stores/test_valkey.pyTest Configuration:
Testing Details:
make testsuccessfully on Python 3.9, 3.10, and 3.11Test Results:
Checklist:
Maintainer Checklist