Skip to content

feat: add Ollama rerank model support#13177

Draft
timon0305 wants to merge 1 commit intoinfiniflow:mainfrom
timon0305:add-ollama-rerank-support
Draft

feat: add Ollama rerank model support#13177
timon0305 wants to merge 1 commit intoinfiniflow:mainfrom
timon0305:add-ollama-rerank-support

Conversation

@timon0305
Copy link

Summary

Adds rerank model support for the Ollama provider, enabling users to use Ollama-hosted reranking models (e.g., via llama.cpp's /v1/rerank endpoint or compatible servers).

Changes

  • rag/llm/rerank_model.py — Added OllamaRerank class implementing the Base rerank interface using Ollama's /v1/rerank HTTP endpoint. Supports optional API key authentication and follows the same pattern as XInferenceRerank and LocalAIRerank.
  • conf/llm_factories.json — Added TEXT RE-RANK to 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 explicit LLMFactory.Ollama entry to the optionsMap with rerank as a supported model type, rather than relying on the Default fallback.
  • docs/references/supported_models.mdx — Added rerank checkmark for Ollama in the supported models table.

How it works

The OllamaRerank class uses the /v1/rerank API 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 the results array containing index and relevance_score fields.

Closes #4406
Closes #3680

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Feb 22, 2026
@dosubot
Copy link

dosubot bot commented Feb 22, 2026

Related Documentation

Checked 0 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@dosubot dosubot bot added 🌈 python Pull requests that update Python code 💞 feature Feature request, pull request that fullfill a new feature. 🧰 typescript Pull requests that update Typescript code labels Feb 22, 2026
@timon0305 timon0305 marked this pull request as draft February 23, 2026 14:34
@KevinHuSh KevinHuSh added the wip label Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💞 feature Feature request, pull request that fullfill a new feature. 🌈 python Pull requests that update Python code size:M This PR changes 30-99 lines, ignoring generated files. 🧰 typescript Pull requests that update Typescript code wip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Add Rerank capability for Ollama [Bug]: Importing the ReRank model through ollama resulted in a keyerror 'ollama'

2 participants