yangdx commited on
Commit
e483865
·
1 Parent(s): 491cb6d

Remove the comments at the end of the environment variable lines in .env file

Browse files
Files changed (3) hide show
  1. env.example +38 -25
  2. lightrag/api/README-zh.md +59 -11
  3. lightrag/api/README.md +50 -71
env.example CHANGED
@@ -3,9 +3,11 @@
3
  ### Server Configuration
4
  # HOST=0.0.0.0
5
  # PORT=9621
6
- # WORKERS=1
7
- # NAMESPACE_PREFIX=lightrag # separating data from difference Lightrag instances
8
- # MAX_GRAPH_NODES=1000 # Max nodes return from grap retrieval
 
 
9
  # CORS_ORIGINS=http://localhost:3000,http://localhost:8080
10
 
11
  ### Optional SSL Configuration
@@ -13,7 +15,7 @@
13
  # SSL_CERTFILE=/path/to/cert.pem
14
  # SSL_KEYFILE=/path/to/key.pem
15
 
16
- ### Directory Configuration
17
  # WORKING_DIR=<absolute_path_for_working_dir>
18
  # INPUT_DIR=<absolute_path_for_doc_input_dir>
19
 
@@ -23,9 +25,10 @@
23
  ### Logging level
24
  # LOG_LEVEL=INFO
25
  # VERBOSE=False
26
- # LOG_DIR=/path/to/log/directory # Log file directory path, defaults to current working directory
27
- # LOG_MAX_BYTES=10485760 # Log file max size in bytes, defaults to 10MB
28
- # LOG_BACKUP_COUNT=5 # Number of backup files to keep, defaults to 5
 
29
 
30
  ### Settings for RAG query
31
  # HISTORY_TURNS=3
@@ -36,28 +39,33 @@
36
  # MAX_TOKEN_ENTITY_DESC=4000
37
 
38
  ### Settings for document indexing
39
- ENABLE_LLM_CACHE_FOR_EXTRACT=true # Enable LLM cache for entity extraction
40
  SUMMARY_LANGUAGE=English
41
  # CHUNK_SIZE=1200
42
  # CHUNK_OVERLAP_SIZE=100
43
- # MAX_TOKEN_SUMMARY=500 # Max tokens for entity or relations summary
44
- # MAX_PARALLEL_INSERT=2 # Number of parallel processing documents in one patch
45
-
46
- # EMBEDDING_BATCH_NUM=32 # num of chunks send to Embedding in one request
47
- # EMBEDDING_FUNC_MAX_ASYNC=16 # Max concurrency requests for Embedding
 
 
 
 
48
  # MAX_EMBED_TOKENS=8192
49
 
50
- ### LLM Configuration (Use valid host. For local services installed with docker, you can use host.docker.internal)
51
  TIMEOUT=150 # Time out in seconds for LLM, None for infinite timeout
52
  TEMPERATURE=0.5
53
  MAX_ASYNC=4 # Max concurrency requests of LLM
54
  MAX_TOKENS=32768 # Max tokens send to LLM (less than context size of the model)
55
 
 
56
  LLM_BINDING=ollama
57
  LLM_MODEL=mistral-nemo:latest
58
  LLM_BINDING_API_KEY=your_api_key
59
- ### Ollama example
60
  LLM_BINDING_HOST=http://localhost:11434
 
61
  ### OpenAI alike example
62
  # LLM_BINDING=openai
63
  # LLM_MODEL=gpt-4o
@@ -103,9 +111,10 @@ ORACLE_DSN=localhost:1521/XEPDB1
103
  ORACLE_USER=your_username
104
  ORACLE_PASSWORD='your_password'
105
  ORACLE_CONFIG_DIR=/path/to/oracle/config
106
- #ORACLE_WALLET_LOCATION=/path/to/wallet # optional
107
- #ORACLE_WALLET_PASSWORD='your_password' # optional
108
- #ORACLE_WORKSPACE=default # separating all data from difference Lightrag instances(deprecated, use NAMESPACE_PREFIX in future)
 
