[Feature Request] Add runtime filter support to MilvusEmbeddingRetriever - #68
Closed
kukjun wants to merge 1 commit into
Closed
[Feature Request] Add runtime filter support to MilvusEmbeddingRetriever#68kukjun wants to merge 1 commit into
kukjun wants to merge 1 commit into
Conversation
|
I hope this gets merged soon, its really useful and also relatively short for that :) |
Collaborator
|
/lgtm |
Collaborator
|
@kukjun |
Signed-off-by: Kukjun Lee <63409722+kukjun@users.noreply.github.com>
Contributor
Author
|
I’ve finished it! |
Merged
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

📝 Description
This PR adds runtime filter parameter support to all retriever classes (
MilvusEmbeddingRetriever,MilvusSparseEmbeddingRetriever, andMilvusHybridRetriever), enabling dynamic metadata filtering at query time.🎯 Motivation
Previously, filters could only be set during retriever initialization. This limitation prevented users from dynamically changing filter conditions at runtime, which is a common use case in production environments where filter criteria may vary per query.
🔧 Changes
Code Changes
MilvusEmbeddingRetriever.run(): Added optionalfiltersparameterMilvusSparseEmbeddingRetriever.run(): Added optionalfiltersparameterMilvusHybridRetriever.run(): Added optionalfiltersparameterAll retrievers now support both:
filtersparameter torun()method (new feature)Runtime filters take precedence over static filters when both are provided.
Test Coverage
Added comprehensive test coverage with
test_run_using_filters()for each retriever class:TestMilvusEmbeddingTests.test_run_using_filters(): Tests dense embedding retrieval with runtime filtersTestMilvusSparseEmbeddingTests.test_run_using_filters(): Tests sparse embedding retrieval with runtime filtersTestMilvusHybridTests.test_run_using_filters(): Tests hybrid retrieval with runtime filters📊 Example Usage