Update README
This commit is contained in:
parent
c7bc4fc42c
commit
aba46213a7
2 changed files with 5 additions and 88 deletions
43
README-zh.md
43
README-zh.md
|
|
@ -781,7 +781,6 @@ async def initialize_rag():
|
|||
<summary> <b>使用Faiss进行存储</b> </summary>
|
||||
在使用Faiss向量数据库之前必须手工安装`faiss-cpu`或`faiss-gpu`。
|
||||
|
||||
|
||||
- 安装所需依赖:
|
||||
|
||||
```
|
||||
|
|
@ -818,51 +817,13 @@ rag = LightRAG(
|
|||
<details>
|
||||
<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上也很容易安装。
|
||||
* 如果您是初学者并想避免麻烦,推荐使用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)
|
||||
* 为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;
|
||||
|
||||
-- 如有必要可以删除
|
||||
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来修复它。
|
||||
>
|
||||
* Apache AGE的性能不如Neo4j。最求高性能的图数据库请使用Noe4j。
|
||||
|
||||
</details>
|
||||
|
||||
|
|
|
|||
50
README.md
50
README.md
|
|
@ -792,58 +792,18 @@ see test_neo4j.py for a working example.
|
|||
<details>
|
||||
<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.
|
||||
* 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)
|
||||
* Create index for AGE example: (Change below `dickens` to your graph name if necessary)
|
||||
```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.
|
||||
>
|
||||
* For high-performance graph database requirements, Neo4j is recommended as Apache AGE's performance is not as competitive.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary> <b>Using Faiss for Storage</b> </summary>
|
||||
You must manually install faiss-cpu or faiss-gpu before using FAISS vector db.
|
||||
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`.
|
||||
|
||||
- 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)
|
||||
await lightrag_instance.initialize_storages()
|
||||
|
||||
# Now initialize RAGAnything with the existing LightRAG instance
|
||||
rag = RAGAnything(
|
||||
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
|
||||
)
|
||||
|
||||
# Query the existing knowledge base
|
||||
result = await rag.query_with_multimodal(
|
||||
"What data has been processed in this LightRAG instance?",
|
||||
mode="hybrid"
|
||||
)
|
||||
print("Query result:", result)
|
||||
|
||||
# Add new multimodal documents to the existing LightRAG instance
|
||||
await rag.process_document_complete(
|
||||
file_path="path/to/new/multimodal_document.pdf",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue