GEO

Fast GraphRAG高效AI检索框架详解:2026年成本节约指南

2026/2/26
Fast GraphRAG高效AI检索框架详解:2026年成本节约指南
AI Summary (BLUF)

Fast GraphRAG 是一个高效、可解释的框架,专为智能体驱动的高精度检索工作流设计,支持低成本、动态数据与实时更新。

原文翻译: Fast GraphRAG is an efficient and interpretable framework designed for agent-driven, high-precision retrieval workflows, supporting low cost, dynamic data, and real-time updates.

概述

Streamlined and promptable Fast GraphRAG framework designed for interpretable, high-precision, agent-driven retrieval workflows.

专为可解释、高精度、智能体驱动检索工作流而设计的、精简且易于提示的 Fast GraphRAG 框架。

Fast GraphRAG is built to fit seamlessly into your retrieval pipeline, giving you the power of advanced RAG, without the overhead of building and designing agentic workflows.

Fast GraphRAG 旨在无缝集成到您的检索流程中,让您获得高级 RAG 的强大能力,而无需承担构建和设计智能体工作流的开销。

核心特性

Interpretable and Debuggable Knowledge

Graphs offer a human-navigable view of knowledge that can be queried, visualized, and updated.

图提供了一种可供人类导航的知识视图,可以进行查询、可视化和更新。

Fast, Low-cost, and Efficient

Designed to run at scale without heavy resource or cost requirements.

专为大规模运行而设计,无需大量资源或成本。

Note: Using The Wizard of Oz as an example, fast-graphrag costs $0.08 vs. graphrag $0.48 — a 6x costs saving that further improves with data size and number of insertions.

注意:以《绿野仙踪》为例,fast-graphrag 的成本为 0.08 美元,而 graphrag 为 0.48 美元——节省了 6 倍的成本,并且随着数据量和插入次数的增加,节省效果会进一步提升。

Dynamic Data

Automatically generate and refine graphs to best fit your domain and ontology needs.

自动生成和优化图,以最好地适应您的领域和本体需求。

Incremental Updates

Supports real-time updates as your data evolves.

支持在数据演进时进行实时更新。

Intelligent Exploration

Leverages PageRank-based graph exploration for enhanced accuracy and dependability.

利用基于 PageRank 的图探索,以提高准确性和可靠性。

Asynchronous & Typed

Fully asynchronous, with complete type support for robust and predictable workflows.

完全异步,具有完整的类型支持,确保工作流的健壮性和可预测性。

快速开始

安装

Install from source (recommended for best performance)

从源码安装(推荐以获得最佳性能)

# clone this repo first
cd fast_graphrag
poetry install

Install from PyPi (recommended for stability)

从 PyPi 安装(推荐以获得稳定性)

pip install fast-graphrag

环境设置

Set the OpenAI API key in the environment:

在环境中设置 OpenAI API 密钥:

export OPENAI_API_KEY="sk-..."

Download a copy of A Christmas Carol by Charles Dickens:

下载查尔斯·狄更斯的《圣诞颂歌》副本:

curl https://raw.githubusercontent.com/circlemind-ai/fast-graphrag/refs/heads/main/mock_data.txt > ./book.txt

Optional: Set the limit for concurrent requests to the LLM (i.e., to control the number of tasks processed simultaneously by the LLM, this is helpful when running local models)

可选:设置 LLM 的并发请求限制(即控制 LLM 同时处理的任务数量,这在运行本地模型时很有帮助)

export CONCURRENT_TASK_LIMIT=8

基础使用示例

Use the Python snippet below:

使用以下 Python 代码片段:

from fast_graphrag import GraphRAG

DOMAIN = "Analyze this story and identify the characters. Focus on how they interact with each other, the locations they explore, and their relationships."

EXAMPLE_QUERIES = [
    "What is the significance of Christmas Eve in A Christmas Carol?",
    "How does the setting of Victorian London contribute to the story's themes?",
    "Describe the chain of events that leads to Scrooge's transformation.",
    "How does Dickens use the different spirits (Past, Present, and Future) to guide Scrooge?",
    "Why does Dickens choose to divide the story into \"staves\" rather than chapters?"
]

