From 4987220d2ef068b8544c4f3161c728891284e1a6 Mon Sep 17 00:00:00 2001 From: ProseGuys <798770222@qq.com> Date: Tue, 26 Nov 2024 17:53:29 +0800 Subject: [PATCH] style: polish code --- api/core/rag/datasource/retrieval_service.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/api/core/rag/datasource/retrieval_service.py b/api/core/rag/datasource/retrieval_service.py index dbd8fb7cd76073..abf2a2a5bfc1ac 100644 --- a/api/core/rag/datasource/retrieval_service.py +++ b/api/core/rag/datasource/retrieval_service.py @@ -106,7 +106,6 @@ def retrieve( exception_message = ";\n".join(exceptions) raise Exception(exception_message) - if retrieval_method == RetrievalMethod.HYBRID_SEARCH.value: data_post_processor = DataPostProcessor( str(dataset.tenant_id), reranking_mode, reranking_model, weights, False @@ -115,7 +114,7 @@ def retrieve( query=query, documents=all_documents, score_threshold=score_threshold, - top_n=DifyConfig.RETRIEVAL_TOP_N if DifyConfig.RETRIEVAL_TOP_N else top_k + top_n=DifyConfig.RETRIEVAL_TOP_N or top_k ) return all_documents @@ -187,7 +186,7 @@ def embedding_search( query=query, documents=documents, score_threshold=score_threshold, - top_n=DifyConfig.RETRIEVAL_TOP_N if DifyConfig.RETRIEVAL_TOP_N else len(documents) + top_n=DifyConfig.RETRIEVAL_TOP_N or len(documents) ) ) else: @@ -232,7 +231,7 @@ def full_text_index_search( query=query, documents=documents, score_threshold=score_threshold, - top_n=DifyConfig.RETRIEVAL_TOP_N if DifyConfig.RETRIEVAL_TOP_N else len(documents) + top_n=DifyConfig.RETRIEVAL_TOP_N or len(documents) ) ) else: