nano-graphrag  by gusye1234

GraphRAG implementation for simpler, faster knowledge graphs

Created 1 year ago
3,323 stars

Top 14.5% 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 month ago

Responsiveness

1 day

Pull Requests (30d)
1
Issues (30d)
0
Star History
101 stars in the last 30 days

Explore Similar Projects

Starred by Mike Krieger Mike Krieger(CPO at Anthropic; Cofounder of Instagram), Patrick von Platen Patrick von Platen(Author of Hugging Face Diffusers; Research Engineer at Mistral), and
25 more.

redis by redis

0.1%
71k
Redis is a versatile data structure server, cache, and query engine
Created 16 years ago
Updated 3 days ago
Feedback? Help us improve.