feat: Skip rerank filtering when min_rerank_score is 0.0

This commit is contained in:
yangdx 2025-07-27 16:50:12 +08:00
parent ebaff228aa
commit a9565d7379
2 changed files with 17 additions and 16 deletions

View file

@ -19,11 +19,11 @@ DEFAULT_MAX_ENTITY_TOKENS = 10000
DEFAULT_MAX_RELATION_TOKENS = 10000 DEFAULT_MAX_RELATION_TOKENS = 10000
DEFAULT_MAX_TOTAL_TOKENS = 30000 DEFAULT_MAX_TOTAL_TOKENS = 30000
DEFAULT_HISTORY_TURNS = 0 DEFAULT_HISTORY_TURNS = 0
DEFAULT_ENABLE_RERANK = True
DEFAULT_COSINE_THRESHOLD = 0.2 DEFAULT_COSINE_THRESHOLD = 0.2
DEFAULT_RELATED_CHUNK_NUMBER = 5 DEFAULT_RELATED_CHUNK_NUMBER = 5
# Rerank configuration defaults # Rerank configuration defaults
DEFAULT_ENABLE_RERANK = True
DEFAULT_MIN_RERANK_SCORE = 0.0 DEFAULT_MIN_RERANK_SCORE = 0.0
# Separator for graph fields # Separator for graph fields

View file

@ -1874,6 +1874,7 @@ async def process_chunks_unified(
# 2. Filter by minimum rerank score if reranking is enabled # 2. Filter by minimum rerank score if reranking is enabled
if query_param.enable_rerank and unique_chunks: if query_param.enable_rerank and unique_chunks:
min_rerank_score = global_config.get("min_rerank_score", 0.5) min_rerank_score = global_config.get("min_rerank_score", 0.5)
if min_rerank_score > 0.0:
original_count = len(unique_chunks) original_count = len(unique_chunks)
# Filter chunks with score below threshold # Filter chunks with score below threshold