mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-12 12:26:54 +08:00
check rerank document is not empty (#1740)
Co-authored-by: jyong <jyong@dify.ai>
This commit is contained in:
@@ -24,7 +24,10 @@ class CohereReranking(BaseReranking):
|
|||||||
|
|
||||||
super().__init__(model_provider, client, name)
|
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 = []
|
docs = []
|
||||||
doc_id = []
|
doc_id = []
|
||||||
unique_documents = []
|
unique_documents = []
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ class XinferenceReranking(BaseReranking):
|
|||||||
super().__init__(model_provider, client, name)
|
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 = []
|
docs = []
|
||||||
doc_id = []
|
doc_id = []
|
||||||
unique_documents = []
|
unique_documents = []
|
||||||
|
|||||||
Reference in New Issue
Block a user