ENTITY_TYPES = ["Character", "Animal", "Place", "Object", "Activity", "Event"]

grag = GraphRAG(
    working_dir="./book_example",
    domain=DOMAIN,
    example_queries="\n".join(EXAMPLE_QUERIES),
    entity_types=ENTITY_TYPES
)

with open("./book.txt") as f:
    grag.insert(f.read())

print(grag.query("Who is Scrooge?").response)

The next time you initialize fast-graphrag from the same working directory, it will retain all the knowledge automatically.

下次从相同的工作目录初始化 fast-graphrag 时,它将自动保留所有知识。

进阶示例

Please refer to the examples folder for a list of tutorials on common use cases of the library:

请参考 examples 文件夹,其中包含关于该库常见用例的教程列表:

  • custom_llm.py: a brief example on how to configure fast-graphrag to run with different OpenAI API compatible language models and embedders;

    custom_llm.py:一个简短的示例,展示如何配置 fast-graphrag 以使用不同的 OpenAI API 兼容语言模型和嵌入器;

  • checkpointing.ipynb: a tutorial on how to use checkpoints to avoid irreversible data corruption;

    checkpointing.ipynb:一个关于如何使用检查点来避免不可逆数据损坏的教程;

  • query_parameters.ipynb: a tutorial on how to use the different query parameters. In particular, it shows how to include references to the used information in the provided answer (using the with_references=True parameter).

    query_parameters.ipynb:一个关于如何使用不同查询参数的教程。特别展示了如何在提供的答案中包含对所用信息的引用(使用 with_references=True 参数)。

贡献指南

Whether it's big or small, we love contributions. Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. Check out our guide to see how to get started.

无论贡献大小,我们都非常欢迎。贡献是使开源社区成为一个学习、启发和创造的绝佳之地的原因。我们非常感激您所做的任何贡献。请查看我们的指南以了解如何开始。

Not sure where to get started? You can join our Discord and ask us any questions there.

不确定从哪里开始?您可以加入我们的 Discord,在那里向我们提问。

设计理念

Our mission is to increase the number of successful GenAI applications in the world. To do that, we build memory and data tools that enable LLM apps to leverage highly specialized retrieval pipelines without the complexity of setting up and maintaining agentic workflows.

我们的使命是增加世界上成功的生成式 AI 应用的数量。为此,我们构建内存和数据工具,使 LLM 应用能够利用高度专业化的检索流程,而无需承担设置和维护智能体工作流的复杂性。

Fast GraphRAG currently exploit the personalized pagerank algorithm to explore the graph and find the most relevant pieces of information to answer your query. For an overview on why this works, you can check out the HippoRAG paper here.

Fast GraphRAG 目前利用个性化 PageRank 算法来探索图,并找到最相关的信息片段来回答您的查询。要了解其工作原理的概述,您可以查看 HippoRAG 论文。

开源与托管服务

This repo is under the MIT License. See LICENSE.txt for more information.

本仓库遵循 MIT 许可证。更多信息请参见 LICENSE.txt

The fastest and most reliable way to get started with Fast GraphRAG is using our managed service. Your first 100 requests are free every month, after which you pay based on usage.

开始使用 Fast GraphRAG 最快、最可靠的方式是使用我们的托管服务。您每月的前 100 个请求是免费的,之后根据使用量付费。

To learn more about our managed service, book a demo or see our docs.

要了解更多关于我们的托管服务,请预约演示或查看我们的文档。

← 返回文章列表
分享到:微博

版权与免责声明:本文仅用于信息分享与交流,不构成任何形式的法律、投资、医疗或其他专业建议,也不构成对任何结果的承诺或保证。

文中提及的商标、品牌、Logo、产品名称及相关图片/素材,其权利归各自合法权利人所有。本站内容可能基于公开资料整理,亦可能使用 AI 辅助生成或润色;我们尽力确保准确与合规,但不保证完整性、时效性与适用性,请读者自行甄别并以官方信息为准。

若本文内容或素材涉嫌侵权、隐私不当或存在错误,请相关权利人/当事人联系本站,我们将及时核实并采取删除、修正或下架等处理措施。 也请勿在评论或联系信息中提交身份证号、手机号、住址等个人敏感信息。