feat(rerank): add litellm as rerank provider#888
Merged
qin-ctx merged 1 commit intovolcengine:mainfrom Mar 23, 2026
Merged
Conversation
Add LiteLLMRerankClient that wraps litellm.rerank() to support 20+ rerank providers (Cohere, Together AI, Jina, Azure) through a single configuration. Follows the pattern established by PR volcengine#853 (litellm embedding provider). Changes: - New rerank_litellm.py with LiteLLMRerankClient - RerankConfig updated to accept provider: "litellm" - RerankClient.from_config() routes to litellm when configured Relates to volcengine#874 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Failed to generate code suggestions for PR |
qin-ctx
approved these changes
Mar 23, 2026
Contributor
Author
|
Thanks for the review and merge, @qin-ctx! |
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.
Description
Add litellm as a third rerank provider, giving users access to 20+ rerank services (Cohere, Together AI, Jina, Azure AI) through a single
provider: "litellm"config. Follows the same pattern as PR #853 (litellm embedding provider).Related Issue
Relates to #874
Type of Change
Changes Made
LiteLLMRerankClientinopenviking_cli/utils/rerank_litellm.pywrappinglitellm.rerank()RerankConfigupdated to acceptprovider: "litellm"with validation (requiresmodelfield)RerankClient.from_config()routes litellm config to the new clientWhy this matters
#874 requests third-party rerank support. The current
openaiprovider covers OpenAI-compatible APIs, but many rerank services (Cohere, Jina) use different request/response formats. litellm normalizes these differences. PR #853 just added litellm for embeddings, so this extends the same pattern to rerank.Users with #578 also asked for extensible provider interfaces. litellm handles provider routing internally, so adding new rerank services requires zero code changes.
Usage
Verification
All 6 unit tests pass: client instantiation, empty docs, from_config routing, config validation (accepts with model, rejects without), factory wiring.
Testing
This contribution was developed with AI assistance (Claude Code).