fix(reranker): respect config.top_k in Cohere and ZeroEntropy fallback paths (#5560)

This commit is contained in:
Yash Singh
2026-06-15 16:10:00 +05:30
committed by GitHub
parent a8eeddde64
commit b90e3c0b76
3 changed files with 113 additions and 2 deletions
+2 -1
View File
@@ -82,4 +82,5 @@ class CohereReranker(BaseReranker):
# Fallback to original order if reranking fails
for doc in documents:
doc['rerank_score'] = 0.0
return documents[:top_k] if top_k else documents
final_top_k = top_k or self.config.top_k
return documents[:final_top_k] if final_top_k else documents
+2 -1
View File
@@ -93,4 +93,5 @@ class ZeroEntropyReranker(BaseReranker):
# Fallback to original order if reranking fails
for doc in documents:
doc['rerank_score'] = 0.0
return documents[:top_k] if top_k else documents
final_top_k = top_k or self.config.top_k
return documents[:final_top_k] if final_top_k else documents