109
 
110
  ### TiDB Configuration
111
  TIDB_HOST=localhost
@@ -113,7 +122,8 @@ TIDB_PORT=4000
113
  TIDB_USER=your_username
114
  TIDB_PASSWORD='your_password'
115
  TIDB_DATABASE=your_database
116
- #TIDB_WORKSPACE=default # separating all data from difference Lightrag instances(deprecated, use NAMESPACE_PREFIX in future)
 
117
 
118
  ### PostgreSQL Configuration
119
  POSTGRES_HOST=localhost
@@ -121,7 +131,8 @@ POSTGRES_PORT=5432
121
  POSTGRES_USER=your_username
122
  POSTGRES_PASSWORD='your_password'
123
  POSTGRES_DATABASE=your_database
124
- #POSTGRES_WORKSPACE=default # separating all data from difference Lightrag instances(deprecated, use NAMESPACE_PREFIX in future)
 
125
 
126
  ### Independent AGM Configuration(not for AMG embedded in PostreSQL)
127
  AGE_POSTGRES_DB=
@@ -130,8 +141,9 @@ AGE_POSTGRES_PASSWORD=
130
  AGE_POSTGRES_HOST=
131
  # AGE_POSTGRES_PORT=8529
132
 
 
133
  # AGE Graph Name(apply to PostgreSQL and independent AGM)
134
- # AGE_GRAPH_NAME=lightrag # deprecated, use NAME_SPACE_PREFIX instead
135
 
136
  ### Neo4j Configuration
137
  NEO4J_URI=neo4j+s://xxxxxxxx.databases.neo4j.io
@@ -141,7 +153,8 @@ NEO4J_PASSWORD='your_password'
141
  ### MongoDB Configuration
142
  MONGO_URI=mongodb://root:root@localhost:27017/
143
  MONGO_DATABASE=LightRAG
144
- MONGODB_GRAPH=false # deprecated (keep for backward compatibility)
 
145
 
146
  ### Milvus Configuration
147
  MILVUS_URI=http://localhost:19530
@@ -158,9 +171,9 @@ QDRANT_URL=http://localhost:16333
158
  REDIS_URI=redis://localhost:6379
159
 
160
  ### For JWT Auth
161
- AUTH_ACCOUNTS='admin:admin123,user1:pass456' # username:password,username:password
162
- TOKEN_SECRET=Your-Key-For-LightRAG-API-Server # JWT key
163
- TOKEN_EXPIRE_HOURS=4 # expire duration
164
 
165
  ### API-Key to access LightRAG Server API
166
  # LIGHTRAG_API_KEY=your-secure-api-key-here
 
3
  ### Server Configuration
4
  # HOST=0.0.0.0
5
  # PORT=9621
6
+ # WORKERS=2
7
+ ### separating data from difference Lightrag instances
8
+ # NAMESPACE_PREFIX=lightrag
9
+ ### Max nodes return from grap retrieval
10
+ # MAX_GRAPH_NODES=1000
11
  # CORS_ORIGINS=http://localhost:3000,http://localhost:8080
12
 
13
  ### Optional SSL Configuration
 
15
  # SSL_CERTFILE=/path/to/cert.pem
16
  # SSL_KEYFILE=/path/to/key.pem
17
 
18
+ ### Directory Configuration (defaults to current working directory)
19
  # WORKING_DIR=<absolute_path_for_working_dir>
20
  # INPUT_DIR=<absolute_path_for_doc_input_dir>
21
 
 
25
  ### Logging level
26
  # LOG_LEVEL=INFO
27
  # VERBOSE=False
28
+ # LOG_MAX_BYTES=10485760
29
+ # LOG_BACKUP_COUNT=5
30
+ ### Logfile location (defaults to current working directory)
31
+ # LOG_DIR=/path/to/log/directory
32
 
33
  ### Settings for RAG query
34
  # HISTORY_TURNS=3
 
39
  # MAX_TOKEN_ENTITY_DESC=4000
40
 
41
  ### Settings for document indexing
