mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #22895] [CLOSED] fix: support TEI reranker format in ExternalReranker with auto-detection #42548
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/22895
Author: @daudo
Created: 3/20/2026
Status: ❌ Closed
Base:
dev← Head:fix/external-reranker-tei-format📝 Commits (1)
0f9be21fix: support TEI reranker format in ExternalReranker with auto-detection📊 Changes
1 file changed (+86 additions, -11 deletions)
View changed files
📝
backend/open_webui/retrieval/models/external.py(+86 -11)📄 Description
Pull Request Checklist
devghcr.io/huggingface/text-embeddings-inference:120-1.9.1). Confirmed format auto-detection, reranking scores returned correctly, thread-safe under 10 parallel rerank calls. Also verified Cohere/Jina format path is unchanged (probe succeeds on first try, cached).devfix:Changelog Entry
Description
ExternalRerankeronly supports the Cohere/Jina rerank API format ("documents"key,{"results": [{"relevance_score": ...}]}response). HuggingFace Text Embeddings Inference (TEI) uses a different format ("texts"key, flat array response with"score"key), causing a silent 422 error that falls back to unreranked results. Users with TEI rerankers configured get no reranking despite the setting being enabled.Additionally,ChromaClient.search()silently swallows all exceptions (except: return None), making it impossible to diagnose vector search failures.Added
"score"key)Changed
ExternalReranker.predict()now auto-detects and caches the API format instead of assuming Cohere/Jina_parse_response()static method, handles both Cohere/Jina and TEI formats_build_payload()methodDeprecated
Removed
Fixed
-ChromaClient.search()now logs exceptions instead of silently returningNoneSecurity
Breaking Changes
Additional Information
/rerankendpoint expects{"query": "...", "texts": [...], "truncate": true}and returns[{"index": 0, "score": 0.5}, ...]. Open WebUI sends{"model": "...", "query": "...", "documents": [...], "top_n": N}and expects{"results": [{"index": 0, "relevance_score": 0.5}]}. The 422 from TEI was caught by the generic exception handler inpredict(), silently falling back to unreranked results.ExternalRerankerre-instantiation (which happens on config updates via the admin UI). Athreading.Lockprevents concurrent probe requests when hybrid search dispatches parallel rerank calls.- The ChromaDB logging change is included because the silentexcept: return Noneinsearch()made it very difficult to diagnose a vector search failure encountered during testing of the reranker integration.This is related to my other PR https://github.com/open-webui/open-webui/pull/22892, which enables reranking for query_knowledge_files, which in turn is my use case.
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.