feat: rerank support extra headers#1359
Merged
qin-ctx merged 5 commits intovolcengine:mainfrom Apr 13, 2026
Merged
Conversation
Add support for extra_headers configuration in RerankConfig, following the same pattern as EmbeddingConfig and VLMConfig. This allows users to specify custom HTTP headers for OpenAI-compatible rerank providers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add extra_headers parameter to __init__ method - Add extra_headers to from_config classmethod - Default to empty dict when extra_headers is None - Add comprehensive unit tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
qin-ctx
approved these changes
Apr 13, 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.
Description
Add
extra_headersconfiguration support to the rerank functionality. This enables users to use rerank services through API gateways that require custom HTTP headers (e.g.,x-gw-apikeyfor authentication). The implementation follows the same pattern as the existingextra_headerssupport in embedding and VLM configurations.Related Issue
Fixes #1314
Type of Change
Changes Made
extra_headers: Optional[Dict[str, str]]field toRerankConfigOpenAIRerankClient.__init__to accept and storeextra_headersOpenAIRerankClient.from_configto extractextra_headersfrom configOpenAIRerankClient.rerank_batchto mergeextra_headersinto API request headersTesting
Checklist
Additional Notes
The implementation allows users to configure custom headers like:
{ "rerank": { "api_base": "https://gateway.com/v1/rerank", "api_key": "internal-key", "extra_headers": {"x-gw-apikey": "Bearer real-key"} } }