Rename ENABLE_RERANK to RERANK_BY_DEFAULT and update default to true

This commit is contained in:
yangdx 2025-08-23 09:46:51 +08:00
parent d29272e6a5
commit 1be9a54c8d
3 changed files with 4 additions and 2 deletions

View file

@ -91,6 +91,8 @@ ENABLE_LLM_CACHE=true
### For rerank model deployed by vLLM use cohere binding
#########################################################
RERANK_BINDING=null
### Enable rerank by default in query params
# RERANK_BY_DEFAULT=True
### rerank score chunk filter(set to 0.0 to keep all chunks, 0.6 or above if LLM is not strong enought)
# MIN_RERANK_SCORE=0.0

View file

@ -391,7 +391,7 @@ def create_app(args):
),
)
# Configure rerank function based on enable_rerank parameter
# Configure rerank function based on args.rerank_bindingparameter
rerank_model_func = None
if args.rerank_binding != "null":
from lightrag.rerank import cohere_rerank, jina_rerank, ali_rerank

View file

@ -157,7 +157,7 @@ class QueryParam:
If proivded, this will be use instead of the default vaulue from prompt template.
"""
enable_rerank: bool = os.getenv("ENABLE_RERANK", "false").lower() == "true"
enable_rerank: bool = os.getenv("RERANK_BY_DEFAULT", "true").lower() == "true"
"""Enable reranking for retrieved text chunks. If True but no rerank model is configured, a warning will be issued.
Default is True to enable reranking when rerank model is available.
"""