fix: respect falsy run() overrides in SentenceTransformersSimilarityRanker - #3855
Merged
bogdankostic merged 2 commits intoSep 23, 2026
Merged
Conversation
Contributor
|
Heads-up for maintainers This PR is from a fork and touches integrations whose integration tests require API keys. Affected integrations:
Please run the integration tests locally ( |
Contributor
Coverage report (sentence_transformers)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
bogdankostic
approved these changes
Sep 23, 2026
bogdankostic
left a comment
Contributor
There was a problem hiding this comment.
Looks good, thanks for the PR @keosung!
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
Proposed Changes:
run()resolved its overrides withor, which falls back on any falsy value, not justNone. Sorun(scale_score=False)never disabled scaling,run(score_threshold=0.0)was replaced by the init value, andrun(top_k=0)silently used the inittop_kinstead of raising the documented ValueError. This validatestop_kbefore the fallback and switches the three fallbacks toNonechecks, the same change #3745 and #3746 made for the fastembed rankers. Behavior now matches the run() docstring, which already says "If set, overrides the value set at initialization."How did you test it?
Added 3 regression tests, one per parameter. They fail on main and pass with the fix. Also verified with a real cross-encoder model that
run(scale_score=False)now returns raw logits instead of sigmoid-scaled scores, and that the unit and integration suites both pass (23 + 3 tests).Notes for the reviewer
Behavior change:
run(top_k=0)now raises instead of silently using the init value, same as the fastembed rankers fix.Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.