feat(rerank): add OpenAI-compatible rerank provider#785
Merged
qin-ctx merged 1 commit intovolcengine:mainfrom Mar 20, 2026
Merged
feat(rerank): add OpenAI-compatible rerank provider#785qin-ctx merged 1 commit intovolcengine:mainfrom
qin-ctx merged 1 commit intovolcengine:mainfrom
Conversation
8700c28 to
371ebec
Compare
- Add OpenAIRerankClient using standard flat request/response format
compatible with DashScope compatible-api and other OpenAI/Cohere-style
rerank APIs (no input/output wrappers)
- Fix silent data corruption: add index bounds-checking so out-of-bounds
or missing index returns None with a warning
- Add provider allow-list validation in RerankConfig ('vikingdb'|'openai')
- Remove unnecessary getattr() in RerankClient.from_config()
- Update ov.conf.example: keep vikingdb (doubao) as primary rerank config,
add rerank_openai_example section for DashScope qwen3-rerank
- Update docs (en/zh): add OpenAI-compatible provider example alongside
existing volcengine example in configuration guide and schema
- Add 24 tests covering success, edge cases, and factory dispatch
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
371ebec to
bd8b77c
Compare
ZaynJarvis
reviewed
Mar 20, 2026
| "model_version": "251028", | ||
| "threshold": 0.1 | ||
| }, | ||
| "rerank_openai_example": { |
Collaborator
There was a problem hiding this comment.
this example with "rerank_openai_example" key doesn't look right to me.
Contributor
Author
There was a problem hiding this comment.
This follows the existing convention in the file — embedding_ollama_example uses the same *_example key pattern. Happy to change it if there's a preferred alternative, but it seemed consistent with what's already there.
Collaborator
|
others seems ok as long as it's tested @qin-ctx |
qin-ctx
approved these changes
Mar 20, 2026
zeattacker
pushed a commit
to zeattacker/OpenViking
that referenced
this pull request
Mar 20, 2026
- Add OpenAIRerankClient using standard flat request/response format
compatible with DashScope compatible-api and other OpenAI/Cohere-style
rerank APIs (no input/output wrappers)
- Fix silent data corruption: add index bounds-checking so out-of-bounds
or missing index returns None with a warning
- Add provider allow-list validation in RerankConfig ('vikingdb'|'openai')
- Remove unnecessary getattr() in RerankClient.from_config()
- Update ov.conf.example: keep vikingdb (doubao) as primary rerank config,
add rerank_openai_example section for DashScope qwen3-rerank
- Update docs (en/zh): add OpenAI-compatible provider example alongside
existing volcengine example in configuration guide and schema
- Add 24 tests covering success, edge cases, and factory dispatch
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
OpenAIRerankClientusing the standard flat request/response format ({"query": ..., "documents": [...]}/{"results": [{index, relevance_score}]}) — compatible with DashScope'scompatible-apiendpoint and other OpenAI/Cohere-style rerank APIsindexfield returnsNonewith a warning instead of corrupting the scores arrayRerankConfig("vikingdb"or"openai") — unknown providers raiseValueErrorat config parse timegetattr()inRerankClient.from_config()sinceRerankConfig.provideralways has a defaultcompatible-api/v1/reranksendpointTest plan
pytest tests/misc/test_rerank_openai.py -v— 24 tests, all pass (success, out-of-order, empty docs, bad format, length mismatch, out-of-bounds index, missing index, HTTP error, request shape, config factory, provider validation)pytest tests/retrieve/test_hierarchical_retriever_rerank.py -v— 6 tests, all pass (backward compat)🤖 Generated with Claude Code