Skip to content

Commit 4987220

Browse files
committed
style: polish code
1 parent c26ed3e commit 4987220

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

api/core/rag/datasource/retrieval_service.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ def retrieve(
106106
exception_message = ";\n".join(exceptions)
107107
raise Exception(exception_message)
108108

109-
110109
if retrieval_method == RetrievalMethod.HYBRID_SEARCH.value:
111110
data_post_processor = DataPostProcessor(
112111
str(dataset.tenant_id), reranking_mode, reranking_model, weights, False
@@ -115,7 +114,7 @@ def retrieve(
115114
query=query,
116115
documents=all_documents,
117116
score_threshold=score_threshold,
118-
top_n=DifyConfig.RETRIEVAL_TOP_N if DifyConfig.RETRIEVAL_TOP_N else top_k
117+
top_n=DifyConfig.RETRIEVAL_TOP_N or top_k
119118
)
120119

121120
return all_documents
@@ -187,7 +186,7 @@ def embedding_search(
187186
query=query,
188187
documents=documents,
189188
score_threshold=score_threshold,
190-
top_n=DifyConfig.RETRIEVAL_TOP_N if DifyConfig.RETRIEVAL_TOP_N else len(documents)
189+
top_n=DifyConfig.RETRIEVAL_TOP_N or len(documents)
191190
)
192191
)
193192
else:
@@ -232,7 +231,7 @@ def full_text_index_search(
232231
query=query,
233232
documents=documents,
234233
score_threshold=score_threshold,
235-
top_n=DifyConfig.RETRIEVAL_TOP_N if DifyConfig.RETRIEVAL_TOP_N else len(documents)
234+
top_n=DifyConfig.RETRIEVAL_TOP_N or len(documents)
236235
)
237236
)
238237
else:

0 commit comments

Comments
 (0)