mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 12:25:20 +00:00
fix: external reranker
This commit is contained in:
parent
32b27749ef
commit
6b5f99bf66
1 changed files with 3 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue