-
Notifications
You must be signed in to change notification settings - Fork 46
Commit ca709aa
Adds support for HYBRID_POLICY on KNN queries with filters (#299)
# Add support for hybrid policy and epsilon parameters in vector
searches
This PR adds support for configuring hybrid search policy for vector
searches and epsilon for vector range queries in RedisVL, matching the
capabilities available in Redis Vector Search.
## Changes
### Added features:
1. **Hybrid Policy Control for VectorQuery**
- Added `hybrid_policy` parameter with options `BATCHES` or `ADHOC_BF`
- Added `batch_size` parameter for controlling batch size in `BATCHES`
mode
- Implemented methods to get/set these parameters
2. **EPSILON Support for VectorRangeQuery**
- Added `epsilon` parameter to control range query boundaries
- Implemented methods to get/set this parameter
- Properly adds epsilon to query attributes, not as direct parameter
### Tests:
- Added unit tests for new parameters and methods
- Added integration tests that verify query construction but avoid
execution with unsupported parameters
## Description
Redis Vector Search allows fine-tuning of vector queries through hybrid
policy selection and epsilon configuration. This PR exposes these
parameters in RedisVL, giving users better control over performance and
accuracy trade-offs:
- **Hybrid Policy**: Controls how filters are applied during vector
search:
- `BATCHES`: Paginates through small batches of nearest neighbors
- `ADHOC_BF`: Computes scores for all vectors passing the filter
- **Epsilon**: For range queries, controls boundary expansion through
`radius * (1 + epsilon)`, enabling deeper search at the expense of
performance
---------
Co-authored-by: Tyler Hutcherson <tyler.hutcherson@redis.com>1 parent 0472408 commit ca709aaCopy full SHA for ca709aa
File tree
3 files changed
+671
-26
lines changedFilter options
- redisvl/query
- tests
- integration
- unit
3 files changed
+671
-26
lines changed
0 commit comments