mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 20:05:58 +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)
|
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 = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user