42
+ ENABLE_LLM_CACHE_FOR_EXTRACT=true
43
  SUMMARY_LANGUAGE=English
44
  # CHUNK_SIZE=1200
45
  # CHUNK_OVERLAP_SIZE=100
46
+ ### Max tokens for entity or relations summary
47
+ # MAX_TOKEN_SUMMARY=500
48
+ ### Number of parallel processing documents in one patch
49
+ # MAX_PARALLEL_INSERT=2
50
+
51
+ ### Num of chunks send to Embedding in single request
52
+ # EMBEDDING_BATCH_NUM=32
53
+ ### Max concurrency requests for Embedding
54
+ # EMBEDDING_FUNC_MAX_ASYNC=16
55
  # MAX_EMBED_TOKENS=8192
56
 
57
+ ### LLM Configuration
58
  TIMEOUT=150 # Time out in seconds for LLM, None for infinite timeout
59
  TEMPERATURE=0.5
60
  MAX_ASYNC=4 # Max concurrency requests of LLM
61
  MAX_TOKENS=32768 # Max tokens send to LLM (less than context size of the model)
62
 
63
+ ### Ollama example (For local services installed with docker, you can use host.docker.internal as host)
64
  LLM_BINDING=ollama
65
  LLM_MODEL=mistral-nemo:latest
66
  LLM_BINDING_API_KEY=your_api_key
 
67
  LLM_BINDING_HOST=http://localhost:11434
68
+
69
  ### OpenAI alike example
70
  # LLM_BINDING=openai
71
  # LLM_MODEL=gpt-4o
 
111
  ORACLE_USER=your_username
112
  ORACLE_PASSWORD='your_password'
113
  ORACLE_CONFIG_DIR=/path/to/oracle/config
114
+ #ORACLE_WALLET_LOCATION=/path/to/wallet
115
+ #ORACLE_WALLET_PASSWORD='your_password'
116
+ ### separating all data from difference Lightrag instances(deprecating, use NAMESPACE_PREFIX in future)
117
+ #ORACLE_WORKSPACE=default
118
 
119
  ### TiDB Configuration
120
  TIDB_HOST=localhost
 
122
  TIDB_USER=your_username
123
  TIDB_PASSWORD='your_password'
124
  TIDB_DATABASE=your_database
125
+ ### separating all data from difference Lightrag instances(deprecating, use NAMESPACE_PREFIX in future)
126
+ #TIDB_WORKSPACE=default
127
 
128
  ### PostgreSQL Configuration
129
  POSTGRES_HOST=localhost
 
131
  POSTGRES_USER=your_username
132
  POSTGRES_PASSWORD='your_password'
133
  POSTGRES_DATABASE=your_database
134
+ ### separating all data from difference Lightrag instances(deprecating, use NAMESPACE_PREFIX in future)
135
+ #POSTGRES_WORKSPACE=default
136
 
137
  ### Independent AGM Configuration(not for AMG embedded in PostreSQL)
138
  AGE_POSTGRES_DB=
 
141
  AGE_POSTGRES_HOST=
142
  # AGE_POSTGRES_PORT=8529
143
 
144
+ ### separating all data from difference Lightrag instances(deprecating, use NAMESPACE_PREFIX in future)
145
  # AGE Graph Name(apply to PostgreSQL and independent AGM)
146
+ # AGE_GRAPH_NAME=lightrag
147
 
148
  ### Neo4j Configuration
149
  NEO4J_URI=neo4j+s://xxxxxxxx.databases.neo4j.io
 
153
  ### MongoDB Configuration
154
  MONGO_URI=mongodb://root:root@localhost:27017/
155
  MONGO_DATABASE=LightRAG
156
+ ### separating all data from difference Lightrag instances(deprecating, use NAMESPACE_PREFIX in future)
157
+ # MONGODB_GRAPH=false
158
 
159
  ### Milvus Configuration
160
  MILVUS_URI=http://localhost:19530
 
171
  REDIS_URI=redis://localhost:6379
172
 
173
  ### For JWT Auth
174
+ # AUTH_ACCOUNTS='admin:admin123,user1:pass456'
175
+ # TOKEN_SECRET=Your-Key-For-LightRAG-API-Server
176
+ # TOKEN_EXPIRE_HOURS=4
177
 
178
  ### API-Key to access LightRAG Server API
179
  # LIGHTRAG_API_KEY=your-secure-api-key-here
lightrag/api/README-zh.md CHANGED
@@ -52,7 +52,8 @@ LLM_BINDING=openai
52
  LLM_MODEL=gpt-4o
53
  LLM_BINDING_HOST=https://api.openai.com/v1
54
  LLM_BINDING_API_KEY=your_api_key
55
- MAX_TOKENS=32768 # 发送给 LLM 的最大 token 数(小于模型上下文大小)
 
56
 
57
  EMBEDDING_BINDING=ollama
58
  EMBEDDING_BINDING_HOST=http://localhost:11434
@@ -68,7 +69,8 @@ LLM_BINDING=ollama
68
  LLM_MODEL=mistral-nemo:latest
69
  LLM_BINDING_HOST=http://localhost:11434
70
  # LLM_BINDING_API_KEY=your_api_key
71
- MAX_TOKENS=8192 # 发送给 LLM 的最大 token 数(基于您的 Ollama 服务器容量)
 
72
 
73
  EMBEDDING_BINDING=ollama
74
  EMBEDDING_BINDING_HOST=http://localhost:11434
@@ -117,9 +119,12 @@ LightRAG 服务器可以在 `Gunicorn + Uvicorn` 预加载模式下运行。Guni
117
  虽然 LightRAG 服务器使用一个工作进程来处理文档索引流程,但通过 Uvicorn 的异步任务支持,可以并行处理多个文件。文档索引速度的瓶颈主要在于 LLM。如果您的 LLM 支持高并发,您可以通过增加 LLM 的并发级别来加速文档索引。以下是几个与并发处理相关的环境变量及其默认值:
118
 
119
  ```
120
- WORKERS=2 # 工作进程数,不大于 (2 x 核心数) + 1
121
- MAX_PARALLEL_INSERT=2 # 一批中并行处理的文件数
122
- MAX_ASYNC=4 # LLM 的最大并发请求数
 
 
 
123
  ```
124
 
125
  ### 将 Lightrag 安装为 Linux 服务
@@ -201,9 +206,9 @@ LightRAG API 服务器使用基于 HS256 算法的 JWT 认证。要启用安全
201
 
202
  ```bash
203
  # JWT 认证
204
- AUTH_ACCOUNTS='admin:admin123,user1:pass456' # 登录帐号与密码
205
- TOKEN_SECRET=your-key # JWT 密钥
206
- TOKEN_EXPIRE_HOURS=4 # 过期时间
207
  ```
208
 
209
  > 目前仅支持配置一个管理员账户和密码。尚未开发和实现完整的账户系统。
@@ -237,8 +242,11 @@ LLM_BINDING=azure_openai
237
  LLM_BINDING_HOST=your-azure-endpoint
238
  LLM_MODEL=your-model-deployment-name
239
  LLM_BINDING_API_KEY=your-azure-api-key
240
- AZURE_OPENAI_API_VERSION=2024-08-01-preview # 可选,默认为最新版本
241
- EMBEDDING_BINDING=azure_openai # 如果使用 Azure OpenAI 进行嵌入
 
 
 
242
  EMBEDDING_MODEL=your-embedding-deployment-name
