yangdx
commited on
Commit
·
78289f5
1
Parent(s):
610f833
Add configuration examples for Oracle, TiDB, PostgreSQL and storage backends
Browse files- .env.example +40 -1
- config.ini.example +25 -0
- lightrag/api/README.md +69 -48
.env.example
CHANGED
@@ -72,6 +72,45 @@ LOG_LEVEL=INFO
|
|
72 |
# AZURE_EMBEDDING_DEPLOYMENT=text-embedding-3-large
|
73 |
# AZURE_EMBEDDING_API_VERSION=2023-05-15
|
74 |
|
75 |
-
|
76 |
# Ollama Emulating Model Tag
|
77 |
# OLLAMA_EMULATING_MODEL_TAG=latest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
# AZURE_EMBEDDING_DEPLOYMENT=text-embedding-3-large
|
73 |
# AZURE_EMBEDDING_API_VERSION=2023-05-15
|
74 |
|
|
|
75 |
# Ollama Emulating Model Tag
|
76 |
# OLLAMA_EMULATING_MODEL_TAG=latest
|
77 |
+
|
78 |
+
# Oracle Database Configuration
|
79 |
+
ORACLE_DSN=localhost:1521/XEPDB1
|
80 |
+
ORACLE_USER=your_username
|
81 |
+
ORACLE_PASSWORD=your_password
|
82 |
+
ORACLE_CONFIG_DIR=/path/to/oracle/config
|
83 |
+
ORACLE_WALLET_LOCATION=/path/to/wallet # 可选
|
84 |
+
ORACLE_WALLET_PASSWORD=your_wallet_password # 可选
|
85 |
+
ORACLE_WORKSPACE=default # 可选,默认为default
|
86 |
+
|
87 |
+
# TiDB Configuration
|
88 |
+
TIDB_HOST=localhost
|
89 |
+
TIDB_PORT=4000
|
90 |
+
TIDB_USER=your_username
|
91 |
+
TIDB_PASSWORD=your_password
|
92 |
+
TIDB_DATABASE=your_database
|
93 |
+
TIDB_WORKSPACE=default # 可选,默认为default
|
94 |
+
|
95 |
+
# PostgreSQL Configuration
|
96 |
+
POSTGRES_HOST=localhost
|
97 |
+
POSTGRES_PORT=5432
|
98 |
+
POSTGRES_USER=your_username
|
99 |
+
POSTGRES_PASSWORD=your_password
|
100 |
+
POSTGRES_DATABASE=your_database
|
101 |
+
POSTGRES_WORKSPACE=default # 可选,默认为default
|
102 |
+
|
103 |
+
# Database Configurations
|
104 |
+
# Neo4j
|
105 |
+
NEO4J_URI=neo4j+s://xxxxxxxx.databases.neo4j.io
|
106 |
+
NEO4J_USERNAME=neo4j
|
107 |
+
NEO4J_PASSWORD=your-password
|
108 |
+
|
109 |
+
# MongoDB (可选)
|
110 |
+
MONGODB_URI=mongodb+srv://name:password@your-cluster-address
|
111 |
+
MONGODB_DATABASE=lightrag
|
112 |
+
MONGODB_GRAPH=false
|
113 |
+
|
114 |
+
# Qdrant
|
115 |
+
QDRANT_URL=http://localhost:16333
|
116 |
+
QDRANT_API_KEY=your-api-key # 可选
|
config.ini.example
CHANGED
@@ -13,3 +13,28 @@ uri=redis://localhost:6379/1
|
|
13 |
|
14 |
[qdrant]
|
15 |
uri = http://localhost:16333
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
[qdrant]
|
15 |
uri = http://localhost:16333
|
16 |
+
|
17 |
+
[oracle]
|
18 |
+
dsn = localhost:1521/XEPDB1
|
19 |
+
user = your_username
|
20 |
+
password = your_password
|
21 |
+
config_dir = /path/to/oracle/config
|
22 |
+
wallet_location = /path/to/wallet # 可选
|
23 |
+
wallet_password = your_wallet_password # 可选
|
24 |
+
workspace = default # 可选,默认为default
|
25 |
+
|
26 |
+
[tidb]
|
27 |
+
host = localhost
|
28 |
+
port = 4000
|
29 |
+
user = your_username
|
30 |
+
password = your_password
|
31 |
+
database = your_database
|
32 |
+
workspace = default # 可选,默认为default
|
33 |
+
|
34 |
+
[postgres]
|
35 |
+
host = localhost
|
36 |
+
port = 5432
|
37 |
+
user = your_username
|
38 |
+
password = your_password
|
39 |
+
database = your_database
|
40 |
+
workspace = default # 可选,默认为default
|
lightrag/api/README.md
CHANGED
@@ -107,62 +107,19 @@ For better performance, the API server's default values for TOP_K and COSINE_THR
|
|
107 |
|
108 |
### Environment Variables
|
109 |
|
110 |
-
You can configure LightRAG using environment variables by creating a `.env` file in your project root directory.
|
111 |
|
112 |
-
|
113 |
-
# Server Configuration
|
114 |
-
HOST=0.0.0.0
|
115 |
-
PORT=9621
|
116 |
|
117 |
-
|
118 |
-
WORKING_DIR=/app/data/rag_storage
|
119 |
-
INPUT_DIR=/app/data/inputs
|
120 |
-
|
121 |
-
# RAG Configuration
|
122 |
-
MAX_ASYNC=4
|
123 |
-
MAX_TOKENS=32768
|
124 |
-
EMBEDDING_DIM=1024
|
125 |
-
MAX_EMBED_TOKENS=8192
|
126 |
-
#HISTORY_TURNS=3
|
127 |
-
#CHUNK_SIZE=1200
|
128 |
-
#CHUNK_OVERLAP_SIZE=100
|
129 |
-
#COSINE_THRESHOLD=0.4
|
130 |
-
#TOP_K=50
|
131 |
-
|
132 |
-
# LLM Configuration
|
133 |
-
LLM_BINDING=ollama
|
134 |
-
LLM_BINDING_HOST=http://localhost:11434
|
135 |
-
LLM_MODEL=mistral-nemo:latest
|
136 |
-
|
137 |
-
# must be set if using OpenAI LLM (LLM_MODEL must be set or set by command line parms)
|
138 |
-
OPENAI_API_KEY=you_api_key
|
139 |
-
|
140 |
-
# Embedding Configuration
|
141 |
-
EMBEDDING_BINDING=ollama
|
142 |
-
EMBEDDING_BINDING_HOST=http://localhost:11434
|
143 |
-
EMBEDDING_MODEL=bge-m3:latest
|
144 |
-
|
145 |
-
# Security
|
146 |
-
#LIGHTRAG_API_KEY=you-api-key-for-accessing-LightRAG
|
147 |
-
|
148 |
-
# Logging
|
149 |
-
LOG_LEVEL=INFO
|
150 |
-
|
151 |
-
# Optional SSL Configuration
|
152 |
-
#SSL=true
|
153 |
-
#SSL_CERTFILE=/path/to/cert.pem
|
154 |
-
#SSL_KEYFILE=/path/to/key.pem
|
155 |
-
|
156 |
-
# Optional Timeout
|
157 |
-
#TIMEOUT=30
|
158 |
-
```
|
159 |
|
160 |
### Configuration Priority
|
161 |
|
162 |
The configuration values are loaded in the following order (highest priority first):
|
163 |
1. Command-line arguments
|
164 |
2. Environment variables
|
165 |
-
3.
|
|
|
166 |
|
167 |
For example:
|
168 |
```bash
|
@@ -173,6 +130,66 @@ python lightrag.py --port 8080
|
|
173 |
PORT=7000 python lightrag.py
|
174 |
```
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
#### LightRag Server Options
|
177 |
|
178 |
| Parameter | Default | Description |
|
@@ -200,6 +217,10 @@ PORT=7000 python lightrag.py
|
|
200 |
| --ssl-keyfile | None | Path to SSL private key file (required if --ssl is enabled) |
|
201 |
| --top-k | 50 | Number of top-k items to retrieve; corresponds to entities in "local" mode and relationships in "global" mode. |
|
202 |
| --cosine-threshold | 0.4 | The cossine threshold for nodes and relations retrieval, works with top-k to control the retrieval of nodes and relations. |
|
|
|
|
|
|
|
|
|
203 |
|
204 |
### Example Usage
|
205 |
|
|
|
107 |
|
108 |
### Environment Variables
|
109 |
|
110 |
+
You can configure LightRAG using environment variables by creating a `.env` file in your project root directory. A sample file `.env.example` is provided for your convenience.
|
111 |
|
112 |
+
### Config.ini
|
|
|
|
|
|
|
113 |
|
114 |
+
Datastorage configuration can be also set by config.ini. A sample file `config.ini.example` is provided for your convenience.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
### Configuration Priority
|
117 |
|
118 |
The configuration values are loaded in the following order (highest priority first):
|
119 |
1. Command-line arguments
|
120 |
2. Environment variables
|
121 |
+
3. Config.ini
|
122 |
+
4. Defaul values
|
123 |
|
124 |
For example:
|
125 |
```bash
|
|
|
130 |
PORT=7000 python lightrag.py
|
131 |
```
|
132 |
|
133 |
+
#### Storage Types Supported
|
134 |
+
|
135 |
+
LightRAG uses 4 types of storage for difference purposes:
|
136 |
+
|
137 |
+
* KV_STORAGE:llm response cache, text chunks, document information
|
138 |
+
* VECTOR_STORAGE:entities vectors, relation vectors, chunks vectors
|
139 |
+
* GRAPH_STORAGE:entity relation graph
|
140 |
+
* DOC_STATUS_STORAGE:documents indexing status
|
141 |
+
|
142 |
+
Each storage type have servals implementations:
|
143 |
+
|
144 |
+
* KV_STORAGE supported implement-name
|
145 |
+
|
146 |
+
```
|
147 |
+
JsonKVStorage JsonFile(default)
|
148 |
+
MongoKVStorage MogonDB
|
149 |
+
RedisKVStorage Redis
|
150 |
+
TiDBKVStorage TiDB
|
151 |
+
PGKVStorage Postgres
|
152 |
+
OracleKVStorage Oracle
|
153 |
+
```
|
154 |
+
|
155 |
+
* GRAPH_STORAGE supported implement-name
|
156 |
+
|
157 |
+
```
|
158 |
+
NetworkXStorage NetworkX(defualt)
|
159 |
+
Neo4JStorage Neo4J
|
160 |
+
MongoGraphStorage MongoDB
|
161 |
+
TiDBGraphStorage TiDB
|
162 |
+
AGEStorage AGE
|
163 |
+
GremlinStorage Gremlin
|
164 |
+
PGGraphStorage Postgres
|
165 |
+
OracleGraphStorage Postgres
|
166 |
+
```
|
167 |
+
|
168 |
+
* VECTOR_STORAGE supported implement-name
|
169 |
+
|
170 |
+
```
|
171 |
+
NanoVectorDBStorage NanoVector(default)
|
172 |
+
MilvusVectorDBStorge Milvus
|
173 |
+
ChromaVectorDBStorage Chroma
|
174 |
+
TiDBVectorDBStorage TiDB
|
175 |
+
PGVectorStorage Postgres
|
176 |
+
FaissVectorDBStorage Faiss
|
177 |
+
QdrantVectorDBStorage Qdrant
|
178 |
+
OracleVectorDBStorag Oracle
|
179 |
+
```
|
180 |
+
|
181 |
+
* DOC_STATUS_STORAGE:supported implement-name
|
182 |
+
|
183 |
+
```
|
184 |
+
JsonDocStatusStorage JsonFile(default)
|
185 |
+
PGDocStatusStorage Postgres
|
186 |
+
```
|
187 |
+
|
188 |
+
#### How Select Storage Type
|
189 |
+
|
190 |
+
* Bye enviroment variables
|
191 |
+
* By command line arguments
|
192 |
+
|
193 |
#### LightRag Server Options
|
194 |
|
195 |
| Parameter | Default | Description |
|
|
|
217 |
| --ssl-keyfile | None | Path to SSL private key file (required if --ssl is enabled) |
|
218 |
| --top-k | 50 | Number of top-k items to retrieve; corresponds to entities in "local" mode and relationships in "global" mode. |
|
219 |
| --cosine-threshold | 0.4 | The cossine threshold for nodes and relations retrieval, works with top-k to control the retrieval of nodes and relations. |
|
220 |
+
| --kv-storage | JsonKVStorage | implement-name of KV_STORAGE |
|
221 |
+
| --graph-storage | NetworkXStorage | implement-name of GRAPH_STORAGE |
|
222 |
+
| --vector-storage | NanoVectorDBStorage | implement-name of VECTOR_STORAGE |
|
223 |
+
| --doc-status-storage | JsonDocStatusStorage | implement-name of DOC_STATUS_STORAGE |
|
224 |
|
225 |
### Example Usage
|
226 |
|