fix: propagate Xinference rerank failures instead of returning empty results - #10051
Open
he-yufeng wants to merge 1 commit into
Open
fix: propagate Xinference rerank failures instead of returning empty results#10051he-yufeng wants to merge 1 commit into
he-yufeng wants to merge 1 commit into
Conversation
…results The Xinference rerank provider swallowed upstream failures and an uninitialized model by returning an empty list, which the retrieval manager read as a legitimate empty rerank and used to overwrite the fused candidates with nothing. Other providers (e.g. TEI) raise, and the manager only preserves the fused results on that path, so a transient Xinference outage silently degraded every knowledge-base query to zero hits. Raise instead, matching the provider contract and letting the manager's degradation keep the unreranked results. Fixes AstrBotDevs#10000
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.
What this PR does
The Xinference rerank provider no longer swallows failures as an empty list. An upstream rerank error or an uninitialized model now raises, matching the contract the other rerank providers already follow (TEI raises on network and HTTP errors) and the behavior the retrieval manager is built around.
Why
Fixes #10000. The retrieval manager preserves the fused candidates only when reranking raises (
exceptaround_rerankkeeps the unreranked results with a warning). Because the Xinference provider returned[]on failure instead, the manager treated the outage as a legitimate empty rerank and overwrote the fused candidates with nothing, so a transient upstream failure silently turned every knowledge-base query into zero matches until it recovered.How it's tested
New regression file
tests/test_xinference_rerank_source.pypins both failure paths: an exception from the upstream model call propagates instead of returning[], and an uninitialized model raises instead of returning[]. Verified red-first (both fail against current master), then green with the change. Full rerank source suite (test_bailian+test_vllm+test_xinference) passes 23/23, and the knowledge-base/retrieval tests pass 15/15.ruff formatandruff checkare clean.Summary by Sourcery
Preserve retrieval results when Xinference reranking fails by allowing errors to reach the retrieval fallback path.
Bug Fixes:
Tests: