fix: append 0.0 score when top_logprobs is empty in OpenAIRerankerClient#1289
Open
devmao wants to merge 2 commits intogetzep:mainfrom
Open
fix: append 0.0 score when top_logprobs is empty in OpenAIRerankerClient#1289devmao wants to merge 2 commits intogetzep:mainfrom
devmao wants to merge 2 commits intogetzep:mainfrom
Conversation
When the API returns an empty top_logprobs list for a response, the loop was skipping the iteration with 'continue' without appending a score. This caused a length mismatch between the scores list and the number of responses, producing incorrect reranking results. Fix: append 0.0 (lowest confidence) when top_logprobs is empty, keeping the scores list aligned with the responses list.
Member
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
danielchalef
added a commit
that referenced
this pull request
Mar 2, 2026
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.
Summary
When the OpenAI API returns an empty
top_logprobslist for a response, the reranking loop skipped the iteration withcontinuewithout appending a score. This caused a length mismatch between thescoreslist and the number of responses —zip(..., strict=True)would raise, or scores would be assigned to the wrong passages.Fix: append
0.0(lowest confidence) beforecontinueso the scores list stays aligned with the responses list.Type of Change
Testing
Breaking Changes
Checklist
make lintpasses)Related Issues
N/A