diff --git a/README-zh.md b/README-zh.md index 5603ad99..d0de20da 100644 --- a/README-zh.md +++ b/README-zh.md @@ -334,7 +334,8 @@ class QueryParam: Format: [{"role": "user/assistant", "content": "message"}]. """ - history_turns: int = 3 + # Deprated: history message have negtive effect on query performance + history_turns: int = 0 """Number of complete conversation turns (user-assistant pairs) to consider in the response context.""" ids: list[str] | None = None diff --git a/README.md b/README.md index a3abefd8..664a852e 100644 --- a/README.md +++ b/README.md @@ -335,7 +335,8 @@ class QueryParam: Format: [{"role": "user/assistant", "content": "message"}]. """ - history_turns: int = 3 + # Deprated: history message have negtive effect on query performance + history_turns: int = 0 """Number of complete conversation turns (user-assistant pairs) to consider in the response context.""" ids: list[str] | None = None @@ -614,7 +615,6 @@ conversation_history = [ query_param = QueryParam( mode="mix", # or any other mode: "local", "global", "hybrid" conversation_history=conversation_history, # Add the conversation history - history_turns=3 # Number of recent conversation turns to consider ) # Make a query that takes into account the conversation history diff --git a/env.example b/env.example index 850538fa..0b863c9b 100644 --- a/env.example +++ b/env.example @@ -53,7 +53,6 @@ OLLAMA_EMULATING_MODEL_TAG=latest ######################## # LLM responde cache for query (Not valid for streaming response) ENABLE_LLM_CACHE=true -# HISTORY_TURNS=0 # COSINE_THRESHOLD=0.2 ### Number of entities or relations retrieved from KG # TOP_K=40 diff --git a/lightrag/base.py b/lightrag/base.py index 35d5caae..fff7557d 100644 --- a/lightrag/base.py +++ b/lightrag/base.py @@ -100,6 +100,7 @@ class QueryParam: Format: [{"role": "user/assistant", "content": "message"}]. """ + # Deprecated: history message have negtive effect on query performance history_turns: int = int(os.getenv("HISTORY_TURNS", str(DEFAULT_HISTORY_TURNS))) """Number of complete conversation turns (user-assistant pairs) to consider in the response context.""" diff --git a/lightrag/constants.py b/lightrag/constants.py index bea8a00f..9f066ec5 100644 --- a/lightrag/constants.py +++ b/lightrag/constants.py @@ -25,9 +25,10 @@ DEFAULT_CHUNK_TOP_K = 10 DEFAULT_MAX_ENTITY_TOKENS = 10000 DEFAULT_MAX_RELATION_TOKENS = 10000 DEFAULT_MAX_TOTAL_TOKENS = 30000 -DEFAULT_HISTORY_TURNS = 0 DEFAULT_COSINE_THRESHOLD = 0.2 DEFAULT_RELATED_CHUNK_NUMBER = 5 +# Deprated: history message have negtive effect on query performance +DEFAULT_HISTORY_TURNS = 0 # Rerank configuration defaults DEFAULT_ENABLE_RERANK = True