Repository navigation
fix: skip invalid numeric indices in LLMRanker responses - #13576
Merged
anakin87 merged 5 commits intoNov 6, 2026
Merged
Conversation
Contributor
|
@solitarybear is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
anakin87
approved these changes
Nov 6, 2026
anakin87
left a comment
Member
There was a problem hiding this comment.
Thank you!
I took the opportunity to simplify the code and restructure tests for this component
anakin87
enabled auto-merge (squash)
November 6, 2026 09:49
Contributor
Author
|
Thanks for the review and for taking the time to simplify the code and restructure the tests. Much appreciated! |
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
No existing issue identified. Independently reproduced on
mainat0de7bcdc0f0683b8a321197d635c5c39b6e804d0; the affected source is unchanged at the updated base63dcc3c4ee.Proposed Changes:
LLMRankerconverts model-response indices usingint(). Given{"documents": [{"index": 1.9}, {"index": 2}]}andtop_k=1, it therefore returns document 1 instead of skipping the invalid entry and returning document 2. Boolean indices can also select the wrong document, while1e400raises an uncaughtOverflowError, even withraise_on_failure=False.Skip boolean, fractional, and non-finite indices before conversion in the shared response parser. Preserve integer strings and integer-valued floats. If a nonempty ranking has no valid indices, use the existing fallback/error policy, including returning all fallback documents regardless of
top_k.Add regression tests for both execution paths and both failure policies, update the component documentation, and add a release note.
How did you test it?
git diff --checkpassed.The tests use
MockChatGeneratorand require no GPU, model download, or API key. I ran the checks locally with Python 3.12.3. Full-repository tests, repository-wide type checking, live-provider integration tests, and the documentation-site build were not run.Notes for the reviewer
This validates model-produced JSON in a parser that already skips unusable indices. It preserves existing valid input handling, including
"2"and2.0. The tests inject malformed responses deterministically; they do not measure their frequency with a live provider.AI tools were used to help draft and organize this contribution. I reviewed the final changes and ran the local checks; I remain responsible for their correctness.
Checklist
fix:prefix.