feat: add Ollama rerank model support#13177
Draft
timon0305 wants to merge 1 commit intoinfiniflow:mainfrom
Draft
feat: add Ollama rerank model support#13177timon0305 wants to merge 1 commit intoinfiniflow:mainfrom
timon0305 wants to merge 1 commit intoinfiniflow:mainfrom
Conversation
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
Adds rerank model support for the Ollama provider, enabling users to use Ollama-hosted reranking models (e.g., via llama.cpp's
/v1/rerankendpoint or compatible servers).Changes
rag/llm/rerank_model.py— AddedOllamaRerankclass implementing theBasererank interface using Ollama's/v1/rerankHTTP endpoint. Supports optional API key authentication and follows the same pattern asXInferenceRerankandLocalAIRerank.conf/llm_factories.json— AddedTEXT RE-RANKto the Ollama factory's tags so it appears as a rerank-capable provider in the UI.web/src/pages/user-setting/setting-model/modal/ollama-modal/index.tsx— Added explicitLLMFactory.Ollamaentry to theoptionsMapwithrerankas a supported model type, rather than relying on theDefaultfallback.docs/references/supported_models.mdx— Added rerank checkmark for Ollama in the supported models table.How it works
The
OllamaRerankclass uses the/v1/rerankAPI endpoint (compatible with llama.cpp server, Ollama community forks, and other OpenAI-compatible rerank servers). It sends a POST request with the query and documents, and parses theresultsarray containingindexandrelevance_scorefields.Closes #4406
Closes #3680