@@ -106,16 +106,15 @@ def retrieve(
106
106
exception_message = ";\n " .join (exceptions )
107
107
raise Exception (exception_message )
108
108
109
-
110
109
if retrieval_method == RetrievalMethod .HYBRID_SEARCH .value :
111
110
data_post_processor = DataPostProcessor (
112
111
str (dataset .tenant_id ), reranking_mode , reranking_model , weights , False
113
112
)
114
113
all_documents = data_post_processor .invoke (
115
- query = query ,
116
- documents = all_documents ,
117
- score_threshold = score_threshold ,
118
- top_n = DifyConfig .RETRIEVAL_TOP_N if DifyConfig . RETRIEVAL_TOP_N else top_k
114
+ query = query ,
115
+ documents = all_documents ,
116
+ score_threshold = score_threshold ,
117
+ top_n = DifyConfig .RETRIEVAL_TOP_N or top_k ,
119
118
)
120
119
121
120
return all_documents
@@ -184,10 +183,10 @@ def embedding_search(
184
183
)
185
184
all_documents .extend (
186
185
data_post_processor .invoke (
187
- query = query ,
188
- documents = documents ,
189
- score_threshold = score_threshold ,
190
- top_n = DifyConfig .RETRIEVAL_TOP_N if DifyConfig . RETRIEVAL_TOP_N else len (documents )
186
+ query = query ,
187
+ documents = documents ,
188
+ score_threshold = score_threshold ,
189
+ top_n = DifyConfig .RETRIEVAL_TOP_N or len (documents ),
191
190
)
192
191
)
193
192
else :
@@ -229,10 +228,10 @@ def full_text_index_search(
229
228
)
230
229
all_documents .extend (
231
230
data_post_processor .invoke (
232
- query = query ,
233
- documents = documents ,
234
- score_threshold = score_threshold ,
235
- top_n = DifyConfig .RETRIEVAL_TOP_N if DifyConfig . RETRIEVAL_TOP_N else len (documents )
231
+ query = query ,
232
+ documents = documents ,
233
+ score_threshold = score_threshold ,
234
+ top_n = DifyConfig .RETRIEVAL_TOP_N or len (documents ),
236
235
)
237
236
)
238
237
else :
0 commit comments