Skip to content

Commit

Permalink
style: polish code
Browse files Browse the repository at this point in the history
  • Loading branch information
ProseGuys committed Nov 26, 2024
1 parent c26ed3e commit 4987220
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions api/core/rag/datasource/retrieval_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4987220

Please sign in to comment.