Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: rerank issue. (#5696)

Kevin Hudf9b7b2fe9d0
diff --git a/rag/llm/rerank_model.py b/rag/llm/rerank_model.py
index 1ea2faedff..89cf126754 100644
--- a/rag/llm/rerank_model.py
+++ b/rag/llm/rerank_model.py
@@ -15,6 +15,7 @@
#
import re
import threading
+from collections.abc import Iterable
from urllib.parse import urljoin
import requests
@@ -135,6 +136,8 @@ class DefaultRerank(Base):
else:
scores = self._model.compute_score(batch_pairs, max_length=max_length)
scores = sigmoid(np.array(scores)).tolist()
+ if not isinstance(scores, Iterable):
+ scores = [scores]
return scores
def similarity(self, query: str, texts: list):