Fast GraphRAG:高准确率且低成本的图形化检索增强生成工具

Derniers outils d'IAMise à jour il y a 4 mois Sharenet.ai
865 0
Trae

Introduction générale

Fast GraphRAG 是由 Circlemind AI 开发的一款开源工具,旨在通过知识图谱和 PageRank 算法实现高效、精确的检索增强生成(RAG)。该工具能够智能适应用户的使用场景、数据和查询需求,提供可解释、低成本且高效的检索工作流。Fast GraphRAG 设计用于大规模运行,无需大量资源或成本,支持实时数据更新和动态数据生成,适合各种领域的知识管理和信息检索需求。

使用Fast-GraphRAG只需要花费,相比原来的的0.48,节省了将近6倍的成本!并且随着数据大小和插入数量的增加,这种成本效益还会进一步提升。

Fast GraphRAG:高准确率且低成本的图形化检索增强生成工具

 

Liste des fonctions

  • 可解释和可调试的知识图谱:提供人类可导航的知识视图,可进行查询、可视化和更新。
  • 高效低成本:设计用于大规模运行,无需大量资源或成本。
  • 动态数据生成:自动生成和优化图谱,以最佳方式适应您的领域和本体需求。
  • 增量更新:支持实时更新,随着数据的变化进行调整。
  • 智能探索:利用 PageRank 算法进行图谱探索,提高准确性和可靠性。
  • 异步和类型支持:完全异步,具有完整的类型支持,确保工作流的稳健性和可预测性。

 

对比LightRAG, GraphRAG and VectorDBs

查询

# QueriesMethodAll queries %Multihop only %
51
VectorDB0.490.32
LightRAG0.470.32
GraphRAG0.750.68
Circlemind0.960.95
101
VectorDB0.420.23
LightRAG0.450.28
GraphRAG0.730.64
Circlemind0.930.90

数据插入

MethodTime (minutes)
VectorDB~0.3
LightRAG~25
GraphRAG~40
Circlemind~1.5

在查询测试中,Fast GraphRAG 在所有查询和多跳查询中的准确率分别高达 96% 和 95%,相比 VectorDB RAG 高出近4倍。

此外,Fast GraphRAG 还对数据集基准测试的插入时间进行了测量(大约800个块):Fast GraphRAG 的插入时间约为1.5分钟,比 GraphRAG 快27倍,且检索的准确性提高了超过40%。

 

Utiliser l'aide

Processus d'installation

  1. 从源码安装(推荐性能最佳): :
   # 克隆此仓库
git clone https://github.com/circlemind-ai/fast-graphrag
cd fast-graphrag
poetry install
  1. 从 PyPi 安装(推荐稳定性): :
   pip install fast-graphrag

快速开始

  1. 设置 OpenAI API 密钥:
   export OPENAI_API_KEY="sk-..."
  1. 下载《圣诞颂歌》文本:
   curl https://raw.githubusercontent.com/circlemind-ai/fast-graphrag/refs/heads/main/mock_data.txt > ./book.txt
  1. 可选:设置并发请求限制:
   export CONCURRENT_TASK_LIMIT=8
  1. 使用以下 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 = [
"Who are the main characters?",
"What locations are mentioned?",
"How do the characters interact?"
]
grag = GraphRAG(
domain=DOMAIN,
example_queries=EXAMPLE_QUERIES,
config=GraphRAG.Config(
llm_service=OpenAILLMService(
model="your-llm-model",
base_url="llm.api.url.com",
api_key="your-api-key",
mode=instructor.Mode.JSON,
api_version="your-llm-api_version",
client="openai or azure"
),
embedding_service=OpenAIEmbeddingService(
model="your-embedding-model",
base_url="emb.api.url.com",
api_key="your-api-key",
embedding_dim=512,
api_version="your-llm-api_version",
client="openai or azure"
),
),
)

Principales fonctions

  1. 知识图谱生成:通过定义领域和示例查询,GraphRAG 将自动生成适应您需求的知识图谱。
  2. 查询和可视化:使用生成的知识图谱进行查询,并通过可视化工具查看结果。
  3. 实时更新:随着数据的变化,GraphRAG 支持实时更新知识图谱,确保信息的最新和准确。
  4. 智能探索:利用 PageRank 算法,GraphRAG 能够智能地探索知识图谱,提高检索的准确性和可靠性。
© déclaration de droits d'auteur
AiPPT

Articles connexes

Pas de commentaires

aucun
Pas de commentaires...