243
  ```
244
 
@@ -361,7 +369,47 @@ LIGHTRAG_DOC_STATUS_STORAGE=PGDocStatusStorage
361
  | --embedding-binding | ollama | 嵌入绑定类型(lollms、ollama、openai、azure_openai) |
362
  | auto-scan-at-startup | - | 扫描输入目录中的新文件并开始索引 |
363
 
364
- ### 使用示例
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
365
 
366
  #### 使用 ollama 默认本地服务器作为 llm 和嵌入后端运行 Lightrag 服务器
367
 
 
52
  LLM_MODEL=gpt-4o
53
  LLM_BINDING_HOST=https://api.openai.com/v1
54
  LLM_BINDING_API_KEY=your_api_key
55
+ ### 发送给 LLM 的最大 token 数(小于模型上下文大小)
56
+ MAX_TOKENS=32768
57
 
58
  EMBEDDING_BINDING=ollama
59
  EMBEDDING_BINDING_HOST=http://localhost:11434
 
69
  LLM_MODEL=mistral-nemo:latest
70
  LLM_BINDING_HOST=http://localhost:11434
71
  # LLM_BINDING_API_KEY=your_api_key
72
+ ### 发送给 LLM 的最大 token 数(基于您的 Ollama 服务器容量)
73
+ MAX_TOKENS=8192
74
 
75
  EMBEDDING_BINDING=ollama
76
  EMBEDDING_BINDING_HOST=http://localhost:11434
 
119
  虽然 LightRAG 服务器使用一个工作进程来处理文档索引流程,但通过 Uvicorn 的异步任务支持,可以并行处理多个文件。文档索引速度的瓶颈主要在于 LLM。如果您的 LLM 支持高并发,您可以通过增加 LLM 的并发级别来加速文档索引。以下是几个与并发处理相关的环境变量及其默认值:
120
 
121
  ```
122
+ ### 工作进程数,数字不大于 (2 x 核心数) + 1
123
+ WORKERS=2
124
+ ### 一批中并行处理的文件数
125
+ MAX_PARALLEL_INSERT=2
126
+ # LLM 的最大并发请求数
127
+ MAX_ASYNC=4
128
  ```
129
 
130
  ### 将 Lightrag 安装为 Linux 服务
 
206
 
207
  ```bash
208
  # JWT 认证
209
+ AUTH_ACCOUNTS='admin:admin123,user1:pass456'
210
+ TOKEN_SECRET='your-key'
211
+ TOKEN_EXPIRE_HOURS=4
212
  ```
213
 
214
  > 目前仅支持配置一个管理员账户和密码。尚未开发和实现完整的账户系统。
 
242
  LLM_BINDING_HOST=your-azure-endpoint
243
  LLM_MODEL=your-model-deployment-name
244
  LLM_BINDING_API_KEY=your-azure-api-key
245
+ ### API Version可选,默认为最新版本
246
+ AZURE_OPENAI_API_VERSION=2024-08-01-preview
247
+
248
+ ### 如果使用 Azure OpenAI 进行嵌入
249
+ EMBEDDING_BINDING=azure_openai
250
  EMBEDDING_MODEL=your-embedding-deployment-name
251
  ```
252
 
 
369
  | --embedding-binding | ollama | 嵌入绑定类型(lollms、ollama、openai、azure_openai) |
370
  | auto-scan-at-startup | - | 扫描输入目录中的新文件并开始索引 |
371
 
372
+ ### .env 文件示例
373
+
374
+ ```bash
375
+ ### Server Configuration
376
+ # HOST=0.0.0.0
377
+ PORT=9621
378
+ WORKERS=2
379
+
380
+ ### Settings for document indexing
381
+ ENABLE_LLM_CACHE_FOR_EXTRACT=true
382
+ SUMMARY_LANGUAGE=Chinese
383
+ MAX_PARALLEL_INSERT=2
384
+
385
+ ### LLM Configuration (Use valid host. For local services installed with docker, you can use host.docker.internal)
386
+ TIMEOUT=200
387
+ TEMPERATURE=0.0
388
+ MAX_ASYNC=4
389
+ MAX_TOKENS=32768
390
+
391
+ LLM_BINDING=openai
392
+ LLM_MODEL=gpt-4o-mini
393
+ LLM_BINDING_HOST=https://api.openai.com/v1
394
+ LLM_BINDING_API_KEY=your-api-key
395
+
396
+ ### Embedding Configuration (Use valid host. For local services installed with docker, you can use host.docker.internal)
397
+ EMBEDDING_MODEL=bge-m3:latest
398
+ EMBEDDING_DIM=1024
399
+ EMBEDDING_BINDING=ollama
400
+ EMBEDDING_BINDING_HOST=http://localhost:11434
401
+
402
+ ### For JWT Auth
403
+ # AUTH_ACCOUNTS='admin:admin123,user1:pass456'
404
+ # TOKEN_SECRET=your-key-for-LightRAG-API-Server-xxx
405
+ # TOKEN_EXPIRE_HOURS=48
406
+
407
+ # LIGHTRAG_API_KEY=your-secure-api-key-here-123
408
+ # WHITELIST_PATHS=/api/*
409
+ # WHITELIST_PATHS=/health,/api/*
410
+ ```
411
+
412
+
413
 
