From 6b5f99bf666f004c9df55b07aa2763d319c43b10 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 10 May 2025 19:33:34 +0400 Subject: [PATCH] fix: external reranker --- backend/open_webui/retrieval/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/retrieval/utils.py b/backend/open_webui/retrieval/utils.py index b952080d3..2df6a0ab5 100644 --- a/backend/open_webui/retrieval/utils.py +++ b/backend/open_webui/retrieval/utils.py @@ -818,7 +818,9 @@ class RerankCompressor(BaseDocumentCompressor): ) scores = util.cos_sim(query_embedding, document_embedding)[0] - docs_with_scores = list(zip(documents, scores.tolist())) + docs_with_scores = list( + zip(documents, scores.tolist() if not isinstance(scores, list) else scores) + ) if self.r_score: docs_with_scores = [ (d, s) for d, s in docs_with_scores if s >= self.r_score