From 6c24ad796630c9a86f0075a66ede78be27d69c07 Mon Sep 17 00:00:00 2001 From: buua436 <66937541+buua436@users.noreply.github.com> Date: Fri, 19 Sep 2025 16:02:10 +0800 Subject: [PATCH] fix: correct rerank_model condition logic (#10174) ### What problem does this PR solve? fix the rerank_model condition logic by correcting the np.isclose check. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/llm/rerank_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rag/llm/rerank_model.py b/rag/llm/rerank_model.py index a69efa7eb..f4ca7fb01 100644 --- a/rag/llm/rerank_model.py +++ b/rag/llm/rerank_model.py @@ -365,7 +365,7 @@ class OpenAI_APIRerank(Base): max_rank = np.max(rank) # Avoid division by zero if all ranks are identical - if np.isclose(min_rank, max_rank, atol=1e-3): + if not np.isclose(min_rank, max_rank, atol=1e-3): rank = (rank - min_rank) / (max_rank - min_rank) else: rank = np.zeros_like(rank)