Skip to main content

dgraphrag

👉 Use the GraphRAG Accelerator
👉 Read the docs
👉 GraphRAG Arxiv

PyPI version
Downloads


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?"))

Metadata

Release files for dgraphrag 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dgraphrag 0.0.3
File Size Uploaded
dgraphrag-0.0.3.tar.gz 18.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dgraphrag 0.0.3
File Interpreter ABI Platform
dgraphrag-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 39.3 kB

Release files / dgraphrag-0.0.3.tar.gz

Download URL dgraphrag-0.0.3.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2a4a95bc1d6d925a06ba9d9571f9d59827423467489c27302a1ec2ce0de7df81
BLAKE2b-256 checksum
How to use checksums
0e5faccfa8a719ec59054259a52481ab8dd23e7626784b47552715fbc2ea8270
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / dgraphrag-0.0.3-py3-none-any.whl

Download URL dgraphrag-0.0.3-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0de6a4f7313b9b8aeaf23d859bdba57d4883c41fb2951f8a048bf2b3cdccf5d1
BLAKE2b-256 checksum
How to use checksums
4a55c2c88730332b3ff21bdd5f11b724e25290e419b5d0b7cefae93a087969a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page