Merge branch 'main' into rerank
This commit is contained in:
commit
9aa2ed0837
3 changed files with 33 additions and 3 deletions
12
README-zh.md
12
README-zh.md
|
|
@ -859,6 +859,18 @@ rag = LightRAG(
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### LightRAG实例间的数据隔离
|
||||||
|
|
||||||
|
通过 workspace 参数可以不同实现不同LightRAG实例之间的存储数据隔离。LightRAG在初始化后workspace就已经确定,之后修改workspace是无效的。下面是不同类型的存储实现工作空间的方式:
|
||||||
|
|
||||||
|
- **对于本地基于文件的数据库,数据隔离通过工作空间子目录实现:** JsonKVStorage, JsonDocStatusStorage, NetworkXStorage, NanoVectorDBStorage, FaissVectorDBStorage。
|
||||||
|
- **对于将数据存储在集合(collection)中的数据库,通过在集合名称前添加工作空间前缀来实现:** RedisKVStorage, RedisDocStatusStorage, MilvusVectorDBStorage, QdrantVectorDBStorage, MongoKVStorage, MongoDocStatusStorage, MongoVectorDBStorage, MongoGraphStorage, PGGraphStorage。
|
||||||
|
- **对于关系型数据库,数据隔离通过向表中添加 `workspace` 字段进行数据的逻辑隔离:** PGKVStorage, PGVectorStorage, PGDocStatusStorage。
|
||||||
|
|
||||||
|
* **对于Neo4j图数据库,通过label来实现数据的逻辑隔离**:Neo4JStorage
|
||||||
|
|
||||||
|
为了保持对遗留数据的兼容,在未配置工作空间时PostgreSQL的默认工作空间为`default`,Neo4j的默认工作空间为`base`。对于所有的外部存储,系统都提供了专用的工作空间环境变量,用于覆盖公共的 `WORKSPACE`环境变量配置。这些适用于指定存储类型的工作空间环境变量为:`REDIS_WORKSPACE`, `MILVUS_WORKSPACE`, `QDRANT_WORKSPACE`, `MONGODB_WORKSPACE`, `POSTGRES_WORKSPACE`, `NEO4J_WORKSPACE`。
|
||||||
|
|
||||||
## 编辑实体和关系
|
## 编辑实体和关系
|
||||||
|
|
||||||
LightRAG现在支持全面的知识图谱管理功能,允许您在知识图谱中创建、编辑和删除实体和关系。
|
LightRAG现在支持全面的知识图谱管理功能,允许您在知识图谱中创建、编辑和删除实体和关系。
|
||||||
|
|
|
||||||
12
README.md
12
README.md
|
|
@ -239,6 +239,7 @@ A full list of LightRAG init parameters:
|
||||||
| **Parameter** | **Type** | **Explanation** | **Default** |
|
| **Parameter** | **Type** | **Explanation** | **Default** |
|
||||||
|--------------|----------|-----------------|-------------|
|
|--------------|----------|-----------------|-------------|
|
||||||
| **working_dir** | `str` | Directory where the cache will be stored | `lightrag_cache+timestamp` |
|
| **working_dir** | `str` | Directory where the cache will be stored | `lightrag_cache+timestamp` |
|
||||||
|
| **workspace** | str | Workspace name for data isolation between different LightRAG Instances | |
|
||||||
| **kv_storage** | `str` | Storage type for documents and text chunks. Supported types: `JsonKVStorage`,`PGKVStorage`,`RedisKVStorage`,`MongoKVStorage` | `JsonKVStorage` |
|
| **kv_storage** | `str` | Storage type for documents and text chunks. Supported types: `JsonKVStorage`,`PGKVStorage`,`RedisKVStorage`,`MongoKVStorage` | `JsonKVStorage` |
|
||||||
| **vector_storage** | `str` | Storage type for embedding vectors. Supported types: `NanoVectorDBStorage`,`PGVectorStorage`,`MilvusVectorDBStorage`,`ChromaVectorDBStorage`,`FaissVectorDBStorage`,`MongoVectorDBStorage`,`QdrantVectorDBStorage` | `NanoVectorDBStorage` |
|
| **vector_storage** | `str` | Storage type for embedding vectors. Supported types: `NanoVectorDBStorage`,`PGVectorStorage`,`MilvusVectorDBStorage`,`ChromaVectorDBStorage`,`FaissVectorDBStorage`,`MongoVectorDBStorage`,`QdrantVectorDBStorage` | `NanoVectorDBStorage` |
|
||||||
| **graph_storage** | `str` | Storage type for graph edges and nodes. Supported types: `NetworkXStorage`,`Neo4JStorage`,`PGGraphStorage`,`AGEStorage` | `NetworkXStorage` |
|
| **graph_storage** | `str` | Storage type for graph edges and nodes. Supported types: `NetworkXStorage`,`Neo4JStorage`,`PGGraphStorage`,`AGEStorage` | `NetworkXStorage` |
|
||||||
|
|
@ -905,6 +906,17 @@ async def initialize_rag():
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### Data Isolation Between LightRAG Instances
|
||||||
|
|
||||||
|
The `workspace` parameter ensures data isolation between different LightRAG instances. Once initialized, the `workspace` is immutable and cannot be changed.Here is how workspaces are implemented for different types of storage:
|
||||||
|
|
||||||
|
- **For local file-based databases, data isolation is achieved through workspace subdirectories:** `JsonKVStorage`, `JsonDocStatusStorage`, `NetworkXStorage`, `NanoVectorDBStorage`, `FaissVectorDBStorage`.
|
||||||
|
- **For databases that store data in collections, it's done by adding a workspace prefix to the collection name:** `RedisKVStorage`, `RedisDocStatusStorage`, `MilvusVectorDBStorage`, `QdrantVectorDBStorage`, `MongoKVStorage`, `MongoDocStatusStorage`, `MongoVectorDBStorage`, `MongoGraphStorage`, `PGGraphStorage`.
|
||||||
|
- **For relational databases, data isolation is achieved by adding a `workspace` field to the tables for logical data separation:** `PGKVStorage`, `PGVectorStorage`, `PGDocStatusStorage`.
|
||||||
|
- **For the Neo4j graph database, logical data isolation is achieved through labels:** `Neo4JStorage`
|
||||||
|
|
||||||
|
To maintain compatibility with legacy data, the default workspace for PostgreSQL is `default` and for Neo4j is `base` when no workspace is configured. For all external storages, the system provides dedicated workspace environment variables to override the common `WORKSPACE` environment variable configuration. These storage-specific workspace environment variables are: `REDIS_WORKSPACE`, `MILVUS_WORKSPACE`, `QDRANT_WORKSPACE`, `MONGODB_WORKSPACE`, `POSTGRES_WORKSPACE`, `NEO4J_WORKSPACE`.
|
||||||
|
|
||||||
## Edit Entities and Relations
|
## Edit Entities and Relations
|
||||||
|
|
||||||
LightRAG now supports comprehensive knowledge graph management capabilities, allowing you to create, edit, and delete entities and relationships within your knowledge graph.
|
LightRAG now supports comprehensive knowledge graph management capabilities, allowing you to create, edit, and delete entities and relationships within your knowledge graph.
|
||||||
|
|
|
||||||
|
|
@ -919,9 +919,15 @@ class LightRAG:
|
||||||
# Get first document's file path and total count for job name
|
# Get first document's file path and total count for job name
|
||||||
first_doc_id, first_doc = next(iter(to_process_docs.items()))
|
first_doc_id, first_doc = next(iter(to_process_docs.items()))
|
||||||
first_doc_path = first_doc.file_path
|
first_doc_path = first_doc.file_path
|
||||||
path_prefix = first_doc_path[:20] + (
|
|
||||||
"..." if len(first_doc_path) > 20 else ""
|
# Handle cases where first_doc_path is None
|
||||||
)
|
if first_doc_path:
|
||||||
|
path_prefix = first_doc_path[:20] + (
|
||||||
|
"..." if len(first_doc_path) > 20 else ""
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
path_prefix = "unknown_source"
|
||||||
|
|
||||||
total_files = len(to_process_docs)
|
total_files = len(to_process_docs)
|
||||||
job_name = f"{path_prefix}[{total_files} files]"
|
job_name = f"{path_prefix}[{total_files} files]"
|
||||||
pipeline_status["job_name"] = job_name
|
pipeline_status["job_name"] = job_name
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue