Skip to content

Commit c58d2fc

Browse files
authored
roll back rerank topn setting (langgenius#11297)
1 parent 7a962b9 commit c58d2fc

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

api/.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,4 +413,3 @@ RESET_PASSWORD_TOKEN_EXPIRY_MINUTES=5
413413

414414
CREATE_TIDB_SERVICE_JOB_ENABLED=false
415415

416-
RETRIEVAL_TOP_N=0

api/configs/feature/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,6 @@ class DataSetConfig(BaseSettings):
626626
default=30,
627627
)
628628

629-
RETRIEVAL_TOP_N: int = Field(description="number of retrieval top_n", default=0)
630-
631629

632630
class WorkspaceConfig(BaseSettings):
633631
"""

api/core/rag/datasource/retrieval_service.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from flask import Flask, current_app
55

6-
from configs import DifyConfig
76
from core.rag.data_post_processor.data_post_processor import DataPostProcessor
87
from core.rag.datasource.keyword.keyword_factory import Keyword
98
from core.rag.datasource.vdb.vector_factory import Vector
@@ -114,7 +113,7 @@ def retrieve(
114113
query=query,
115114
documents=all_documents,
116115
score_threshold=score_threshold,
117-
top_n=DifyConfig.RETRIEVAL_TOP_N or top_k,
116+
top_n=top_k,
118117
)
119118

120119
return all_documents
@@ -186,7 +185,7 @@ def embedding_search(
186185
query=query,
187186
documents=documents,
188187
score_threshold=score_threshold,
189-
top_n=DifyConfig.RETRIEVAL_TOP_N or len(documents),
188+
top_n=len(documents),
190189
)
191190
)
192191
else:
@@ -231,7 +230,7 @@ def full_text_index_search(
231230
query=query,
232231
documents=documents,
233232
score_threshold=score_threshold,
234-
top_n=DifyConfig.RETRIEVAL_TOP_N or len(documents),
233+
top_n=len(documents),
235234
)
236235
)
237236
else:

0 commit comments

Comments
 (0)