Skip to content

fix(vector-stores): pass custom Weaviate filters#5019

Open
haosenwang1018 wants to merge 1 commit intomem0ai:mainfrom
haosenwang1018:fix/weaviate-custom-metadata-filters
Open

fix(vector-stores): pass custom Weaviate filters#5019
haosenwang1018 wants to merge 1 commit intomem0ai:mainfrom
haosenwang1018:fix/weaviate-custom-metadata-filters

Conversation

@haosenwang1018
Copy link
Copy Markdown

What changed

  • Stop hardcoding Weaviate filters to only user_id, agent_id, and run_id.
  • Reuse one filter builder for search(), keyword_search(), and list().
  • Preserve valid falsy metadata filter values like 0 while still skipping None.
  • Add a regression test that custom metadata keys are included in the Weaviate filter.

Fixes #4053.

Note: #4848 was closed in favor of #4853, but #4853 fixed same-key metadata filter merging in Memory; it does not change the Weaviate vector store whitelist that still drops custom metadata keys.

Testing

  • uv run --with pytest --with pytest-mock --with ruff --with weaviate-client --with python-dotenv python -m pytest tests/vector_stores/test_weaviate.py -q
  • uv run --with ruff ruff check mem0/vector_stores/weaviate.py tests/vector_stores/test_weaviate.py
  • uv run --with ruff ruff format --check mem0/vector_stores/weaviate.py tests/vector_stores/test_weaviate.py

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.

Enhanced Metadata Filtering Not Working when using Weaviate as Vector DB

1 participant