414
  #### 使用 ollama 默认本地服务器作为 llm 和嵌入后端运行 Lightrag 服务器
415
 
lightrag/api/README.md CHANGED
@@ -52,7 +52,8 @@ LLM_BINDING=openai
52
  LLM_MODEL=gpt-4o
53
  LLM_BINDING_HOST=https://api.openai.com/v1
54
  LLM_BINDING_API_KEY=your_api_key
55
- MAX_TOKENS=32768 # Max tokens send to LLM (less than model context size)
 
56
 
57
  EMBEDDING_BINDING=ollama
58
  EMBEDDING_BINDING_HOST=http://localhost:11434
@@ -68,7 +69,8 @@ LLM_BINDING=ollama
68
  LLM_MODEL=mistral-nemo:latest
69
  LLM_BINDING_HOST=http://localhost:11434
70
  # LLM_BINDING_API_KEY=your_api_key
71
- MAX_TOKENS=8192 # Max tokens send to LLM (base on your Ollama Server capacity)
 
72
 
73
  EMBEDDING_BINDING=ollama
74
  EMBEDDING_BINDING_HOST=http://localhost:11434
@@ -121,9 +123,12 @@ The LightRAG Server can operate in the `Gunicorn + Uvicorn` preload mode. Gunico
121
  Though LightRAG Server uses one workers to process the document indexing pipeline, with aysnc task supporting of Uvicorn, multiple files can be processed in parallell. The bottleneck of document indexing speed mainly lies with the LLM. If your LLM supports high concurrency, you can accelerate document indexing by increasing the concurrency level of the LLM. Below are several environment variables related to concurrent processing, along with their default values:
122
 
123
  ```
124
- WORKERS=2 # Num of worker processes, not greater then (2 x number_of_cores) + 1
125
- MAX_PARALLEL_INSERT=2 # Num of parallel files to process in one batch
126
- MAX_ASYNC=4 # Max concurrency requests of LLM
 
 
 
127
  ```
128
 
129
  ### Install Lightrag as a Linux Service
@@ -207,9 +212,9 @@ LightRAG API Server implements JWT-based authentication using HS256 algorithm. T
207
 
208
  ```bash
209
  # For jwt auth
210
- AUTH_ACCOUNTS='admin:admin123,user1:pass456' # login name and password, separated by comma
211
- TOKEN_SECRET=your-key # JWT key
212
- TOKEN_EXPIRE_HOURS=4 # expire duration
213
  ```
214
 
215
  > Currently, only the configuration of an administrator account and password is supported. A comprehensive account system is yet to be developed and implemented.
@@ -246,10 +251,12 @@ LLM_BINDING=azure_openai
246
  LLM_BINDING_HOST=your-azure-endpoint
247
  LLM_MODEL=your-model-deployment-name
248
  LLM_BINDING_API_KEY=your-azure-api-key
