Update README

This commit is contained in:
yangdx 2025-07-30 13:13:59 +08:00
parent c7bc4fc42c
commit aba46213a7
2 changed files with 5 additions and 88 deletions

View file

@ -781,7 +781,6 @@ async def initialize_rag():
<summary> <b>使用Faiss进行存储</b> </summary> <summary> <b>使用Faiss进行存储</b> </summary>
在使用Faiss向量数据库之前必须手工安装`faiss-cpu``faiss-gpu` 在使用Faiss向量数据库之前必须手工安装`faiss-cpu``faiss-gpu`
- 安装所需依赖: - 安装所需依赖:
``` ```
@ -818,51 +817,13 @@ rag = LightRAG(
<details> <details>
<summary> <b>使用PostgreSQL进行存储</b> </summary> <summary> <b>使用PostgreSQL进行存储</b> </summary>
对于生产级场景您很可能想要利用企业级解决方案。PostgreSQL可以为您提供一站式解决方案作为KV存储、向量数据库pgvector和图数据库apache AGE 对于生产级场景您很可能想要利用企业级解决方案。PostgreSQL可以为您提供一站式解决方案作为KV存储、向量数据库pgvector和图数据库apache AGE支持 PostgreSQL 版本为16.6或以上。
* PostgreSQL很轻量整个二进制发行版包括所有必要的插件可以压缩到40MB参考[Windows发布版](https://github.com/ShanGor/apache-age-windows/releases/tag/PG17%2Fv1.5.0-rc0)它在Linux/Mac上也很容易安装。 * PostgreSQL很轻量整个二进制发行版包括所有必要的插件可以压缩到40MB参考[Windows发布版](https://github.com/ShanGor/apache-age-windows/releases/tag/PG17%2Fv1.5.0-rc0)它在Linux/Mac上也很容易安装。
* 如果您是初学者并想避免麻烦推荐使用docker请从这个镜像开始请务必阅读概述https://hub.docker.com/r/shangor/postgres-for-rag * 如果您是初学者并想避免麻烦推荐使用docker请从这个镜像开始请务必阅读概述https://hub.docker.com/r/shangor/postgres-for-rag
* 如何开始?参考:[examples/lightrag_zhipu_postgres_demo.py](https://github.com/HKUDS/LightRAG/blob/main/examples/lightrag_zhipu_postgres_demo.py) * 如何开始?参考:[examples/lightrag_zhipu_postgres_demo.py](https://github.com/HKUDS/LightRAG/blob/main/examples/lightrag_zhipu_postgres_demo.py)
* 为AGE创建索引示例如有必要将下面的`dickens`改为您的图名)
```sql
load 'age';
SET search_path = ag_catalog, "$user", public;
CREATE INDEX CONCURRENTLY entity_p_idx ON dickens."Entity" (id);
CREATE INDEX CONCURRENTLY vertex_p_idx ON dickens."_ag_label_vertex" (id);
CREATE INDEX CONCURRENTLY directed_p_idx ON dickens."DIRECTED" (id);
CREATE INDEX CONCURRENTLY directed_eid_idx ON dickens."DIRECTED" (end_id);
CREATE INDEX CONCURRENTLY directed_sid_idx ON dickens."DIRECTED" (start_id);
CREATE INDEX CONCURRENTLY directed_seid_idx ON dickens."DIRECTED" (start_id,end_id);
CREATE INDEX CONCURRENTLY edge_p_idx ON dickens."_ag_label_edge" (id);
CREATE INDEX CONCURRENTLY edge_sid_idx ON dickens."_ag_label_edge" (start_id);
CREATE INDEX CONCURRENTLY edge_eid_idx ON dickens."_ag_label_edge" (end_id);
CREATE INDEX CONCURRENTLY edge_seid_idx ON dickens."_ag_label_edge" (start_id,end_id);
create INDEX CONCURRENTLY vertex_idx_node_id ON dickens."_ag_label_vertex" (ag_catalog.agtype_access_operator(properties, '"node_id"'::agtype));
create INDEX CONCURRENTLY entity_idx_node_id ON dickens."Entity" (ag_catalog.agtype_access_operator(properties, '"node_id"'::agtype));
CREATE INDEX CONCURRENTLY entity_node_id_gin_idx ON dickens."Entity" using gin(properties);
ALTER TABLE dickens."DIRECTED" CLUSTER ON directed_sid_idx;
-- 如有必要可以删除 * Apache AGE的性能不如Neo4j。最求高性能的图数据库请使用Noe4j。
drop INDEX entity_p_idx;
drop INDEX vertex_p_idx;
drop INDEX directed_p_idx;
drop INDEX directed_eid_idx;
drop INDEX directed_sid_idx;
drop INDEX directed_seid_idx;
drop INDEX edge_p_idx;
drop INDEX edge_sid_idx;
drop INDEX edge_eid_idx;
drop INDEX edge_seid_idx;
drop INDEX vertex_idx_node_id;
drop INDEX entity_idx_node_id;
drop INDEX entity_node_id_gin_idx;
```
* Apache AGE的已知问题发布版本存在以下问题
> 您可能会发现节点/边的属性是空的。
> 这是发布版本的已知问题https://github.com/apache/age/pull/1721
>
> 您可以从源代码编译AGE来修复它。
>
</details> </details>

View file

@ -792,58 +792,18 @@ see test_neo4j.py for a working example.
<details> <details>
<summary> <b>Using PostgreSQL for Storage</b> </summary> <summary> <b>Using PostgreSQL for Storage</b> </summary>
For production level scenarios you will most likely want to leverage an enterprise solution. PostgreSQL can provide a one-stop solution for you as KV store, VectorDB (pgvector) and GraphDB (apache AGE). For production level scenarios you will most likely want to leverage an enterprise solution. PostgreSQL can provide a one-stop solution for you as KV store, VectorDB (pgvector) and GraphDB (apache AGE). PostgreSQL version 16.6 or higher is supported.
* PostgreSQL is lightweight,the whole binary distribution including all necessary plugins can be zipped to 40MB: Ref to [Windows Release](https://github.com/ShanGor/apache-age-windows/releases/tag/PG17%2Fv1.5.0-rc0) as it is easy to install for Linux/Mac. * PostgreSQL is lightweight,the whole binary distribution including all necessary plugins can be zipped to 40MB: Ref to [Windows Release](https://github.com/ShanGor/apache-age-windows/releases/tag/PG17%2Fv1.5.0-rc0) as it is easy to install for Linux/Mac.
* If you prefer docker, please start with this image if you are a beginner to avoid hiccups (DO read the overview): https://hub.docker.com/r/shangor/postgres-for-rag * If you prefer docker, please start with this image if you are a beginner to avoid hiccups (DO read the overview): https://hub.docker.com/r/shangor/postgres-for-rag
* How to start? Ref to: [examples/lightrag_zhipu_postgres_demo.py](https://github.com/HKUDS/LightRAG/blob/main/examples/lightrag_zhipu_postgres_demo.py) * How to start? Ref to: [examples/lightrag_zhipu_postgres_demo.py](https://github.com/HKUDS/LightRAG/blob/main/examples/lightrag_zhipu_postgres_demo.py)
* Create index for AGE example: (Change below `dickens` to your graph name if necessary) * For high-performance graph database requirements, Neo4j is recommended as Apache AGE's performance is not as competitive.
```sql
load 'age';
SET search_path = ag_catalog, "$user", public;
CREATE INDEX CONCURRENTLY entity_p_idx ON dickens."Entity" (id);
CREATE INDEX CONCURRENTLY vertex_p_idx ON dickens."_ag_label_vertex" (id);
CREATE INDEX CONCURRENTLY directed_p_idx ON dickens."DIRECTED" (id);
CREATE INDEX CONCURRENTLY directed_eid_idx ON dickens."DIRECTED" (end_id);
CREATE INDEX CONCURRENTLY directed_sid_idx ON dickens."DIRECTED" (start_id);
CREATE INDEX CONCURRENTLY directed_seid_idx ON dickens."DIRECTED" (start_id,end_id);
CREATE INDEX CONCURRENTLY edge_p_idx ON dickens."_ag_label_edge" (id);
CREATE INDEX CONCURRENTLY edge_sid_idx ON dickens."_ag_label_edge" (start_id);
CREATE INDEX CONCURRENTLY edge_eid_idx ON dickens."_ag_label_edge" (end_id);
CREATE INDEX CONCURRENTLY edge_seid_idx ON dickens."_ag_label_edge" (start_id,end_id);
create INDEX CONCURRENTLY vertex_idx_node_id ON dickens."_ag_label_vertex" (ag_catalog.agtype_access_operator(properties, '"node_id"'::agtype));
create INDEX CONCURRENTLY entity_idx_node_id ON dickens."Entity" (ag_catalog.agtype_access_operator(properties, '"node_id"'::agtype));
CREATE INDEX CONCURRENTLY entity_node_id_gin_idx ON dickens."Entity" using gin(properties);
ALTER TABLE dickens."DIRECTED" CLUSTER ON directed_sid_idx;
-- drop if necessary
drop INDEX entity_p_idx;
drop INDEX vertex_p_idx;
drop INDEX directed_p_idx;
drop INDEX directed_eid_idx;
drop INDEX directed_sid_idx;
drop INDEX directed_seid_idx;
drop INDEX edge_p_idx;
drop INDEX edge_sid_idx;
drop INDEX edge_eid_idx;
drop INDEX edge_seid_idx;
drop INDEX vertex_idx_node_id;
drop INDEX entity_idx_node_id;
drop INDEX entity_node_id_gin_idx;
```
* Known issue of the Apache AGE: The released versions got below issue:
> You might find that the properties of the nodes/edges are empty.
> It is a known issue of the release version: https://github.com/apache/age/pull/1721
>
> You can Compile the AGE from source code and fix it.
>
</details> </details>
<details> <details>
<summary> <b>Using Faiss for Storage</b> </summary> <summary> <b>Using Faiss for Storage</b> </summary>
You must manually install faiss-cpu or faiss-gpu before using FAISS vector db. Before using Faiss vector database, you must manually install `faiss-cpu` or `faiss-gpu`.
Manually install `faiss-cpu` or `faiss-gpu` before using FAISS vector db.
- Install the required dependencies: - Install the required dependencies:
@ -1280,10 +1240,8 @@ LightRAG now seamlessly integrates with [RAG-Anything](https://github.com/HKUDS/
), ),
) )
) )
# Initialize storage (this will load existing data if available) # Initialize storage (this will load existing data if available)
await lightrag_instance.initialize_storages() await lightrag_instance.initialize_storages()
# Now initialize RAGAnything with the existing LightRAG instance # Now initialize RAGAnything with the existing LightRAG instance
rag = RAGAnything( rag = RAGAnything(
lightrag=lightrag_instance, # Pass the existing LightRAG instance lightrag=lightrag_instance, # Pass the existing LightRAG instance
@ -1312,14 +1270,12 @@ LightRAG now seamlessly integrates with [RAG-Anything](https://github.com/HKUDS/
) )
# Note: working_dir, llm_model_func, embedding_func, etc. are inherited from lightrag_instance # Note: working_dir, llm_model_func, embedding_func, etc. are inherited from lightrag_instance
) )
# Query the existing knowledge base # Query the existing knowledge base
result = await rag.query_with_multimodal( result = await rag.query_with_multimodal(
"What data has been processed in this LightRAG instance?", "What data has been processed in this LightRAG instance?",
mode="hybrid" mode="hybrid"
) )
print("Query result:", result) print("Query result:", result)
# Add new multimodal documents to the existing LightRAG instance # Add new multimodal documents to the existing LightRAG instance
await rag.process_document_complete( await rag.process_document_complete(
file_path="path/to/new/multimodal_document.pdf", file_path="path/to/new/multimodal_document.pdf",