fix(qdrant): respect falsy run() overrides in retrievers - #4007
Open
joshinitin2016883-sketch wants to merge 1 commit into
Open
joshinitin2016883-sketch wants to merge 1 commit into
joshinitin2016883-sketch wants to merge 1 commit into
Conversation
The Qdrant retrievers resolved scale_score, return_embedding and score_threshold with `or`, so run(scale_score=False), run(return_embedding=False) and run(score_threshold=0.0) were silently replaced by the init values. Fall back to the init value only when the argument is None, as QdrantHybridRetriever already does for rrf_k. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
joshinitin2016883-sketch
requested review from
bogdankostic
and removed request for
a team
September 25, 2026 17:00
Contributor
bogdankostic
left a comment
Contributor
There was a problem hiding this comment.
Thanks @joshinitin2016883-sketch! Looks already good in general, just left one suggestion on making the code more readable.
Comment on lines
+191
to
+193
| scale_score=self._scale_score if scale_score is None else scale_score, | ||
| return_embedding=self._return_embedding if return_embedding is None else return_embedding, | ||
| score_threshold=self._score_threshold if score_threshold is None else score_threshold, |
Contributor
There was a problem hiding this comment.
Let's put the runtime value first, not only here but thoughout the file.
Suggested change
| scale_score=self._scale_score if scale_score is None else scale_score, | |
| return_embedding=self._return_embedding if return_embedding is None else return_embedding, | |
| score_threshold=self._score_threshold if score_threshold is None else score_threshold, | |
| scale_score=scale_score if scale_score is not None else self._scale_score, | |
| return_embedding=return_embedding if return_embedding is not None else self._return_embedding, | |
| score_threshold=score_threshold if score_threshold is not None else self._score_threshold, |
This branch has not been deployed
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.
Related Issues
SentenceTransformersSimilarityRanker), fixed the same way as fix:FastEmbedderreordered the top_k fallback to happen after validation #3745–fix: NvidiaRanker reordered the top_k fallback to happen after validation #3749.Proposed Changes:
QdrantEmbeddingRetriever,QdrantSparseEmbeddingRetrieverandQdrantHybridRetrieverresolve theirrun()/run_async()overrides withor:orfalls back on any falsy value, so valid overrides are replaced by the init values:This change falls back to the init value only when the argument is
None, which is howQdrantHybridRetrieveralready resolvesrrf_kandrrf_weightsin the same file.I left
top_k,group_byandgroup_sizeunchanged: none of them has a meaningful falsy value.How did you test it?
test_run_falsy_runtime_values_override_initandtest_run_async_falsy_runtime_values_override_initin each of the three retriever test files. All 6 fail before the change (assert True is False) and pass after.ruff check,ruff format --checkandmypy(using the integration's config) are clean.Hatch is blocked by Windows Application Control on my machine, so these ran from a venv with the integration installed in editable mode rather than through
hatch run.Notes for the reviewer
Checklist
🤖 Generated with Claude Code