249
- AZURE_OPENAI_API_VERSION=2024-08-01-preview # optional, defaults to latest version
250
- EMBEDDING_BINDING=azure_openai # if using Azure OpenAI for embeddings
251
- EMBEDDING_MODEL=your-embedding-deployment-name
252
 
 
 
 
253
  ```
254
 
255
 
@@ -373,76 +380,48 @@ You can not change storage implementation selection after you add documents to L
373
  | --embedding-binding | ollama | Embedding binding type (lollms, ollama, openai, azure_openai) |
374
  | auto-scan-at-startup | - | Scan input directory for new files and start indexing |
375
 
376
- ### Example Usage
377
-
378
- #### Running a Lightrag server with ollama default local server as llm and embedding backends
379
-
380
- Ollama is the default backend for both llm and embedding, so by default you can run lightrag-server with no parameters and the default ones will be used. Make sure ollama is installed and is running and default models are already installed on ollama.
381
 
382
  ```bash
383
- # Run lightrag with ollama, mistral-nemo:latest for llm, and bge-m3:latest for embedding
384
- lightrag-server
385
-
386
- # Using an authentication key
387
- lightrag-server --key my-key
388
- ```
389
-
390
- #### Running a Lightrag server with lollms default local server as llm and embedding backends
 
 
 
 
 
 
 
391
 
392
- ```bash
393
- # Run lightrag with lollms, mistral-nemo:latest for llm, and bge-m3:latest for embedding
394
- # Configure LLM_BINDING=lollms and EMBEDDING_BINDING=lollms in .env or config.ini
395
- lightrag-server
396
-
397
- # Using an authentication key
398
- lightrag-server --key my-key
399
- ```
400
-
401
- #### Running a Lightrag server with openai server as llm and embedding backends
402
-
403
- ```bash
404
- # Run lightrag with openai, GPT-4o-mini for llm, and text-embedding-3-small for embedding
405
- # Configure in .env or config.ini:
406
- # LLM_BINDING=openai
407
- # LLM_MODEL=GPT-4o-mini
408
- # EMBEDDING_BINDING=openai
409
- # EMBEDDING_MODEL=text-embedding-3-small
410
- lightrag-server
411
 
412
- # Using an authentication key
413
- lightrag-server --key my-key
414
- ```
 
 
415
 
416
- #### Running a Lightrag server with azure openai server as llm and embedding backends
 
 
 
417
 
418
- ```bash
419
- # Run lightrag with azure_openai
420
- # Configure in .env or config.ini:
421
- # LLM_BINDING=azure_openai
422
- # LLM_MODEL=your-model
423
- # EMBEDDING_BINDING=azure_openai
424
- # EMBEDDING_MODEL=your-embedding-model
425
- lightrag-server
426
 
427
- # Using an authentication key
428
- lightrag-server --key my-key
429
  ```
430
 
431
- **Important Notes:**
432
- - For LoLLMs: Make sure the specified models are installed in your LoLLMs instance
433
- - For Ollama: Make sure the specified models are installed in your Ollama instance
434
- - For OpenAI: Ensure you have set up your OPENAI_API_KEY environment variable
435
- - For Azure OpenAI: Build and configure your server as stated in the Prequisites section
436
 
437
- For help on any server, use the --help flag:
438
- ```bash
439
- lightrag-server --help
440
- ```
441
-
442
- Note: If you don't need the API functionality, you can install the base package without API support using:
443
- ```bash
444
- pip install lightrag-hku
445
- ```
446
 
447
  ## API Endpoints
448
 
 
52
  LLM_MODEL=gpt-4o
53
  LLM_BINDING_HOST=https://api.openai.com/v1
54
  LLM_BINDING_API_KEY=your_api_key
55
+ ### Max tokens send to LLM (less than model context size)
56
+ MAX_TOKENS=32768
57
 
58
  EMBEDDING_BINDING=ollama
59
  EMBEDDING_BINDING_HOST=http://localhost:11434
 
69
  LLM_MODEL=mistral-nemo:latest
70
  LLM_BINDING_HOST=http://localhost:11434
71
  # LLM_BINDING_API_KEY=your_api_key
72
+ ### Max tokens send to LLM (base on your Ollama Server capacity)
73
+ MAX_TOKENS=8192
74
 
75
  EMBEDDING_BINDING=ollama
76
  EMBEDDING_BINDING_HOST=http://localhost:11434
 
123
  Though LightRAG Server uses one workers to process the document indexing pipeline, with aysnc task supporting of Uvicorn, multiple files can be processed in parallell. The bottleneck of document indexing speed mainly lies with the LLM. If your LLM supports high concurrency, you can accelerate document indexing by increasing the concurrency level of the LLM. Below are several environment variables related to concurrent processing, along with their default values:
124
 
125
  ```
