diff --git a/env.example b/env.example index 41b5d629..5bbcfac3 100644 --- a/env.example +++ b/env.example @@ -1,6 +1,8 @@ ### This is sample file of .env +########################### ### Server Configuration +########################### HOST=0.0.0.0 PORT=9621 WEBUI_TITLE='My Graph KB' @@ -9,29 +11,17 @@ OLLAMA_EMULATING_MODEL_TAG=latest # WORKERS=2 # CORS_ORIGINS=http://localhost:3000,http://localhost:8080 -### Login Configuration -# AUTH_ACCOUNTS='admin:admin123,user1:pass456' -# TOKEN_SECRET=Your-Key-For-LightRAG-API-Server -# TOKEN_EXPIRE_HOURS=48 -# GUEST_TOKEN_EXPIRE_HOURS=24 -# JWT_ALGORITHM=HS256 - -### API-Key to access LightRAG Server API -# LIGHTRAG_API_KEY=your-secure-api-key-here -# WHITELIST_PATHS=/health,/api/* - ### Optional SSL Configuration # SSL=true # SSL_CERTFILE=/path/to/cert.pem # SSL_KEYFILE=/path/to/key.pem ### Directory Configuration (defaults to current working directory) -### Should not be set if deploy by docker (Set by Dockerfile instead of .env) ### Default value is ./inputs and ./rag_storage # INPUT_DIR= # WORKING_DIR= -### Max nodes return from grap retrieval +### Max nodes return from grap retrieval in webui # MAX_GRAPH_NODES=1000 ### Logging level @@ -42,68 +32,95 @@ OLLAMA_EMULATING_MODEL_TAG=latest ### Logfile location (defaults to current working directory) # LOG_DIR=/path/to/log/directory -### RAG Configuration -### Chunk size for document splitting, 500~1500 is recommended -# CHUNK_SIZE=1200 -# CHUNK_OVERLAP_SIZE=100 +##################################### +### Login and API-Key Configuration +##################################### +# AUTH_ACCOUNTS='admin:admin123,user1:pass456' +# TOKEN_SECRET=Your-Key-For-LightRAG-API-Server +# TOKEN_EXPIRE_HOURS=48 +# GUEST_TOKEN_EXPIRE_HOURS=24 +# JWT_ALGORITHM=HS256 -### RAG Query Configuration +### API-Key to access LightRAG Server API +# LIGHTRAG_API_KEY=your-secure-api-key-here +# WHITELIST_PATHS=/health,/api/* + +######################## +### Query Configuration +######################## +# LLM responde cache for query (Not valid for streaming response +ENABLE_LLM_CACHE=true # HISTORY_TURNS=3 - -### These parameters provide more precise control over total token usage +# COSINE_THRESHOLD=0.2 +### Number of entities or relations retrieved from KG +# TOP_K=40 +### Maxmium number or chunks plan to send to LLM +# CHUNK_TOP_K=10 +### control the actual enties send to LLM # MAX_ENTITY_TOKENS=10000 +### control the actual relations send to LLM # MAX_RELATION_TOKENS=10000 +### control the maximum tokens send to LLM (include entities, raltions and chunks) # MAX_TOTAL_TOKENS=32000 -# COSINE_THRESHOLD=0.2 -### Number of entities or relations to retrieve from KG -# TOP_K=40 -### Number of text chunks to retrieve initially from vector search and keep after reranking -# CHUNK_TOP_K=10 - -### Enable reranking for retrieved text chunks (default: true) -# ENABLE_RERANK=true - -### Rerank Configuration -### Rerank model configuration (required when enable_rerank=true in query parameters) +### Reranker configuration (Set ENABLE_RERANK to true in reranking model is configed) +ENABLE_RERANK=False # RERANK_MODEL=BAAI/bge-reranker-v2-m3 # RERANK_BINDING_HOST=https://api.your-rerank-provider.com/v1/rerank # RERANK_BINDING_API_KEY=your_rerank_api_key_here -### Entity and relation summarization configuration +######################################## +### Document processing configuration +######################################## ### Language: English, Chinese, French, German ... SUMMARY_LANGUAGE=English +ENABLE_LLM_CACHE_FOR_EXTRACT=true +### MAX_TOKENS: max tokens send to LLM for entity relation summaries (less than context size of the model) +MAX_TOKENS=32000 +### Chunk size for document splitting, 500~1500 is recommended +# CHUNK_SIZE=1200 +# CHUNK_OVERLAP_SIZE=100 +### Entity and relation summarization configuration ### Number of duplicated entities/edges to trigger LLM re-summary on merge ( at least 3 is recommented) -# FORCE_LLM_SUMMARY_ON_MERGE=6 +# FORCE_LLM_SUMMARY_ON_MERGE=4 ### Maximum number of entity extraction attempts for ambiguous content # MAX_GLEANING=1 -### Number of parallel processing documents(Less than MAX_ASYNC/2 is recommended) -# MAX_PARALLEL_INSERT=2 +############################### +### Concurrency Configuration +############################### +### Max concurrency requests of LLM (for both query and document processing) +MAX_ASYNC=4 +### Number of parallel processing documents(between 2~10, MAX_ASYNC/4 is recommended) +MAX_PARALLEL_INSERT=2 +### Max concurrency requests for Embedding +# EMBEDDING_FUNC_MAX_ASYNC=8 +### Num of chunks send to Embedding in single request +# EMBEDDING_BATCH_NUM=10 +####################### ### LLM Configuration -ENABLE_LLM_CACHE=true -ENABLE_LLM_CACHE_FOR_EXTRACT=true +####################### ### Time out in seconds for LLM, None for infinite timeout TIMEOUT=240 ### Some models like o1-mini require temperature to be set to 1 TEMPERATURE=0 -### Max concurrency requests of LLM -MAX_ASYNC=4 -### MAX_TOKENS: max tokens send to LLM for entity relation summaries (less than context size of the model) -MAX_TOKENS=32000 ### LLM Binding type: openai, ollama, lollms, azure_openai LLM_BINDING=openai LLM_MODEL=gpt-4o LLM_BINDING_HOST=https://api.openai.com/v1 LLM_BINDING_API_KEY=your_api_key + +### Set as num_ctx option for Ollama LLM +# OLLAMA_NUM_CTX=32768 + ### Optional for Azure # AZURE_OPENAI_API_VERSION=2024-08-01-preview # AZURE_OPENAI_DEPLOYMENT=gpt-4o -### set as num_ctx option for Ollama LLM -# OLLAMA_NUM_CTX=32768 -### Embedding Configuration +#################################################################################### +### Embedding Configuration (Should not be changed after the first file processed) +#################################################################################### ### Embedding Binding type: openai, ollama, lollms, azure_openai EMBEDDING_BINDING=ollama EMBEDDING_MODEL=bge-m3:latest @@ -111,51 +128,53 @@ EMBEDDING_DIM=1024 EMBEDDING_BINDING_API_KEY=your_api_key # If the embedding service is deployed within the same Docker stack, use host.docker.internal instead of localhost EMBEDDING_BINDING_HOST=http://localhost:11434 -### Num of chunks send to Embedding in single request -# EMBEDDING_BATCH_NUM=10 -### Max concurrency requests for Embedding -# EMBEDDING_FUNC_MAX_ASYNC=8 ### Maximum tokens sent to Embedding for each chunk (no longer in use?) # MAX_EMBED_TOKENS=8192 + ### Optional for Azure # AZURE_EMBEDDING_DEPLOYMENT=text-embedding-3-large # AZURE_EMBEDDING_API_VERSION=2023-05-15 # AZURE_EMBEDDING_ENDPOINT=your_endpoint # AZURE_EMBEDDING_API_KEY=your_api_key -########################### +############################ ### Data storage selection -########################### -### In-memory database with local file persistence(Recommended for small scale deployment) +############################ +### Default storage (Recommended for small scale deployment) # LIGHTRAG_KV_STORAGE=JsonKVStorage # LIGHTRAG_DOC_STATUS_STORAGE=JsonDocStatusStorage # LIGHTRAG_GRAPH_STORAGE=NetworkXStorage # LIGHTRAG_VECTOR_STORAGE=NanoVectorDBStorage + +### Redis Storage (Recommended for production deployment) +# LIGHTRAG_KV_STORAGE=RedisKVStorage +# LIGHTRAG_DOC_STATUS_STORAGE=RedisDocStatusStorage + +### Vector Storage (Recommended for production deployment) +# LIGHTRAG_VECTOR_STORAGE=MilvusVectorDBStorage +# LIGHTRAG_VECTOR_STORAGE=QdrantVectorDBStorage # LIGHTRAG_VECTOR_STORAGE=FaissVectorDBStorage + +### Graph Storage (Recommended for production deployment) +# LIGHTRAG_GRAPH_STORAGE=Neo4JStorage +# LIGHTRAG_GRAPH_STORAGE=MemgraphStorage + ### PostgreSQL # LIGHTRAG_KV_STORAGE=PGKVStorage # LIGHTRAG_DOC_STATUS_STORAGE=PGDocStatusStorage # LIGHTRAG_GRAPH_STORAGE=PGGraphStorage # LIGHTRAG_VECTOR_STORAGE=PGVectorStorage + ### MongoDB (Vector storage only available on Atlas Cloud) # LIGHTRAG_KV_STORAGE=MongoKVStorage # LIGHTRAG_DOC_STATUS_STORAGE=MongoDocStatusStorage # LIGHTRAG_GRAPH_STORAGE=MongoGraphStorage # LIGHTRAG_VECTOR_STORAGE=MongoVectorDBStorage -### Redis Storage (Recommended for production deployment) -# LIGHTRAG_KV_STORAGE=RedisKVStorage -# LIGHTRAG_DOC_STATUS_STORAGE=RedisDocStatusStorage -### Vector Storage (Recommended for production deployment) -# LIGHTRAG_VECTOR_STORAGE=MilvusVectorDBStorage -# LIGHTRAG_VECTOR_STORAGE=QdrantVectorDBStorage -### Graph Storage (Recommended for production deployment) -# LIGHTRAG_GRAPH_STORAGE=Neo4JStorage -# LIGHTRAG_GRAPH_STORAGE=MemgraphStorage #################################################################### -### Default workspace for all storage types -### For the purpose of isolation of data for each LightRAG instance -### Valid characters: a-z, A-Z, 0-9, and _ +### WORKSPACE setting workspace name for all storage types +### in the purpose of isolating data from LightRAG instances. +### Valid workspace name constraints: a-z, A-Z, 0-9, and _ #################################################################### # WORKSPACE=space1