mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-10 13:29:35 +00:00
fix(rag): Fix rerank bug of EmbeddingRetriever (#1499)
Co-authored-by: dong <dongzhancai@iie2.com>
This commit is contained in:
@@ -120,7 +120,7 @@ class EmbeddingRetriever(BaseRetriever):
|
|||||||
new_candidates_with_score = cast(
|
new_candidates_with_score = cast(
|
||||||
List[Chunk], reduce(lambda x, y: x + y, candidates_with_score)
|
List[Chunk], reduce(lambda x, y: x + y, candidates_with_score)
|
||||||
)
|
)
|
||||||
new_candidates_with_score = self._rerank.rank(new_candidates_with_score)
|
new_candidates_with_score = self._rerank.rank(new_candidates_with_score, query)
|
||||||
return new_candidates_with_score
|
return new_candidates_with_score
|
||||||
|
|
||||||
async def _aretrieve(
|
async def _aretrieve(
|
||||||
@@ -207,7 +207,9 @@ class EmbeddingRetriever(BaseRetriever):
|
|||||||
"rerank_cls": self._rerank.__class__.__name__,
|
"rerank_cls": self._rerank.__class__.__name__,
|
||||||
},
|
},
|
||||||
):
|
):
|
||||||
new_candidates_with_score = self._rerank.rank(new_candidates_with_score)
|
new_candidates_with_score = self._rerank.rank(
|
||||||
|
new_candidates_with_score, query
|
||||||
|
)
|
||||||
return new_candidates_with_score
|
return new_candidates_with_score
|
||||||
|
|
||||||
async def _similarity_search(
|
async def _similarity_search(
|
||||||
|
Reference in New Issue
Block a user