mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[PR #13745] [CLOSED] feat: add API-based reranker support for RAG #38907
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/13745
Author: @jescalada
Created: 5/10/2025
Status: ❌ Closed
Base:
dev← Head:add-remote-reranker📝 Commits (4)
a3bb7dfMerge pull request #13530 from open-webui/devfa88849feat: extend RerankCompressor for remote rerank API configbada2c0feat: add rerank_remote function to handle reranker API callsc10b0affix: reranker scores.tolist error📊 Changes
1 file changed (+106 additions, -13 deletions)
View changed files
📝
backend/open_webui/retrieval/utils.py(+106 -13)📄 Description
Fixes #8478.
I did manual testing for a few flows, however no unit tests:
-> Uses regular hybrid search instead
-> Uses regular hybrid search instead
Let me know if more thorough testing is needed! I'm happy to write unit tests if I can get some pointers on how to test the RAG flow.
Thank you!
Pull Request Checklist
devbranch.Changelog Entry
Description
This PR adds remote reranking capabilities to the RAG system. It is activated by providing
REMOTE_RERANKER_URL,REMOTE_RERANKER_KEYandREMOTE_RERANKER_MODELenvironment variables, and setting the query mode to "hybrid" on the UI settingsSettings > Documents > Retrieval > Hybrid Search.Added
remote_rerankerfunction for handling calls to a remote reranking APIChanged
RerankCompressorto handle multiple scenarios more cleanly (API reranking, local reranking via reranking and embedding functions)Deprecated
None
Removed
None
Fixed
None
Security
None
Breaking Changes
None
Additional Information
This is a highly-requested feature: #8478
I implemented this by using some of the suggested code in the issue and then simplifying and refactoring to get a working flow. Let me know if anything requires further refactoring or testing! 😃
Screenshots or Videos
Remote reranker in action (Jina)
Local hybrid reranker
This is the default flow when the API config envs are missing or the API request failed (same as before):
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.