126
+ ### Num of worker processes, not greater then (2 x number_of_cores) + 1
127
+ WORKERS=2
128
+ ### Num of parallel files to process in one batch
129
+ MAX_PARALLEL_INSERT=2
130
+ ### Max concurrency requests of LLM
131
+ MAX_ASYNC=4
132
  ```
133
 
134
  ### Install Lightrag as a Linux Service
 
212
 
213
  ```bash
214
  # For jwt auth
215
+ AUTH_ACCOUNTS='admin:admin123,user1:pass456'
216
+ TOKEN_SECRET='your-key'
217
+ TOKEN_EXPIRE_HOURS=4
218
  ```
219
 
220
  > Currently, only the configuration of an administrator account and password is supported. A comprehensive account system is yet to be developed and implemented.
 
251
  LLM_BINDING_HOST=your-azure-endpoint
252
  LLM_MODEL=your-model-deployment-name
253
  LLM_BINDING_API_KEY=your-azure-api-key
254
+ ### API version is optional, defaults to latest version
255
+ AZURE_OPENAI_API_VERSION=2024-08-01-preview
 
256
 
257
+ ### if using Azure OpenAI for embeddings
258
+ EMBEDDING_BINDING=azure_openai
259
+ EMBEDDING_MODEL=your-embedding-deployment-name
260
  ```
261
 
262
 
 
380
  | --embedding-binding | ollama | Embedding binding type (lollms, ollama, openai, azure_openai) |
381
  | auto-scan-at-startup | - | Scan input directory for new files and start indexing |
382
 
383
+ ### .env Examples
 
 
 
 
384
 
385
  ```bash
386
+ ### Server Configuration
387
+ # HOST=0.0.0.0
388
+ PORT=9621
389
+ WORKERS=2
390
+
391
+ ### Settings for document indexing
392
+ ENABLE_LLM_CACHE_FOR_EXTRACT=true
393
+ SUMMARY_LANGUAGE=Chinese
394
+ MAX_PARALLEL_INSERT=2
395
+
396
+ ### LLM Configuration (Use valid host. For local services installed with docker, you can use host.docker.internal)
397
+ TIMEOUT=200
398
+ TEMPERATURE=0.0
399
+ MAX_ASYNC=4
400
+ MAX_TOKENS=32768
401
 
402
+ LLM_BINDING=openai
403
+ LLM_MODEL=gpt-4o-mini
404
+ LLM_BINDING_HOST=https://api.openai.com/v1
405
+ LLM_BINDING_API_KEY=your-api-key
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
406
 
407
+ ### Embedding Configuration (Use valid host. For local services installed with docker, you can use host.docker.internal)
408
+ EMBEDDING_MODEL=bge-m3:latest
409
+ EMBEDDING_DIM=1024
410
+ EMBEDDING_BINDING=ollama
411
+ EMBEDDING_BINDING_HOST=http://localhost:11434
412
 
413
+ ### For JWT Auth
414
+ # AUTH_ACCOUNTS='admin:admin123,user1:pass456'
415
+ # TOKEN_SECRET=your-key-for-LightRAG-API-Server-xxx
416
+ # TOKEN_EXPIRE_HOURS=48
417
 
418
+ # LIGHTRAG_API_KEY=your-secure-api-key-here-123
419
+ # WHITELIST_PATHS=/api/*
420
+ # WHITELIST_PATHS=/health,/api/*
 
 
 
 
 
421
 
 
 
422
  ```
423
 
 
 
 
 
 
424
 
 
 
 
 
 
 
 
 
 
425
 
426
  ## API Endpoints
427