Skip to content

fix: append 0.0 score when top_logprobs is empty in OpenAIRerankerClient#1289

Open
devmao wants to merge 2 commits intogetzep:mainfrom
devmao:fix/reranker-empty-logprobs
Open

fix: append 0.0 score when top_logprobs is empty in OpenAIRerankerClient#1289
devmao wants to merge 2 commits intogetzep:mainfrom
devmao:fix/reranker-empty-logprobs

Conversation

@devmao
Copy link

@devmao devmao commented Mar 2, 2026

Summary

When the OpenAI API returns an empty top_logprobs list for a response, the reranking loop skipped the iteration with continue without appending a score. This caused a length mismatch between the scores list 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) before continue so the scores list stays aligned with the responses list.

Type of Change

  • Bug fix
  • New feature
  • Performance improvement
  • Documentation/Tests

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • All existing tests pass

Breaking Changes

  • This PR contains breaking changes

Checklist

  • Code follows project style guidelines (make lint passes)
  • Self-review completed
  • Documentation updated where necessary
  • No secrets or sensitive information committed

Related Issues

N/A

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.
@danielchalef
Copy link
Member

danielchalef commented Mar 2, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@devmao devmao marked this pull request as ready for review March 2, 2026 21:21
@devmao
Copy link
Author

devmao commented Mar 2, 2026

I have read the CLA Document and I hereby sign the CLA

danielchalef added a commit that referenced this pull request Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants