End-to-end GraphRAG toolkit that takes you from raw documents to a knowledge graph and then to retrieval-augmented generation (RAG) with large language models.
Project description
dgraphrag
👉 Use the GraphRAG Accelerator
👉 Read the docs
👉 GraphRAG Arxiv
Overview
dgraphrag 是一个端到端 GraphRAG 工具包,帮助开发者从原始文本到知识图,再到 LLM 检索增强生成,串联完整流程并提供可插拔组件。
本项目由 eust-w 发起,由 D-Robotics(https://d-robotics.cc/)开源。
要了解 GraphRAG 如何从非结构化数据中构建知识图并增强 LLM,请参考官方文档。
Quickstart
pip install dgraphrag[neo4j,openai] # 典型组合
dgrag ingest docs/ # 构建图
dgrag ask "What is GraphRAG?" # 提问
详细教程见 docs/quickstart.md。
Repository Guidance
本仓库提供一个最小可行实现(MVP),方便你快速试用 GraphRAG 思路。请注意,默认索引构建与 LLM API 调用可能产生成本,使用前请理解相应流程及费用。
⚠️ Warning:
dgrag index可能在大规模数据时耗费较多资源,请先评估数据量与预算。
Diving Deeper
- 了解核心概念与原理,阅读设计文档
- 想参与开发?请查看 CONTRIBUTING.md
- 加入社区讨论:GitHub Discussions / Slack (#dgraphrag)
Prompt Tuning
使用你自己的数据与 LLM 时,参考提示工程指南 来微调或构建高质量 prompt。
Versioning
版本遵循 语义化版本 (SemVer)。重大变更请查看 CHANGELOG.md。
使用前请始终运行:
dgrag info # 检查当前索引版本与配置格式
Responsible AI FAQ
详见 RAI_TRANSPARENCY.md,其中解答了:
- GraphRAG 是什么?
- 它能做些什么?
- 潜在的局限与风险?
- ……
Trademarks
本项目可能包含第三方商标或徽标,其所有权归原持有人所有。本仓库仅出于学术与工程示范目的使用,不代表对这些商标或徽标的任何认可。
Privacy
dgraphrag 不会在本地以外收集或存储任何用户数据;所有内容均在你的控制下处理。请在提交敏感数据前自行评估风险。
pip install dgraphrag[arangodb,tigergraph,vector]
# 或者开发模式
pip install -e .[arangodb,tigergraph,vector]
Quick Start
from pathlib import Path
from dgraphrag import (
LocalTextLoader,
SimpleParagraphSplitter,
RegexExtractor,
InMemoryGraphAdapter,
SimpleGraphBuilder,
BasicGraphRetriever,
)
# create a small demo file
Path("demo.txt").write_text("GraphRAG is RetrievalAugmentedGeneration.\n\nRetrievalAugmentedGeneration is Powerful.")
loader = LocalTextLoader()
text = loader.load("demo.txt")
paragraphs = SimpleParagraphSplitter().split(text)
triples = RegexExtractor().extract(paragraphs)
adapter = InMemoryGraphAdapter()
SimpleGraphBuilder(adapter).build(triples)
retriever = BasicGraphRetriever(adapter)
print(retriever.answer("What is GraphRAG?"))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dgraphrag-0.0.3.tar.gz.
File metadata
- Download URL: dgraphrag-0.0.3.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a4a95bc1d6d925a06ba9d9571f9d59827423467489c27302a1ec2ce0de7df81
|
|
| MD5 |
3322f7801eb72cb004ea9e6a78a3951c
|
|
| BLAKE2b-256 |
0e5faccfa8a719ec59054259a52481ab8dd23e7626784b47552715fbc2ea8270
|
File details
Details for the file dgraphrag-0.0.3-py3-none-any.whl.
File metadata
- Download URL: dgraphrag-0.0.3-py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0de6a4f7313b9b8aeaf23d859bdba57d4883c41fb2951f8a048bf2b3cdccf5d1
|
|
| MD5 |
dcc4b2c498085122170b0d914e49ec3a
|
|
| BLAKE2b-256 |
4a55c2c88730332b3ff21bdd5f11b724e25290e419b5d0b7cefae93a087969a9
|