From 04af30e3db9bf5e7a60ab55ade01dc8ddeba06f8 Mon Sep 17 00:00:00 2001 From: Cooper <42096311+FOkvj@users.noreply.github.com> Date: Mon, 20 May 2024 21:17:06 +0800 Subject: [PATCH] Fix CrossEncoderRanker (#1531) Co-authored-by: dong Co-authored-by: Zhancai Dong --- dbgpt/rag/retriever/rerank.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbgpt/rag/retriever/rerank.py b/dbgpt/rag/retriever/rerank.py index 2eca8b622..39485d835 100644 --- a/dbgpt/rag/retriever/rerank.py +++ b/dbgpt/rag/retriever/rerank.py @@ -239,6 +239,8 @@ class CrossEncoderRanker(Ranker): Returns: List[Chunk], reranked candidates """ + if len(candidates_with_scores) <= 1: + return candidates_with_scores contents = [candidate.content for candidate in candidates_with_scores] query_content_pairs = [ [