Skip to content

fix: case when reranker returns invalid scores array #6777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

uinstinct
Copy link
Contributor

@uinstinct uinstinct commented Jul 24, 2025

Description

The following error used to happen when the reranker model returned an invalid response.
Failed to rerank retrieval results TypeError: Cannot read properties of undefined (reading 'sort'). More about the RCA in the ticket.

  • add a zod validation schema for voyage ai response
  • check if scores array is valid in DocsContextProvider

resolves CON-2661

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screen recording or screenshot

[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]

Tests

[ What tests were added or updated to ensure the changes work as expected? ]


Summary by cubic

Fixed a crash when the reranker model returned an invalid scores array by adding response validation and handling invalid cases.

  • Bug Fixes
    • Added Zod schema validation for the Voyage AI reranker response.
    • Checked for a valid scores array before sorting in DocsContextProvider.

@uinstinct uinstinct requested a review from a team as a code owner July 24, 2025 13:44
@uinstinct uinstinct requested review from tingwai and removed request for a team July 24, 2025 13:44
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:S This PR changes 10-29 lines, ignoring generated files.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

1 participant