-
Notifications
You must be signed in to change notification settings - Fork 46
Adds support for HYBRID_POLICY on KNN queries with filters #299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great -- only question -- are the hybrid policy and batches params only for KNN queries or vector range queries too? Can you also add the docstring for those similar to how you did for the epsilon param?
Did the same treatment for the VectorRangeQuery - added more tests and fix the docstrings. |
2c05e2b
to
7900a1e
Compare
…RangeQuery) with filters
7900a1e
to
8d63bc4
Compare
# 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>
# 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>
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:
Hybrid Policy Control for VectorQuery
hybrid_policy
parameter with optionsBATCHES
orADHOC_BF
batch_size
parameter for controlling batch size inBATCHES
modeEPSILON Support for VectorRangeQuery
epsilon
parameter to control range query boundariesTests:
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 neighborsADHOC_BF
: Computes scores for all vectors passing the filterEpsilon: For range queries, controls boundary expansion through
radius * (1 + epsilon)
, enabling deeper search at the expense of performance