Files
crewAI/lib/crewai/tests
Devin AI 808654c2f2 fix(valkey): post-filter metadata outside FT.SEARCH (#5794)
The memory_index FT schema only materializes embedding, scope,
categories, created_at, and importance. ValkeyStorage._vector_search
was emitting metadata_filter clauses as @{key}:{value} against that
index, but metadata keys are user-defined and not part of the schema,
so the FT.SEARCH server would either error out or silently return
results that the metadata predicate failed to narrow.

Move metadata_filter to a Python post-filter that runs after FT.SEARCH
parses results. Overfetch from KNN (limit * 10, capped at 1000) when
metadata_filter is supplied so the post-filter still returns the
caller-requested number of hits in the common case, then truncate to
limit. Scope/categories predicates remain pushed down into FT.SEARCH
because they are valid index fields.

Adds TestValkeyStorageMetadataPostFilter and
TestValkeyStorageMatchesMetadataFilter test classes; updates three
pre-existing tests that asserted the broken contract.

Closes #5794

Co-Authored-By: João <joao@crewai.com>
2026-05-13 17:39:45 +00:00
..
2025-10-20 14:10:19 -07:00
2025-12-04 16:53:19 -05:00
2026-05-12 12:39:12 -07:00
2025-10-20 14:10:19 -07:00
2026-02-13 21:34:37 -03:00
2025-10-20 14:10:19 -07:00
2025-12-01 18:56:56 -05:00
2025-10-20 14:10:19 -07:00
2025-10-20 14:10:19 -07:00