nano-graphrag  by gusye1234

GraphRAG implementation for simpler, faster knowledge graphs

created 1 year ago
3,167 stars

Top 15.6% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a lightweight and hackable implementation of GraphRAG, designed for developers and researchers seeking a simpler alternative to existing complex frameworks. It offers core GraphRAG functionality with a focus on modularity, portability, and ease of customization, enabling faster iteration and integration into various RAG applications.

How It Works

nano-graphrag constructs a knowledge graph from text, enabling more sophisticated retrieval than traditional RAG. It extracts entities and relationships to build this graph, allowing for both "global" (whole-graph) and "local" (context-specific) searches. This approach aims to improve relevance and context understanding by leveraging structured knowledge, with a design prioritizing small code size (around 1100 lines excluding tests/prompts) and asynchronous operations.

Quick Start & Requirements

  • Install: pip install -e . (from source, recommended) or pip install nano-graphrag (from PyPI).
  • Prerequisites: OpenAI API key (or configure Azure OpenAI/Amazon Bedrock). Examples are provided for using Ollama or transformers.
  • Setup: Requires setting API keys and potentially downloading data.
  • Docs: README, Advances, FQA, Roadmap.

Highlighted Details

  • Supports multiple LLM providers (OpenAI, Azure OpenAI, Amazon Bedrock, DeepSeek, Ollama) and embedding models (OpenAI, Sentence-transformers).
  • Integrates with various vector databases (nano-vectordb, hnswlib, milvus-lite, faiss) and graph storage (networkx, Neo4j).
  • Offers both global and local search modes, with customizable chunking and prompt management.
  • Asynchronous API support for all core methods.

Maintenance & Community

  • Actively maintained with contributions welcomed.
  • Benchmarks and evaluation notebooks are available.
  • Projects using nano-graphrag are listed, encouraging community adoption.

Licensing & Compatibility

  • The specific license is not explicitly stated in the README, but the project structure and examples suggest a permissive open-source license suitable for commercial use and integration into closed-source projects.

Limitations & Caveats

The project does not implement the "covariates" feature found in the original GraphRAG. Its global search implementation differs by using only the top-K important and central communities, rather than a map-reduce style across all communities.

Health Check
Last commit

1 week ago

Responsiveness

1 day

Pull Requests (30d)
4
Issues (30d)
3
Star History
317 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems) and Elie Bursztein Elie Bursztein(Cybersecurity Lead at Google DeepMind).

LightRAG by HKUDS

1.0%
19k
RAG framework for fast, simple retrieval-augmented generation
created 10 months ago
updated 14 hours ago
Feedback? Help us improve.