zrguo commited on
Commit
010afa0
·
1 Parent(s): 480d89b

Add max_gleaning to env

Browse files
Files changed (3) hide show
  1. env.example +2 -0
  2. lightrag/constants.py +1 -0
  3. lightrag/lightrag.py +4 -1
env.example CHANGED
@@ -58,6 +58,8 @@ SUMMARY_LANGUAGE=English
58
  # FORCE_LLM_SUMMARY_ON_MERGE=6
59
  ### Max tokens for entity/relations description after merge
60
  # MAX_TOKEN_SUMMARY=500
 
 
61
 
62
  ### Number of parallel processing documents(Less than MAX_ASYNC/2 is recommended)
63
  # MAX_PARALLEL_INSERT=2
 
58
  # FORCE_LLM_SUMMARY_ON_MERGE=6
59
  ### Max tokens for entity/relations description after merge
60
  # MAX_TOKEN_SUMMARY=500
61
+ ### Maximum number of entity extraction attempts for ambiguous content
62
+ # ENTITY_EXTRACT_MAX_GLEANING=1
63
 
64
  ### Number of parallel processing documents(Less than MAX_ASYNC/2 is recommended)
65
  # MAX_PARALLEL_INSERT=2
lightrag/constants.py CHANGED
@@ -7,6 +7,7 @@ consistency and makes maintenance easier.
7
  """
8
 
9
  # Default values for environment variables
 
10
  DEFAULT_MAX_TOKEN_SUMMARY = 500
11
  DEFAULT_FORCE_LLM_SUMMARY_ON_MERGE = 6
12
  DEFAULT_WOKERS = 2
 
7
  """
8
 
9
  # Default values for environment variables
10
+ DEFAULT_MAX_GLEANING = 1
11
  DEFAULT_MAX_TOKEN_SUMMARY = 500
12
  DEFAULT_FORCE_LLM_SUMMARY_ON_MERGE = 6
13
  DEFAULT_WOKERS = 2
lightrag/lightrag.py CHANGED
@@ -22,6 +22,7 @@ from typing import (
22
  Dict,
23
  )
24
  from lightrag.constants import (
 
25
  DEFAULT_MAX_TOKEN_SUMMARY,
26
  DEFAULT_FORCE_LLM_SUMMARY_ON_MERGE,
27
  )
@@ -124,7 +125,9 @@ class LightRAG:
124
  # Entity extraction
125
  # ---
126
 
127
- entity_extract_max_gleaning: int = field(default=1)
 
 
128
  """Maximum number of entity extraction attempts for ambiguous content."""
129
 
130
  summary_to_max_tokens: int = field(
 
22
  Dict,
23
  )
24
  from lightrag.constants import (
25
+ DEFAULT_MAX_GLEANING,
26
  DEFAULT_MAX_TOKEN_SUMMARY,
27
  DEFAULT_FORCE_LLM_SUMMARY_ON_MERGE,
28
  )
 
125
  # Entity extraction
126
  # ---
127
 
128
+ entity_extract_max_gleaning: int = field(
129
+ default=get_env_value("MAX_GLEANING", DEFAULT_MAX_GLEANING, int)
130
+ )
131
  """Maximum number of entity extraction attempts for ambiguous content."""
132
 
133
  summary_to_max_tokens: int = field(