env.example 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989
  1. ### All configurable environment variable must show up in this sample file in active or comment out status
  2. ### Setup tool `make env-*` uses this file to generate final .env file
  3. ### Target environment of this env file: host/compose (compose is for Dokcer or Kubernetes)
  4. # LIGHTRAG_RUNTIME_TARGET=host
  5. ###########################
  6. ### Server Configuration
  7. ###########################
  8. HOST=0.0.0.0
  9. PORT=9621
  10. WEBUI_TITLE='My Graph KB'
  11. WEBUI_DESCRIPTION='Simple and Fast Graph Based RAG System'
  12. # WORKERS=2
  13. ### gunicorn worker timeout(as default LLM request timeout if LLM_TIMEOUT is not set)
  14. # TIMEOUT=150
  15. # CORS_ORIGINS=http://localhost:3000,http://localhost:8080
  16. ### Path Prefix Configuration (Optional)
  17. ### Used to host multiple LightRAG instances on one host behind a reverse
  18. ### proxy that routes by site prefix. Leave unset (or empty) for a
  19. ### single-instance deployment.
  20. ###
  21. ### - LIGHTRAG_API_PREFIX : reverse-proxy prefix the upstream proxy strips
  22. ### before forwarding (passed to FastAPI as root_path).
  23. ###
  24. ### See docs/MultiSiteDeployment.md for end-to-end examples.
  25. # LIGHTRAG_API_PREFIX=/site01
  26. ### Optional SSL Configuration
  27. ### Docker note: generated compose files mount staged certs at /app/data/certs/ inside the container
  28. # SSL=true
  29. # SSL_CERTFILE=/path/to/cert.pem
  30. # SSL_KEYFILE=/path/to/key.pem
  31. ### Directory Configuration (defaults to current working directory)
  32. ### Default value is: ./inputs ./rag_storage
  33. # INPUT_DIR=<absolute_path_for_doc_input_dir>
  34. # WORKING_DIR=<absolute_path_for_working_dir>
  35. ### Tiktoken cache directory (Store cached files in this folder for offline deployment)
  36. # TIKTOKEN_CACHE_DIR=/app/data/tiktoken
  37. ### Ollama Emulating Model and Tag
  38. # OLLAMA_EMULATING_MODEL_NAME=lightrag
  39. OLLAMA_EMULATING_MODEL_TAG=latest
  40. ### Max nodes for graph retrieval (Ensure WebUI local settings are also updated, which is limited to this value)
  41. # MAX_GRAPH_NODES=1000
  42. ### Logging level
  43. # LOG_LEVEL=INFO
  44. # VERBOSE=False
  45. # LOG_MAX_BYTES=10485760
  46. # LOG_BACKUP_COUNT=5
  47. ### Logfile location (defaults to current working directory)
  48. # LOG_DIR=/path/to/log/directory
  49. # LIGHTRAG_PERFORMANCE_TIMING_LOGS=false
  50. #####################################
  51. ### Login and API-Key Configuration
  52. #####################################
  53. # AUTH_ACCOUNTS='admin:admin123,user1:{bcrypt}$2b$12$S8Yu.gCbuAbNTJFB.231gegTwr5pgrFxc8H9kXQ4/sduFBHkhM8Ka'
  54. # TOKEN_SECRET=lightrag-jwt-default-secret-key!
  55. # JWT_ALGORITHM=HS256
  56. # TOKEN_EXPIRE_HOURS=48
  57. # GUEST_TOKEN_EXPIRE_HOURS=24
  58. ### Token Auto-Renewal Configuration (Sliding Window Expiration)
  59. ### Enable automatic token renewal to prevent active users from being logged out
  60. ### When enabled, tokens will be automatically renewed when remaining time < threshold
  61. # TOKEN_AUTO_RENEW=true
  62. ### Token renewal threshold (0.0 - 1.0)
  63. ### Renew token when remaining time < (total time * threshold)
  64. ### Default: 0.5 (renew when 50% time remaining)
  65. ### Examples:
  66. ### 0.5 = renew when 24h token has 12h left
  67. ### 0.25 = renew when 24h token has 6h left
  68. # TOKEN_RENEW_THRESHOLD=0.5
  69. ### Note: Token renewal is automatically skipped for certain endpoints:
  70. ### - /health: Health check endpoint (no authentication required)
  71. ### - /documents/paginated: Frequently polled by client (5-30s interval)
  72. ### - /documents/pipeline_status: Very frequently polled by client (2s interval)
  73. ### - Rate limit: Minimum 60 seconds between renewals for same user
  74. ### API-Key to access LightRAG Server API
  75. ### Use this key in HTTP requests with the 'X-API-Key' header
  76. ### Example: curl -H "X-API-Key: your-secure-api-key-here" http://localhost:9621/query
  77. # LIGHTRAG_API_KEY=your-secure-api-key-here
  78. # WHITELIST_PATHS=/health,/api/*
  79. ######################################################################################
  80. ### Query Configuration
  81. ###
  82. ### How to control the context length sent to LLM:
  83. ### MAX_ENTITY_TOKENS + MAX_RELATION_TOKENS < MAX_TOTAL_TOKENS
  84. ### Chunk_Tokens = MAX_TOTAL_TOKENS - Actual_Entity_Tokens - Actual_Relation_Tokens
  85. ######################################################################################
  86. # LLM response cache for query (Not valid for streaming response)
  87. # ENABLE_LLM_CACHE=true
  88. # COSINE_THRESHOLD=0.2
  89. ### Number of entities or relations retrieved from KG
  90. # TOP_K=40
  91. ### Maximum number or chunks for naive vector search
  92. # CHUNK_TOP_K=20
  93. ### control the actual entities send to LLM
  94. # MAX_ENTITY_TOKENS=6000
  95. ### control the actual relations send to LLM
  96. # MAX_RELATION_TOKENS=8000
  97. ### control the maximum tokens send to LLM (include entities, relations and chunks)
  98. # MAX_TOTAL_TOKENS=30000
  99. ### chunk selection strategies
  100. ### VECTOR: Pick KG chunks by vector similarity, delivered chunks to the LLM aligning more closely with naive retrieval
  101. ### WEIGHT: Pick KG chunks by entity and chunk weight, delivered more solely KG related chunks to the LLM
  102. ### If reranking is enabled, the impact of chunk selection strategies will be diminished.
  103. # KG_CHUNK_PICK_METHOD=VECTOR
  104. ### maximum number of related chunks per source entity or relation
  105. ### The chunk picker uses this value to determine the total number of chunks selected from KG(knowledge graph)
  106. ### Higher values increase re-ranking time
  107. # RELATED_CHUNK_NUMBER=5
  108. #########################################################
  109. ### Reranking configuration
  110. ### RERANK_BINDING type: null, cohere, jina, aliyun
  111. ### For rerank model deployed by vLLM use cohere binding
  112. ### If LightRAG deployed in Docker:
  113. ### uses host.docker.internal instead of localhost in RERANK_BINDING_HOST
  114. #########################################################
  115. RERANK_BINDING=null
  116. # RERANK_MODEL=BAAI/bge-reranker-v2-m3
  117. # RERANK_BINDING_HOST=http://localhost:8000/rerank
  118. # RERANK_BINDING_API_KEY=your_rerank_api_key_here
  119. ### rerank score chunk filter(set to 0.0 to keep all chunks, 0.6 or above if LLM is not strong enough)
  120. # MIN_RERANK_SCORE=0.0
  121. ### Enable rerank by default in query params when RERANK_BINDING is not null
  122. # RERANK_BY_DEFAULT=True
  123. ### Rerank concurrency and timeout (independent from base LLM settings)
  124. ### MAX_ASYNC_RERANK falls back to MAX_ASYNC when unset.
  125. ### RERANK_TIMEOUT has its own default (30s) since reranker calls are
  126. ### typically much shorter than full LLM generation.
  127. # MAX_ASYNC_RERANK=4
  128. # RERANK_TIMEOUT=30
  129. ### Cohere AI
  130. # # RERANK_MODEL=rerank-v3.5
  131. # # RERANK_BINDING_HOST=https://api.cohere.com/v2/rerank
  132. # # RERANK_BINDING_API_KEY=your_rerank_api_key_here
  133. ### Cohere rerank chunking configuration (useful for models with token limits like ColBERT)
  134. # RERANK_ENABLE_CHUNKING=true
  135. # RERANK_MAX_TOKENS_PER_DOC=480
  136. ### Aliyun Dashscope
  137. # # RERANK_MODEL=gte-rerank-v2
  138. # # RERANK_BINDING_HOST=https://dashscope.aliyuncs.com/api/v1/services/rerank/text-rerank/text-rerank
  139. # # RERANK_BINDING_API_KEY=your_rerank_api_key_here
  140. ### Jina AI
  141. # # RERANK_MODEL=jina-reranker-v2-base-multilingual
  142. # # RERANK_BINDING_HOST=https://api.jina.ai/v1/rerank
  143. # # RERANK_BINDING_API_KEY=your_rerank_api_key_here
  144. ### For local deployment Embedding and Reranker with vLLM (OpenAI-compatible API)
  145. ### Wizard metadata used to preserve the chosen deployment provider across setup reruns
  146. # LIGHTRAG_SETUP_EMBEDDING_PROVIDER=vllm
  147. # LIGHTRAG_SETUP_RERANK_PROVIDER=vllm
  148. # VLLM_EMBED_MODEL=BAAI/bge-m3
  149. # VLLM_EMBED_PORT=8001
  150. # VLLM_EMBED_DEVICE=cpu
  151. ### VLLM_EMBED_API_KEY is passed as --api-key to vLLM; synced to EMBEDDING_BINDING_API_KEY; auto-generated if blank
  152. # VLLM_EMBED_API_KEY=
  153. # VLLM_EMBED_EXTRA_ARGS=
  154. # VLLM_RERANK_MODEL=BAAI/bge-reranker-v2-m3
  155. # VLLM_RERANK_PORT=8000
  156. # VLLM_RERANK_DEVICE=cuda
  157. ### VLLM_RERANK_API_KEY is passed as --api-key to vLLM; synced to RERANK_BINDING_API_KEY; auto-generated if blank
  158. # VLLM_RERANK_API_KEY=
  159. ### Use float16 for GPU mode. CPU mode uses the official vLLM CPU image.
  160. # VLLM_USE_CPU=1
  161. ### Set to 1 for CPU mode, unset for GPU mode
  162. # CUDA_VISIBLE_DEVICES=-1
  163. ### Set to -1 to disable CUDA (CPU mode), or specific GPU IDs for GPU mode
  164. # NVIDIA_VISIBLE_DEVICES=0
  165. ### Optional Docker runtime equivalent; generated GPU compose honors either variable.
  166. # VLLM_RERANK_EXTRA_ARGS=
  167. ########################################
  168. ### Document processing configuration
  169. ########################################
  170. ### Document processing output language: English, Chinese, French, German ...
  171. SUMMARY_LANGUAGE=English
  172. ### Enable JSON-structured output for entity extraction
  173. ### Default behavior: JSON output is disabled when ENTITY_EXTRACTION_USE_JSON is unset
  174. ### JSON output incurs higher latency but delivers improved reliability
  175. ENTITY_EXTRACTION_USE_JSON=true
  176. ### Optional external YAML profile for entity type guidance and extraction examples
  177. ### Profiles are loaded from PROMPT_DIR/entity_type (PROMPT_DIR defaults to ./prompts).
  178. ### A reference template is shipped at prompts/samples/entity_type_prompt.sample.yml;
  179. # ENTITY_TYPE_PROMPT_FILE=entity_type_prompt.yml
  180. # PROMPT_DIR=<absolute_path_for_prompt_dir>
  181. ### Multimodal parsing/analyze integration
  182. ### Optional parser routing rules. Example for VLM & MinerU enabled configuration:
  183. ### LIGHTRAG_PARSER=*:native-iteP,*:mineru-iteP,*:legacy-R
  184. ### Rules may be separated with commas or semicolons. Rules match file suffixes
  185. ### (pdf), not full names (*.pdf), and are checked left-to-right.
  186. ### If mineru/docling appears in LIGHTRAG_PARSER, the corresponding endpoint
  187. ### below must be configured before server startup.
  188. ### See docs/FileProcessingPipeline.md for detail
  189. LIGHTRAG_PARSER=*:native-teP,*:legacy-R
  190. ### Async parser service protocol (optional)
  191. ### Configure these when using remote MinerU/Docling async services
  192. ### ---- MinerU shared parameters (both local and official modes) ----
  193. ### MinerU API protocol. Choose one active mode.
  194. ### - official: MinerU precision API v4. Requires MINERU_API_TOKEN.
  195. ### - local: self-hosted mineru-api / mineru-router base URL.
  196. MINERU_API_MODE=local
  197. # MINERU_POLL_INTERVAL_SECONDS=2
  198. # MINERU_MAX_POLLS=180
  199. # MINERU_LANGUAGE=ch
  200. # MINERU_ENABLE_TABLE=true
  201. # MINERU_ENABLE_FORMULA=true
  202. # MINERU_PAGE_RANGES=
  203. ### MINERU_PAGE_RANGES semantics differ by mode:
  204. ### - official: forwarded verbatim, supports e.g. "1-3,5,7-9".
  205. ### - local: only a single page ("3") or simple range ("1-10"); comma
  206. ### lists are rejected at startup.
  207. ### When switching modes, double-check this constraint.
  208. ### ---- MinerU local-only (MINERU_API_MODE=local) ----
  209. MINERU_LOCAL_ENDPOINT=http://127.0.0.1:8000
  210. ### MINERU_LOCAL_BACKEND: which mineru-api backend handles the parse.
  211. ### Accepted values (per mineru-api POST /tasks form parameter `backend`):
  212. ### hybrid-auto-engine - pipeline + VLM combo with auto-selected local
  213. ### engine (mineru-api's default). GPU required.
  214. ### pipeline - CPU-friendly traditional pipeline; no VLM step.
  215. ### vlm-auto-engine - VLM with auto-selected local inference engine
  216. ### (sglang-engine / vllm-engine if GPU is available);
  217. ### requires the matching engine extra preinstalled
  218. ### on the mineru-api side, plus model weights.
  219. ### We ship `hybrid-auto-engine` -- requires the target mineru-api
  220. ### deployment to have a GPU plus the matching inference engine
  221. ### (sglang / vllm) and model weights installed. Switch to `pipeline`
  222. ### for CPU-only deployments without those dependencies.
  223. MINERU_LOCAL_BACKEND=hybrid-auto-engine
  224. ### MINERU_LOCAL_PARSE_METHOD: parsing strategy for the pipeline component.
  225. ### Accepted values:
  226. ### auto - auto-detect embedded text-layer vs OCR per page (default).
  227. ### txt - extract text from the embedded text layer only; fastest,
  228. ### but yields empty output on scanned PDFs without a text layer.
  229. ### ocr - force OCR on every page regardless of text-layer quality;
  230. ### slowest, reliable on scanned or low-quality PDFs.
  231. ### Only consumed when MINERU_LOCAL_BACKEND is `pipeline` or
  232. ### `hybrid-auto-engine` (the pipeline arm of the hybrid pipeline).
  233. ### Pure VLM backends (`vlm-auto-engine`, `vlm-http-client`) ignore this
  234. ### parameter -- the VLM model handles layout/OCR natively.
  235. MINERU_LOCAL_PARSE_METHOD=auto
  236. ### MINERU_LOCAL_IMAGE_ANALYSIS: enable VLM image/chart analysis pass for
  237. ### better caption an footnote recognition.
  238. ### Only consumed by `vlm-auto-engine`, `vlm-http-client`,
  239. ### `hybrid-auto-engine`, `hybrid-http-client`. The `pipeline` backend
  240. ### silently drops this flag -- its `_process_pipeline` does not accept
  241. ### the kwarg, so setting `false` under pipeline does NOT speed parsing
  242. ### up; pipeline never invokes the VLM image pass to begin with.
  243. ### Disable (`false`) on VLM / hybrid backends to skip the extra VLM
  244. ### round, trading image / chart semantic descriptions for faster parsing
  245. ### and lower GPU cost.
  246. MINERU_LOCAL_IMAGE_ANALYSIS=true
  247. # MINERU_LOCAL_START_PAGE_ID=0
  248. # MINERU_LOCAL_END_PAGE_ID=99999
  249. ### ---- MinerU official-only (MINERU_API_MODE=official) ----
  250. # MINERU_API_TOKEN=your-api-key
  251. # MINERU_OFFICIAL_ENDPOINT=https://mineru.net
  252. # MINERU_MODEL_VERSION=vlm
  253. # MINERU_IS_OCR=false
  254. ### Force re-upload of file to MinerU on every retry after failure
  255. ### Disables caching of result outcomes
  256. # LIGHTRAG_FORCE_REPARSE_MINERU=false
  257. ### Docling parser (docling-serve v1 / async API).
  258. ###
  259. ### Endpoint: base URL only — the client appends /v1/convert/file/async,
  260. ### /v1/status/poll/{task_id}?wait=<DOCLING_POLL_INTERVAL_SECONDS>,
  261. ### /v1/result/{task_id} itself.
  262. ### Pipeline shape (pipeline=standard, target_type=zip,
  263. ### to_formats=[json,md], image_export_mode=referenced) is fixed in
  264. ### code so the sidecar flow stays self-consistent — flipping any of
  265. ### these would break the adapter and is therefore not exposed as env.
  266. ###
  267. ### OCR tunables:
  268. ### - DOCLING_DO_OCR: master switch; when false the engine relies only on
  269. ### text-layer extraction.
  270. ### - DOCLING_FORCE_OCR: when true, OCR every page regardless of text-layer
  271. ### quality (slower, useful for scanned PDFs with bad text layers).
  272. ### - DOCLING_OCR_ENGINE: explicit engine selection (DEPRECATED in the
  273. ### docling-serve OpenAPI but still honored for older deployments).
  274. ### - DOCLING_OCR_PRESET: recommended replacement for DOCLING_OCR_ENGINE.
  275. ### - DOCLING_OCR_LANG: JSON array (e.g. ["en","zh"]) or comma-separated
  276. ### list. Empty (default) lets the OCR engine pick its default.
  277. ### - DOCLING_DO_FORMULA_ENRICHMENT: when true, the code-formula model runs
  278. ### and `texts[*].label="formula"` items carry LaTeX in `text`. Default
  279. ### false because the model may not be present on every deployment;
  280. ### adapter falls back to plain-text formulas when disabled.
  281. ###
  282. ### Polling budget (server-side long-poll; client does NOT add extra sleep):
  283. ### - DOCLING_POLL_INTERVAL_SECONDS: ``?wait=N`` value sent to
  284. ### /v1/status/poll/{task_id}. Larger N = fewer round trips per parse;
  285. ### bound by your reverse-proxy idle timeout. Default 5.
  286. ### - DOCLING_MAX_POLLS: max polling rounds before raising TimeoutError.
  287. ### Worst-case wall-clock budget ≈
  288. ### DOCLING_POLL_INTERVAL_SECONDS × DOCLING_MAX_POLLS. Default 240
  289. ### (≈ 20 minutes at wait=5s); raise for very large PDFs.
  290. ###
  291. ### Bundle cache controls:
  292. ### - DOCLING_ENGINE_VERSION: recorded in <base>.docling_raw/_manifest.json.
  293. ### Mismatch with the recorded value forces a cache miss → re-download.
  294. ### Leave empty to skip this check.
  295. ### - LIGHTRAG_FORCE_REPARSE_DOCLING: when truthy ("1"/"true"), bypass the
  296. ### docling raw cache and re-upload on every parse_docling call.
  297. ### - DOCLING_BBOX_ATTRIBUTES: override the doc-level bbox_attributes
  298. ### written into <base>.blocks.jsonl meta. Default
  299. ### {"origin":"LEFTBOTTOM"} matches docling's default coordinate system.
  300. DOCLING_ENDPOINT=http://localhost:5001
  301. DOCLING_DO_OCR=true
  302. DOCLING_FORCE_OCR=true
  303. DOCLING_DO_FORMULA_ENRICHMENT=false
  304. # DOCLING_OCR_ENGINE=auto
  305. # DOCLING_OCR_PRESET=auto
  306. # DOCLING_OCR_LANG=
  307. # DOCLING_POLL_INTERVAL_SECONDS=5
  308. # DOCLING_MAX_POLLS=240
  309. # DOCLING_BBOX_ATTRIBUTES={"origin":"LEFTBOTTOM"}
  310. ### Force re-upload of file to Docling on every retry after failure
  311. ### Disables caching of result outcomes
  312. # LIGHTRAG_FORCE_REPARSE_DOCLING=false
  313. ### File upload size limit (in bytes)
  314. ### Default: 104857600 (100MB)
  315. ### Set to 0 or None for unlimited upload size
  316. ### Examples:
  317. ### 52428800 = 50MB
  318. ### 104857600 = 100MB (default)
  319. ### 209715200 = 200MB
  320. ### Note: If using Nginx as reverse proxy, also configure client_max_body_size
  321. # MAX_UPLOAD_SIZE=104857600
  322. ### Global chunk size, 500~1500 is recommended.
  323. ### Chunker inherits the global value here only when its own var is unset.
  324. ### Exception: P never inherits CHUNK_SIZE — it uses CHUNK_P_SIZE (default 2000).
  325. # CHUNK_SIZE=1200
  326. # CHUNK_OVERLAP_SIZE=100
  327. ### Fixed-token chunker (process_options=F, default) settings
  328. ### CHUNK_F_SIZE: per-strategy chunk_token_size override; falls back to CHUNK_SIZE when unset
  329. ### CHUNK_F_OVERLAP_SIZE: token overlap; falls back to CHUNK_OVERLAP_SIZE when unset
  330. ### CHUNK_F_SPLIT_BY_CHARACTER: optional separator string; pre-segment before token windowing
  331. ### CHUNK_F_SPLIT_BY_CHARACTER_ONLY: when true, raise on oversize segment instead of token re-split
  332. # CHUNK_F_SIZE=1200
  333. # CHUNK_F_OVERLAP_SIZE=100
  334. # CHUNK_F_SPLIT_BY_CHARACTER=
  335. # CHUNK_F_SPLIT_BY_CHARACTER_ONLY=false
  336. ### Recursive character chunker (process_options=R) settings
  337. ### CHUNK_R_SIZE: per-strategy chunk_token_size override; falls back to CHUNK_SIZE when unset
  338. ### CHUNK_R_OVERLAP_SIZE: token overlap between adjacent chunks; falls back to CHUNK_OVERLAP_SIZE when unset
  339. ### CHUNK_R_SEPARATORS: JSON array of cascaded separators tried by RecursiveCharacterTextSplitter.
  340. ### Default includes CJK sentence-ending punctuation so Chinese / mixed-language
  341. ### documents split at semantic boundaries. Order: paragraph (\n\n) > line (\n) >
  342. ### Chinese sentence-end (。!?) > Chinese semi-clause (;,) > space > char.
  343. ### English ".?!" are intentionally omitted (literal match would split "0.95" /
  344. ### "e.g."); the English path falls through space / char as before.
  345. # CHUNK_R_SIZE=1200
  346. # CHUNK_R_OVERLAP_SIZE=100
  347. # CHUNK_R_SEPARATORS=["\n\n","\n","。","!","?",";",","," ",""]
  348. ### Semantic vector chunker (process_options=V) settings
  349. ### CHUNK_V_SIZE: per-strategy chunk_token_size hard cap (oversized pieces are
  350. ### re-split via R before being emitted); falls back to CHUNK_SIZE when unset
  351. ### CHUNK_V_BREAKPOINT_THRESHOLD_TYPE: percentile | standard_deviation | interquartile | gradient
  352. ### CHUNK_V_BREAKPOINT_THRESHOLD_AMOUNT: leave empty to use the LangChain per-type default (e.g. 95 for percentile)
  353. ### CHUNK_V_BUFFER_SIZE: number of adjacent sentences combined when computing distances
  354. ### CHUNK_V_SENTENCE_SPLIT_REGEX: regex fed to LangChain SemanticChunker for the
  355. ### initial sentence split. Default extends the upstream English-only pattern
  356. ### with CJK sentence-end punctuation (。?!). Override if you need a
  357. ### different language mix. Note: env value is the raw regex string, no JSON
  358. ### quoting.
  359. # CHUNK_V_SIZE=1200
  360. # CHUNK_V_BREAKPOINT_THRESHOLD_TYPE=percentile
  361. # CHUNK_V_BREAKPOINT_THRESHOLD_AMOUNT=
  362. # CHUNK_V_BUFFER_SIZE=1
  363. # CHUNK_V_SENTENCE_SPLIT_REGEX=(?<=[.?!])\s+|(?<=[。?!])
  364. ### Paragraph semantic chunker (process_options=P) settings
  365. ### CHUNK_P_SIZE: per-strategy chunk_token_size override; defaults to 2000 when unset
  366. ### (does NOT fall back to CHUNK_SIZE — paragraph-semantic merging needs more
  367. ### headroom than the global default to keep related paragraphs together).
  368. ### CHUNK_P_OVERLAP_SIZE: overlap for prose fallback and table-bridge context;
  369. ### falls back to CHUNK_OVERLAP_SIZE when unset
  370. # CHUNK_P_SIZE=2000
  371. # CHUNK_P_OVERLAP_SIZE=100
  372. ### Number of summary segments or tokens to trigger LLM summary on entity/relation merge (at least 3 is recommended)
  373. # FORCE_LLM_SUMMARY_ON_MERGE=8
  374. ### Max description token size to trigger LLM summary
  375. # SUMMARY_MAX_TOKENS = 1200
  376. ### Recommended LLM summary output length in tokens
  377. # SUMMARY_LENGTH_RECOMMENDED=600
  378. ### Maximum context size sent to LLM for description summary
  379. # SUMMARY_CONTEXT_SIZE=12000
  380. ### Maximum token size allowed for entity extraction input context
  381. # MAX_EXTRACT_INPUT_TOKENS=20480
  382. ### Multimodal surrounding-context budget (per-half token cap for the
  383. ### `leading` / `trailing` text injected into VLM and extract prompts).
  384. ### Computed at analyze_multimodal entry; the two halves are independent
  385. ### so deployments can bias context forward or backward as needed.
  386. # SURROUNDING_LEADING_MAX_TOKENS=2000
  387. # SURROUNDING_TRAILING_MAX_TOKENS=2000
  388. ### Per-response cap on total entity+relationship rows/records emitted by the LLM
  389. # MAX_EXTRACTION_RECORDS=100
  390. ### Per-response cap on entity rows/objects emitted by the LLM
  391. # MAX_EXTRACTION_ENTITIES=40
  392. ### control the maximum chunk_ids stored in vector and graph db
  393. # MAX_SOURCE_IDS_PER_ENTITY=300
  394. # MAX_SOURCE_IDS_PER_RELATION=300
  395. ### control chunk_ids limitation method: FIFO, KEEP
  396. ### FIFO: First in first out
  397. ### KEEP: Keep oldest (less merge action and faster)
  398. # SOURCE_IDS_LIMIT_METHOD=FIFO
  399. ### Maximum number of file paths stored in entity/relation file_path field
  400. ### For displayed only, does not affect query performance
  401. # MAX_FILE_PATHS=100
  402. ### PDF decryption password for protected PDF files
  403. # PDF_DECRYPT_PASSWORD=your_pdf_password_here
  404. ### LLM cache for entity/relation extract is enable by default
  405. ### Disabling it will prevent graph reconstruction after document deletion
  406. # ENABLE_LLM_CACHE_FOR_EXTRACT=true
  407. ########################################
  408. ### Pipeline Concurrency Configuration
  409. ########################################
  410. ### Number of parallel processing documents(between 2~10, MAX_ASYNC/3 is recommended)
  411. MAX_PARALLEL_INSERT=2
  412. ### Optional per-stage document pipeline concurrency
  413. # MAX_PARALLEL_PARSE_NATIVE=5
  414. # MAX_PARALLEL_PARSE_MINERU=1
  415. # MAX_PARALLEL_PARSE_DOCLING=1
  416. # MAX_PARALLEL_ANALYZE=5
  417. ### Optional queue sizes for staged pipeline workers
  418. # QUEUE_SIZE_DEFAULT=100
  419. # QUEUE_SIZE_INSERT=4
  420. ### Max concurrency requests for Embedding
  421. # EMBEDDING_FUNC_MAX_ASYNC=8
  422. ### Num of chunks send to Embedding in single request (default is 10)
  423. EMBEDDING_BATCH_NUM=32
  424. ###########################################################################
  425. ### Gloabal LLM Configuration
  426. ### LLM_BINDING type: openai, ollama, lollms, azure_openai, bedrock, gemini
  427. ### LLM_BINDING_HOST: Service endpoint (left empty if using the provider SDK default endpoint)
  428. ### LLM_BINDING_API_KEY: api key
  429. ### If LightRAG deployed in Docker:
  430. ### uses host.docker.internal instead of localhost in LLM_BINDING_HOST
  431. ###########################################################################
  432. ### LLM request timeout setting for all llm (0 means no timeout for Ollma)
  433. # LLM_TIMEOUT=180
  434. LLM_BINDING=openai
  435. LLM_BINDING_HOST=https://api.openai.com/v1
  436. LLM_BINDING_API_KEY=your_api_key
  437. LLM_MODEL=gpt-5.4-mini
  438. ### Max concurrency requests of LLM
  439. MAX_ASYNC=4
  440. ###########################################################################
  441. ### Role-specific LLM/VLM overrides
  442. ### Available roles: EXTRACT, KEYWORD, QUERY, VLM
  443. ### If unset, each role falls back to gloabal LLM configuration above.
  444. ### For detail information, refer to:
  445. ### docs/RoleSpecificLLMConfiguration.md
  446. ### docs/RoleSpecificLLMConfiguration-zh.md
  447. ###########################################################################
  448. # KEYWORD_LLM_MODEL=gpt-5.4-nano
  449. # KEYWORD_MAX_ASYNC_LLM
  450. # KEYWORD_LLM_TIMEOUT=180
  451. # KEYWORD_LLM_BINDING=openai
  452. # KEYWORD_LLM_BINDING_HOST=https://api.openai.com/v1
  453. # KEYWORD_LLM_BINDING_API_KEY=your_api_key
  454. # QUERY_LLM_MODEL=gpt-5.4
  455. # QUERY_MAX_ASYNC_LLM
  456. # QUERY_LLM_TIMEOUT=180
  457. # QUERY_LLM_BINDING=openai
  458. # QUERY_LLM_BINDING_HOST=https://api.openai.com/v1
  459. # QUERY_LLM_BINDING_API_KEY=your_api_key
  460. # VLM_LLM_MODEL=gpt-5.4-mini
  461. # VLM_MAX_ASYNC_LLM=4
  462. # VLM_LLM_TIMEOUT=180
  463. # VLM_LLM_BINDING=openai
  464. # VLM_LLM_BINDING_HOST=https://api.example.com/v1
  465. # VLM_LLM_BINDING_API_KEY=your_vlm_api_key
  466. ### Master switch for VLM multimodal analysis (i/t/e items).
  467. ### When false, multimodal item is skipped regardless of document process_options
  468. ### When true, VLM_LLM_BINDING (or the base LLM_BINDING) must be vision-capable
  469. ### lollms is rejected at startup
  470. VLM_PROCESS_ENABLE=false
  471. ### Maximum image bytes sent to VLM (5242880=5MB)
  472. VLM_MAX_IMAGE_BYTES=5242880
  473. ###########################################################################
  474. ### Provider sepecific LLM options
  475. ### Increasing the temperature setting may help mitigate infinite inference
  476. ### loops during entity/elation extraction, particularly when using
  477. ### models with more limited capabilities, such as Qwen3-30B
  478. ### Set a max output token limit to prevent endless output from certain LLMs,
  479. ### which may trigger timeout errors during entity and relation extraction.
  480. ### max_output_token < LLM_TIMEOUT * llm_tokens_per_second
  481. ### i.e. max_output_token = 9000 = 180s * 50 tokens/s
  482. ### Sample commands to list all supported options specific LLM_BINDING:
  483. ### lightrag-server --llm-binding openai --help
  484. ### lightrag-server --llm-binding bedrock --help
  485. ### lightrag-server --llm-binding gemini --help
  486. ###########################################################################
  487. ### OpenAI Specific Parameters (Openrouter of other OpenAI compatible API):
  488. ### LLM_BINDING=openai
  489. ### LLM_BINDING_HOST=https://openrouter.ai/api/v1
  490. ### LLM_MODEL=google/gemini-2.5-flash
  491. # OPENAI_LLM_TEMPERATURE=0.9
  492. ### For vLLM/SGLang and most of OpenAI compatible API provider
  493. # OPENAI_LLM_MAX_TOKENS=9000
  494. ### For OpenAI o1-mini or newer modles utilizes max_completion_tokens instead of max_tokens
  495. # OPENAI_LLM_MAX_COMPLETION_TOKENS=9000
  496. ### For OpenAI reason control
  497. # OPENAI_LLM_REASONING_EFFORT=minimal
  498. ### For OpenRouter reasoning control
  499. # OPENAI_LLM_EXTRA_BODY='{"reasoning": {"enabled": false}}'
  500. ### For Qwen3 reasoning control deploy by vLLM
  501. # OPENAI_LLM_EXTRA_BODY='{"chat_template_kwargs": {"enable_thinking": false}}'
  502. ### Azure OpenAI Specific Parameters:
  503. ### LLM_BINDING=azure_openai
  504. ### LLM_BINDING_HOST=https://xxxx.openai.azure.com/
  505. ### LLM_BINDING_API_KEY=your_api_key
  506. ### LLM_MODEL=my-gpt-mini-deployment
  507. ### You may use deployment name for LLM_MODEL or set AZURE_OPENAI_DEPLOYMENT instead
  508. # AZURE_OPENAI_DEPLOYMEN=my—deplyment-name
  509. # AZURE_OPENAI_API_VERSION=2024-08-01-preview
  510. ### Google AI Studio Gemini Specific Parameters:
  511. ### DEFAULT_GEMINI_ENDPOINT means selecting endpoit by SDK automatically
  512. ### LLM_BINDING=gemini
  513. ### LLM_BINDING_HOST=DEFAULT_GEMINI_ENDPOINT
  514. ### LLM_BINDING_API_KEY=your_gemini_api_key
  515. ### LLM_MODEL=gemini-flash-latest
  516. # GEMINI_LLM_TEMPERATURE=0.7
  517. # GEMINI_LLM_MAX_OUTPUT_TOKENS=9000
  518. ### Enable or disable thinking
  519. ### GEMINI_LLM_THINKING_CONFIG='{"thinking_budget": -1, "include_thoughts": true}'
  520. ### GEMINI_LLM_THINKING_CONFIG='{"thinking_budget": 0, "include_thoughts": false}'
  521. # GEMINI_LLM_THINKING_CONFIG='{"thinking_budget": 0, "include_thoughts": false}'
  522. ### Google Vertex AI Gemini Specific Parameters:
  523. ### Vertex AI use GOOGLE_APPLICATION_CREDENTIALS instead of API-KEY for authentication
  524. # GOOGLE_GENAI_USE_VERTEXAI=true
  525. # GOOGLE_CLOUD_PROJECT='your-project-id'
  526. # GOOGLE_CLOUD_LOCATION='us-central1'
  527. # GOOGLE_APPLICATION_CREDENTIALS='/Users/xxxxx/your-service-account-credentials-file.json'
  528. ### Bedrock Specific Parameters:
  529. ### LLM_BINDING=bedrock
  530. ### LLM_BINDING_HOST=DEFAULT_BEDROCK_ENDPOINT
  531. ### LLM_MODEL=us.amazon.nova-lite-v1:0
  532. ### Region is required for all three modes (Bedrock endpoints are regional).
  533. # AWS_REGION=us-west-1
  534. ### Bedrock Authentication (choose ONE of the following three approaches):
  535. ### Bedrock API key (bearer token). Bedrock ignores LLM_BINDING_API_KEY;
  536. ### set AWS_BEARER_TOKEN_BEDROCK directly before startup. This is a
  537. ### process-level AWS SDK setting and cannot be overridden per role.
  538. # AWS_BEARER_TOKEN_BEDROCK=your_bedrock_api_key
  539. ### SigV4 credentials (classic IAM user / STS / instance profile).
  540. # AWS_ACCESS_KEY_ID=your_aws_access_key_id
  541. # AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key
  542. # AWS_SESSION_TOKEN=your_optional_aws_session_token
  543. ### Ambient credentials (AWS SDK default credential chain).
  544. ### To use this mode, leave AWS_BEARER_TOKEN_BEDROCK, AWS_ACCESS_KEY_ID,
  545. ### AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN above commented out — the
  546. ### AWS SDK will then resolve credentials from ~/.aws/credentials, IAM role,
  547. ### instance profile, SSO, or environment variables outside .env.
  548. ### Activating any of the lines above forces that explicit mode and bypasses
  549. ### the credential chain.
  550. # BEDROCK_LLM_TEMPERATURE=1.0
  551. # BEDROCK_LLM_MAX_TOKENS=9000
  552. # BEDROCK_LLM_TOP_P=1.0
  553. # BEDROCK_LLM_STOP_SEQUENCES='["</s>"]'
  554. ### Bedrock model reasoning control
  555. # BEDROCK_LLM_EXTRA_FIELDS='{"reasoningConfig": {"type": "enabled", "maxReasoningEffort": "low"}}'
  556. ### Ollama Specific Parameters:
  557. ### LLM_BINDING=ollama
  558. ### LLM_BINDING_HOST=http://localhost:11434
  559. ### LLM_MODEL=qwen3.5:9b
  560. ### OLLAMA_LLM_NUM_CTX must be provided, and should at least larger than MAX_TOTAL_TOKENS + 2000
  561. OLLAMA_LLM_NUM_CTX=32768
  562. # OLLAMA_LLM_NUM_PREDICT=9000
  563. # OLLAMA_LLM_TEMPERATURE=0.85
  564. # OLLAMA_LLM_STOP='["</s>", "<|EOT|>"]'
  565. #######################################################################################
  566. ### Embedding Configuration (Should not be changed after the first file processed)
  567. ### EMBEDDING_BINDING: ollama, openai, azure_openai, jina, lollms, bedrock
  568. ### EMBEDDING_BINDING_HOST: Service endpoint (left empty if using default endpoint provided by openai or gemini SDK)
  569. ### EMBEDDING_BINDING_API_KEY: api key
  570. ### If LightRAG deployed in Docker:
  571. ### uses host.docker.internal instead of localhost in EMBEDDING_BINDING_HOST
  572. ### Control whether to send embedding_dim parameter to embedding API
  573. ### For OpenAI: Set EMBEDDING_SEND_DIM=true to enable dynamic dimension adjustment
  574. ### For OpenAI: Set EMBEDDING_SEND_DIM=false (default) to disable sending dimension parameter
  575. ### For Gemini: Allways set EMBEDDING_SEND_DIM=true
  576. ### Control whether to use base64 encoding format for embeddings (improves performance for OpenAI)
  577. ### For OpenAI: Set EMBEDDING_USE_BASE64=true (default) to use base64 encoding
  578. ### For Yandex Cloud and other providers that don't support it: Set EMBEDDING_USE_BASE64=false
  579. #######################################################################################
  580. # EMBEDDING_TIMEOUT=30
  581. ### OpenAI compatible embedding
  582. EMBEDDING_BINDING=openai
  583. EMBEDDING_BINDING_HOST=https://api.openai.com/v1
  584. EMBEDDING_BINDING_API_KEY=your_api_key
  585. EMBEDDING_MODEL=text-embedding-3-large
  586. EMBEDDING_DIM=3072
  587. EMBEDDING_TOKEN_LIMIT=8192
  588. EMBEDDING_SEND_DIM=false
  589. EMBEDDING_USE_BASE64=true
  590. ### Optional: asymmetric embeddings (query/document behavior split)
  591. ### Leave EMBEDDING_ASYMMETRIC unset or set false to keep symmetric behavior.
  592. ### Set true only when the selected embedding backend supports asymmetric mode.
  593. # EMBEDDING_ASYMMETRIC=true
  594. ### Provider-task bindings such as Jina/Gemini/VoyageAI use provider parameters
  595. ### and should not configure the prefix variables below.
  596. ### Prefix-based models such as BGE/E5/GTE require both prefix variables.
  597. ### Wrap non-empty values with quotes if there are trailing spaces.
  598. # EMBEDDING_DOCUMENT_PREFIX="search_document: "
  599. ### Use NO_PREFIX for a side that should intentionally have no prefix.
  600. ### EMBEDDING_DOCUMENT_PREFIX=NO_PREFIX
  601. # EMBEDDING_QUERY_PREFIX="search_query: "
  602. ###########################################################################
  603. ### Provider sepecific Embedding options
  604. ### Increasing the temperature setting may help mitigate infinite inference
  605. ### loops during entity/elation extraction, particularly when using
  606. ### models with more limited capabilities, such as Qwen3-30B
  607. ### Set a max output token limit to prevent endless output from certain LLMs,
  608. ### which may trigger timeout errors during entity and relation extraction.
  609. ### max_output_token < LLM_TIMEOUT * llm_tokens_per_second
  610. ### i.e. max_output_token = 9000 = 180s * 50 tokens/s
  611. ### Sample commands to list all supported options specific EMBEDDING_BINDING:
  612. ### lightrag-server --embedding-binding openai --help
  613. ### lightrag-server --embedding-binding ollama --help
  614. ### lightrag-server --embedding-binding bedrock --help
  615. ###########################################################################
  616. ### Azure Embedding Specific Parameters:
  617. ### Use deployment name as model name or set AZURE_EMBEDDING_DEPLOYMENT instead
  618. ### EMBEDDING_BINDING=azure_openai
  619. ### EMBEDDING_BINDING_HOST=https://xxxx.openai.azure.com/
  620. ### EMBEDDING_API_KEY=your_api_key
  621. ### EMBEDDING_MODEL==my-text-embedding-3-large-deployment
  622. ### EMBEDDING_DIM=3072
  623. # AZURE_EMBEDDING_API_VERSION=2024-08-01-preview
  624. ### Ollama Embedding Specific Parameters:
  625. ### EMBEDDING_BINDING=ollama
  626. ### EMBEDDING_BINDING_HOST=http://localhost:11434
  627. ### EMBEDDING_BINDING_API_KEY=your_api_key
  628. ### EMBEDDING_MODEL=qwen3-embedding:4b
  629. ### EMBEDDING_DIM=2560
  630. ### Ollama should set num_ctx option inaddition to EMBEDDING_TOKEN_LIMIT
  631. OLLAMA_EMBEDDING_NUM_CTX=8192
  632. ### Gemini Embedding Specific Parameters:
  633. ### DEFAULT_GEMINI_ENDPOINT means selecting endpoit by SDK automatically
  634. ### Gemini embedding requires sending dimension to server
  635. ### EMBEDDING_BINDING=gemini
  636. ### EMBEDDING_BINDING_HOST=DEFAULT_GEMINI_ENDPOINT
  637. ### EMBEDDING_BINDING_API_KEY=your_api_key
  638. ### EMBEDDING_MODEL=gemini-embedding-001
  639. ### EMBEDDING_DIM=1536
  640. ### EMBEDDING_TOKEN_LIMIT=2048
  641. ### EMBEDDING_SEND_DIM=true
  642. ### Bedrock Embedding Specific Parameters:
  643. ### EMBEDDING_BINDING=bedrock
  644. ### EMBEDDING_BINDING_HOST=DEFAULT_BEDROCK_ENDPOINT
  645. ### EMBEDDING_MODEL=amazon.titan-embed-text-v2:0
  646. ### EMBEDDING_DIM=1024
  647. ### Share the same region and authentication settings as LLMs, no reconfiguration here
  648. ### AWS_REGION=us-west-1
  649. ### AWS_BEARER_TOKEN_BEDROCK=your_bedrock_api_key
  650. ### AWS_ACCESS_KEY_ID=your_aws_access_key_id
  651. ### AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key
  652. ### AWS_SESSION_TOKEN=your_optional_aws_session_token
  653. ### Jina AI Embedding Specific Parameters:
  654. ### EMBEDDING_BINDING=jina
  655. ### EMBEDDING_BINDING_HOST=https://api.jina.ai/v1/embeddings
  656. ### EMBEDDING_MODEL=jina-embeddings-v4
  657. ### EMBEDDING_DIM=2048
  658. ### EMBEDDING_BINDING_API_KEY=your_api_key
  659. ####################################################################
  660. ### WORKSPACE sets workspace name for all storage types
  661. ### for the purpose of isolating data from LightRAG instances.
  662. ### Valid workspace name constraints: a-z, A-Z, 0-9, and _
  663. ####################################################################
  664. # WORKSPACE=
  665. ############################
  666. ### Data storage selection
  667. ############################
  668. ### Default storage: JSON/Nano/NetworkX (Recommended for test deployment)
  669. LIGHTRAG_KV_STORAGE=JsonKVStorage
  670. LIGHTRAG_DOC_STATUS_STORAGE=JsonDocStatusStorage
  671. LIGHTRAG_GRAPH_STORAGE=NetworkXStorage
  672. LIGHTRAG_VECTOR_STORAGE=NanoVectorDBStorage
  673. ### Wizard metadata used to preserve env-storage Docker deployment defaults across setup reruns
  674. # LIGHTRAG_SETUP_POSTGRES_DEPLOYMENT=docker
  675. # LIGHTRAG_SETUP_NEO4J_DEPLOYMENT=docker
  676. # LIGHTRAG_SETUP_MONGODB_DEPLOYMENT=docker
  677. # LIGHTRAG_SETUP_MONGODB_DEPLOYMENT=atlas-capable
  678. # LIGHTRAG_SETUP_REDIS_DEPLOYMENT=docker
  679. # LIGHTRAG_SETUP_MILVUS_DEPLOYMENT=docker
  680. # LIGHTRAG_SETUP_QDRANT_DEPLOYMENT=docker
  681. # LIGHTRAG_SETUP_MEMGRAPH_DEPLOYMENT=docker
  682. # LIGHTRAG_SETUP_OPENSEARCH_DEPLOYMENT=docker
  683. ### PostgreSQL Configuration
  684. POSTGRES_HOST=localhost
  685. POSTGRES_PORT=5432
  686. POSTGRES_USER=your_username
  687. POSTGRES_PASSWORD='your_password'
  688. POSTGRES_DATABASE=rag
  689. POSTGRES_MAX_CONNECTIONS=25
  690. ### DB specific workspace should not be set, keep for compatible only
  691. # POSTGRES_WORKSPACE=forced_workspace_name
  692. ### Use HNSW_HALFVEC for large embeddings (2000+ dim).
  693. ### Requires pgvector extension >= 0.7.0.
  694. ### Vector storage type: HNSW, HNSW_HALFVEC, IVFFlat, VCHORDRQ
  695. POSTGRES_VECTOR_INDEX_TYPE=HNSW
  696. POSTGRES_HNSW_M=16
  697. POSTGRES_HNSW_EF=200
  698. POSTGRES_IVFFLAT_LISTS=100
  699. POSTGRES_VCHORDRQ_BUILD_OPTIONS=
  700. POSTGRES_VCHORDRQ_PROBES=
  701. POSTGRES_VCHORDRQ_EPSILON=1.9
  702. ### PostgreSQL Connection Retry Configuration (Network Robustness)
  703. ### NEW DEFAULTS (v1.4.10+): Optimized for HA deployments with ~30s switchover time
  704. ### These defaults provide out-of-the-box support for PostgreSQL High Availability setups
  705. ###
  706. ### Number of retry attempts (1-100, default: 10)
  707. ### - Default 10 attempts allows ~225s total retry time (sufficient for most HA scenarios)
  708. ### - For extreme cases: increase up to 20-50
  709. ### Initial retry backoff in seconds (0.1-300.0, default: 3.0)
  710. ### - Default 3.0s provides reasonable initial delay for switchover detection
  711. ### - For faster recovery: decrease to 1.0-2.0
  712. ### Maximum retry backoff in seconds (must be >= backoff, max: 600.0, default: 30.0)
  713. ### - Default 30.0s matches typical switchover completion time
  714. ### - For longer switchovers: increase to 60-90
  715. ### Connection pool close timeout in seconds (1.0-30.0, default: 5.0)
  716. # POSTGRES_CONNECTION_RETRIES=10
  717. # POSTGRES_CONNECTION_RETRY_BACKOFF=3.0
  718. # POSTGRES_CONNECTION_RETRY_BACKOFF_MAX=30.0
  719. # POSTGRES_POOL_CLOSE_TIMEOUT=5.0
  720. ### PostgreSQL SSL Configuration (Optional)
  721. # POSTGRES_SSL_MODE=require
  722. # POSTGRES_SSL_CERT=/path/to/client-cert.pem
  723. # POSTGRES_SSL_KEY=/path/to/client-key.pem
  724. # POSTGRES_SSL_ROOT_CERT=/path/to/ca-cert.pem
  725. # POSTGRES_SSL_CRL=/path/to/crl.pem
  726. ### PostgreSQL Server Settings (for Supabase Supavisor)
  727. # Use this to pass extra options to the PostgreSQL connection string.
  728. # For Supabase, you might need to set it like this:
  729. # POSTGRES_SERVER_SETTINGS='options=reference%3D[project-ref]'
  730. # Default is 100 set to 0 to disable
  731. # POSTGRES_STATEMENT_CACHE_SIZE=100
  732. ### Neo4j Configuration
  733. NEO4J_URI=neo4j+s://xxxxxxxx.databases.neo4j.io
  734. NEO4J_USERNAME=neo4j
  735. NEO4J_PASSWORD='your_password'
  736. NEO4J_DATABASE=neo4j
  737. NEO4J_MAX_CONNECTION_POOL_SIZE=100
  738. NEO4J_CONNECTION_TIMEOUT=30
  739. NEO4J_CONNECTION_ACQUISITION_TIMEOUT=30
  740. NEO4J_MAX_TRANSACTION_RETRY_TIME=30
  741. NEO4J_MAX_CONNECTION_LIFETIME=300
  742. NEO4J_LIVENESS_CHECK_TIMEOUT=30
  743. NEO4J_KEEP_ALIVE=true
  744. ### DB specific workspace should not be set, keep for compatible only
  745. # NEO4J_WORKSPACE=forced_workspace_name
  746. ### MongoDB Configuration
  747. # For MongoVectorDBStorage, MONGO_URI must point to a MongoDB endpoint with
  748. # Atlas Search / Vector Search support, such as MongoDB Atlas or Atlas local.
  749. MONGO_URI=mongodb://localhost:27017/
  750. MONGO_DATABASE=LightRAG
  751. ### DB specific workspace should not be set, keep for compatible only
  752. # MONGODB_WORKSPACE=forced_workspace_name
  753. # Community/local Docker MongoDB example for KV, graph, or doc-status storage only:
  754. # MONGO_URI=mongodb://localhost:27017/
  755. ### OpenSearch Configuration
  756. ### OpenSearch can be used for all storage types: KV, Vector, Graph, DocStatus
  757. ### Connection settings (comma-separated host:port entries; do not include http:// or https://)
  758. ### This setup wizard supports authenticated OpenSearch clusters only.
  759. ### OPENSEARCH_USE_SSL controls whether those hosts are reached over TLS.
  760. OPENSEARCH_HOSTS=localhost:9200
  761. OPENSEARCH_USER=admin
  762. OPENSEARCH_PASSWORD=LightRAG2026_!@
  763. OPENSEARCH_USE_SSL=true
  764. OPENSEARCH_VERIFY_CERTS=false
  765. # OPENSEARCH_TIMEOUT=30
  766. # OPENSEARCH_MAX_RETRIES=3
  767. ### Index Settings (for 3-AZ Amazon OpenSearch Service, set replicas to 2)
  768. # OPENSEARCH_NUMBER_OF_SHARDS=1
  769. # OPENSEARCH_NUMBER_OF_REPLICAS=0
  770. ### k-NN Settings for Vector Storage (HNSW algorithm)
  771. # OPENSEARCH_KNN_EF_CONSTRUCTION=200
  772. # OPENSEARCH_KNN_M=16
  773. # OPENSEARCH_KNN_EF_SEARCH=100
  774. ### PPL graphlookup for server-side graph traversal (auto-detected if not set)
  775. # OPENSEARCH_USE_PPL_GRAPHLOOKUP=true
  776. ### DB specific workspace should not be set, keep for compatible only
  777. # OPENSEARCH_WORKSPACE=forced_workspace_name
  778. ### Milvus Configuration
  779. MILVUS_URI=http://localhost:19530
  780. MILVUS_DB_NAME=lightrag
  781. # MILVUS_DEVICE=cpu
  782. # MILVUS_USER=root
  783. # MILVUS_PASSWORD=your_password
  784. # MILVUS_TOKEN=your_token
  785. # Required for the bundled Docker Milvus stack; may come from .env or exported shell variables.
  786. # MINIO_ACCESS_KEY_ID=minioadmin
  787. # MINIO_SECRET_ACCESS_KEY=minioadmin
  788. ### DB specific workspace should not be set, keep for compatible only
  789. # MILVUS_WORKSPACE=forced_workspace_name
  790. ### Milvus Vector Index Configuration
  791. ### Index type: AUTOINDEX (default), HNSW, HNSW_SQ, HNSW_PQ, IVF_FLAT, IVF_SQ8, DISKANN
  792. # MILVUS_INDEX_TYPE=AUTOINDEX
  793. ### Metric type: COSINE (default), L2, IP
  794. # MILVUS_METRIC_TYPE=COSINE
  795. ### HNSW / HNSW_SQ / HNSW_PQ Parameters (aligned with Milvus 2.4+ defaults)
  796. ### M: Maximum number of connections per node [2-2048], default 16
  797. # MILVUS_HNSW_M=16
  798. ### efConstruction: Size of dynamic candidate list during build [8-512], default 360
  799. # MILVUS_HNSW_EF_CONSTRUCTION=360
  800. ### ef: Size of dynamic candidate list during search, default 200
  801. # MILVUS_HNSW_EF=200
  802. ### HNSW_SQ Specific Parameters (requires Milvus 2.6.8+)
  803. ### sq_type: Scalar quantization type - SQ4U, SQ6, SQ8 (default), BF16, FP16
  804. # MILVUS_HNSW_SQ_TYPE=SQ8
  805. ### refine: Enable refinement step for higher precision, default false
  806. # MILVUS_HNSW_SQ_REFINE=false
  807. ### refine_type: Refinement precision (must be higher than sq_type) - SQ6, SQ8, BF16, FP16, FP32
  808. # MILVUS_HNSW_SQ_REFINE_TYPE=FP32
  809. ### refine_k: Refinement expansion factor, default 10
  810. # MILVUS_HNSW_SQ_REFINE_K=10
  811. ### IVF_FLAT / IVF_SQ8 Parameters
  812. ### nlist: Number of cluster units [1-65536], recommended sqrt(n) for n>1M, default 1024
  813. # MILVUS_IVF_NLIST=1024
  814. ### nprobe: Number of units to query [1-nlist], default 16
  815. # MILVUS_IVF_NPROBE=16
  816. ### Qdrant
  817. QDRANT_URL=http://localhost:6333
  818. # QDRANT_DEVICE=cpu
  819. # QDRANT_API_KEY=your-api-key
  820. ### Qdrant upsert batching (enabled by default)
  821. ### Split large upserts by estimated JSON payload size and point count
  822. ### Default 16MB keeps safe headroom below common 32MB gateway/request limits
  823. # QDRANT_UPSERT_MAX_PAYLOAD_BYTES=16777216
  824. # QDRANT_UPSERT_MAX_POINTS_PER_BATCH=128
  825. ### DB specific workspace should not be set, keep for compatible only
  826. # QDRANT_WORKSPACE=forced_workspace_name
  827. ### Redis
  828. REDIS_URI=redis://localhost:6379
  829. REDIS_SOCKET_TIMEOUT=30
  830. REDIS_CONNECT_TIMEOUT=10
  831. REDIS_MAX_CONNECTIONS=100
  832. REDIS_RETRY_ATTEMPTS=3
  833. ### DB specific workspace should not be set, keep for compatible only
  834. # REDIS_WORKSPACE=forced_workspace_name
  835. ### Memgraph Configuration
  836. MEMGRAPH_URI=bolt://localhost:7687
  837. MEMGRAPH_USERNAME=
  838. MEMGRAPH_PASSWORD=
  839. MEMGRAPH_DATABASE=memgraph
  840. ### DB specific workspace should not be set, keep for compatible only
  841. # MEMGRAPH_WORKSPACE=forced_workspace_name
  842. ###########################################################
  843. ### Langfuse Observability Configuration
  844. ### Only works with LLM provided by OpenAI compatible API
  845. ### Install with: pip install lightrag-hku[observability]
  846. ### Sign up at: https://cloud.langfuse.com or self-host
  847. ###########################################################
  848. # LANGFUSE_SECRET_KEY=''
  849. # LANGFUSE_PUBLIC_KEY=''
  850. # LANGFUSE_HOST='https://cloud.langfuse.com'
  851. # LANGFUSE_ENABLE_TRACE=true
  852. ############################
  853. ### Evaluation Configuration
  854. ############################
  855. ### RAGAS evaluation models (used for RAG quality assessment)
  856. ### ⚠️ IMPORTANT: Both LLM and Embedding endpoints MUST be OpenAI-compatible
  857. ### Default uses OpenAI models for evaluation
  858. ### LLM Configuration for Evaluation
  859. # EVAL_LLM_MODEL=gpt-4o-mini
  860. ### API key for LLM evaluation (fallback to OPENAI_API_KEY if not set)
  861. # EVAL_LLM_BINDING_API_KEY=your_api_key
  862. ### Custom OpenAI-compatible endpoint for LLM evaluation (optional)
  863. # EVAL_LLM_BINDING_HOST=https://api.openai.com/v1
  864. ### Embedding Configuration for Evaluation
  865. # EVAL_EMBEDDING_MODEL=text-embedding-3-large
  866. ### API key for embeddings (fallback: EVAL_LLM_BINDING_API_KEY -> OPENAI_API_KEY)
  867. # EVAL_EMBEDDING_BINDING_API_KEY=your_embedding_api_key
  868. ### Custom OpenAI-compatible endpoint for embeddings (fallback: EVAL_LLM_BINDING_HOST)
  869. # EVAL_EMBEDDING_BINDING_HOST=https://api.openai.com/v1
  870. ### Performance Tuning
  871. ### Number of concurrent test case evaluations
  872. ### Lower values reduce API rate limit issues but increase evaluation time
  873. # EVAL_MAX_CONCURRENT=2
  874. ### TOP_K query parameter of LightRAG (default: 10)
  875. ### Number of entities or relations retrieved from KG
  876. # EVAL_QUERY_TOP_K=10
  877. ### LLM request retry and timeout settings for evaluation
  878. # EVAL_LLM_MAX_RETRIES=5
  879. # EVAL_LLM_TIMEOUT=180
  880. ##########################################################################
  881. ### ----- Preserved custom environment variables from previous .env -----
  882. ### ----- Comments in this session will persist across regenerations -----
  883. ### (This must be the final session; ensure the preceding lines unchanged)
  884. ##########################################################################
  885. ### The "make env*" wizard will leave the following lines unchanged
  886. ### You may add additional env vars or commnets here for your own purpose
  887. ##########################################################################
  888. ### AWS Bedrock
  889. # LLM_BINDING=bedrock
  890. # LLM_BINDING_HOST=DEFAULT_BEDROCK_ENDPOINT
  891. # LLM_MODEL=us.anthropic.claude-haiku-4-5-20251001-v1:0
  892. ### ----- Extra setting from previous .env -----