Skip to content

feat: rerank support extra headers#1359

Merged
qin-ctx merged 5 commits intovolcengine:mainfrom
caisirius:feat/rerank_support_extra_headers
Apr 13, 2026
Merged

feat: rerank support extra headers#1359
qin-ctx merged 5 commits intovolcengine:mainfrom
caisirius:feat/rerank_support_extra_headers

Conversation

@caisirius
Copy link
Copy Markdown
Contributor

Description

Add extra_headers configuration support to the rerank functionality. This enables users to use rerank services through API gateways that require custom HTTP headers (e.g., x-gw-apikey for authentication). The implementation follows the same pattern as the existing extra_headers support in embedding and VLM configurations.

Related Issue

Fixes #1314

Type of Change

  • New feature (non-breaking change that adds functionality)

Changes Made

  • Added extra_headers: Optional[Dict[str, str]] field to RerankConfig
  • Modified OpenAIRerankClient.__init__ to accept and store extra_headers
  • Updated OpenAIRerankClient.from_config to extract extra_headers from config
  • Modified OpenAIRerankClient.rerank_batch to merge extra_headers into API request headers
  • Added comprehensive test coverage (10 tests)

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
    • All 10 new tests pass (3 config tests + 7 client tests)
    • No regressions in existing rerank tests
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

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"}
  }
}

caisirius and others added 5 commits April 10, 2026 17:28
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>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

1314 - Fully compliant

Compliant requirements:

  • Added extra_headers field to RerankConfig
  • Modified OpenAIRerankClient to accept and merge extra headers
  • Updated from_config to extract extra headers from config
  • Added comprehensive test coverage
  • Updated both English and Chinese documentation
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🏅 Score: 95
🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@qin-ctx qin-ctx merged commit 37e106a into volcengine:main Apr 13, 2026
1 of 2 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Apr 13, 2026
@caisirius caisirius deleted the feat/rerank_support_extra_headers branch April 15, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Feature]: rerank 配置支持 extra_headers

3 participants