mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 19:59:03 +08:00
check rerank document is not empty (#1740)
Co-authored-by: jyong <jyong@dify.ai>
This commit is contained in:
parent
994fceece3
commit
d5695b3170
@ -24,7 +24,10 @@ class CohereReranking(BaseReranking):
|
||||
|
||||
super().__init__(model_provider, client, name)
|
||||
|
||||
def rerank(self, query: str, documents: List[Document], score_threshold: Optional[float], top_k: Optional[int]) -> Optional[List[Document]]:
|
||||
def rerank(self, query: str, documents: List[Document], score_threshold: Optional[float], top_k: Optional[int]) -> \
|
||||
Optional[List[Document]]:
|
||||
if not documents:
|
||||
return []
|
||||
docs = []
|
||||
doc_id = []
|
||||
unique_documents = []
|
||||
|
@ -21,6 +21,8 @@ class XinferenceReranking(BaseReranking):
|
||||
super().__init__(model_provider, client, name)
|
||||
|
||||
def rerank(self, query: str, documents: List[Document], score_threshold: Optional[float], top_k: Optional[int]) -> Optional[List[Document]]:
|
||||
if not documents:
|
||||
return []
|
||||
docs = []
|
||||
doc_id = []
|
||||
unique_documents = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user