Skip to content

Conversation

mayankbohra
Copy link

Summary

Implements vector store configuration properties to address issue #3447, making vector_store configs as accessible as LLM and Embedder configs.

Changes Made

  • Property Accessors: Added direct access to common config fields
    • collection_name, embedding_model_dims, api_key
    • host, port, url, path for connection parameters
  • Migration Support: Added methods for UI integration
    • get_migration_config() for database migration operations
    • rebuild_config() for rebuilding vector databases
  • API Integration: Added to_dict() for serialization to API responses
  • Development Fix: Handle missing package metadata during development

Implementation Details

✅ Enhanced VectorStoreConfig class with property accessors
✅ Added helper methods for migration and rebuild operations
✅ Fixed package import issue in __init__.py
✅ Added comprehensive test suite with 9 test cases
✅ All tests passing (8 passed, 1 skipped)
✅ All linting checks pass with ruff
✅ Pre-commit hooks installed and working
✅ No regression - existing tests continue to pass

Code Example

Before: Nested config access

config = VectorStoreConfig(provider="qdrant", config={"collection_name": "test"})
# Had to access: config.config.collection_name

After: Direct property access

config = VectorStoreConfig(provider="qdrant", config={"collection_name": "test"})
print(config.collection_name)  # Direct access: "test"
print(config.api_key)          # None if not set
print(config.to_dict())        # Serializable dict for API

Testing

pytest tests/configs/test_vector_store_config.py -v
# Result: 8 passed, 1 skipped, 1 warning

Files Changed

  • mem0/vector_stores/configs.py - Enhanced VectorStoreConfig class
  • mem0/__init__.py - Fixed package import for development
  • tests/configs/test_vector_store_config.py - Comprehensive test suite

Closes #3447

- Add property accessors to VectorStoreConfig for common fields:
  - collection_name, embedding_model_dims, api_key
  - host, port, url, path for connection parameters
- Add helper methods for UI integration:
  - to_dict() for serialization to API responses
  - get_migration_config() for database migration operations
  - rebuild_config() for rebuilding vector databases
- Fix package import issue in __init__.py for development
- Add comprehensive test suite with 9 test cases
- All tests passing, linting clean, pre-commit hooks installed

Closes mem0ai#3447
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

Fix/Feature: Openmemory UI missing vector store config and other configs

3 participants