update insert custom kg

This commit is contained in:
LarFii
2024-12-04 19:44:04 +08:00
parent 7f8460c8ec
commit db9b9f69f8
8 changed files with 119 additions and 163 deletions

View File

@@ -42,9 +42,9 @@ This repository hosts the code of LightRAG. The structure of this code is based
## Algorithm Flowchart
![LightRAG Indexing Flowchart](https://learnopencv.com/wp-content/uploads/2024/11/LightRAG-VectorDB-Json-KV-Store-Indexing-Flowchart-scaled.jpg)
*Figure 1: LightRAG Indexing Flowchart*
*Figure 1: LightRAG Indexing Flowchart - Img Caption : [Source](https://learnopencv.com/lightrag/)*
![LightRAG Retrieval and Querying Flowchart](https://learnopencv.com/wp-content/uploads/2024/11/LightRAG-Querying-Flowchart-Dual-Level-Retrieval-Generation-Knowledge-Graphs-scaled.jpg)
*Figure 2: LightRAG Retrieval and Querying Flowchart*
*Figure 2: LightRAG Retrieval and Querying Flowchart - Img Caption : [Source](https://learnopencv.com/lightrag/)*
## Install
@@ -364,7 +364,21 @@ custom_kg = {
"weight": 1.0,
"source_id": "Source1"
}
]
],
"chunks": [
{
"content": "ProductX, developed by CompanyA, has revolutionized the market with its cutting-edge features.",
"source_id": "Source1",
},
{
"content": "PersonA is a prominent researcher at UniversityB, focusing on artificial intelligence and machine learning.",
"source_id": "Source2",
},
{
"content": "None",
"source_id": "UNKNOWN",
},
],
}
rag.insert_custom_kg(custom_kg)
@@ -947,56 +961,6 @@ def extract_queries(file_path):
```
</details>
## Code Structure
```python
.
├── examples
├── batch_eval.py
├── generate_query.py
├── graph_visual_with_html.py
├── graph_visual_with_neo4j.py
├── lightrag_api_openai_compatible_demo.py
├── lightrag_azure_openai_demo.py
├── lightrag_bedrock_demo.py
├── lightrag_hf_demo.py
├── lightrag_lmdeploy_demo.py
├── lightrag_ollama_demo.py
├── lightrag_openai_compatible_demo.py
├── lightrag_openai_demo.py
├── lightrag_siliconcloud_demo.py
└── vram_management_demo.py
├── lightrag
├── kg
├── __init__.py
└── neo4j_impl.py
├── __init__.py
├── base.py
├── lightrag.py
├── llm.py
├── operate.py
├── prompt.py
├── storage.py
└── utils.py
├── reproduce
├── Step_0.py
├── Step_1_openai_compatible.py
├── Step_1.py
├── Step_2.py
├── Step_3_openai_compatible.py
└── Step_3.py
├── .gitignore
├── .pre-commit-config.yaml
├── Dockerfile
├── get_all_edges_nx.py
├── LICENSE
├── README.md
├── requirements.txt
├── setup.py
├── test_neo4j.py
└── test.py
```
## Star History
<a href="https://star-history.com/#HKUDS/LightRAG&Date">