Nano-graphrag is a Python-based GraphRAG implementation focused on being small, fast, and hackable. It provides modular components for LLMs, embeddings, vector storage, and graph storage, with scripts and examples to customize behavior.
Collecting history — the radar snapshots this repo daily. The trend line appears after 3 days of data (1 so far).
What it is
A simple, easy-to-hack GraphRAG implementation in Python. The project aims to provide core GraphRAG functionality in a smaller codebase while remaining portable (faiss, neo4j, ollama, etc.), asynchronous, and fully typed.
How it works
The repository exposes configurable components:
- LLM integration with default and replaceable functions (best_model_func, cheap_model_func) and support for JSON output post-processing.
- Embedding function replacement capability with a default OpenAI embedding setup, and examples using local models.
- Storage components separated into BaseKVStorage (key-json), BaseVectorStorage (various vector stores like nano-vectordb, hnswlib, etc.), and BaseGraphStorage (networkx by default with optional Neo4j).
- Chunking customization and prompt customization via PROMPTS dictionary and prompt templates for entity extraction, community reports, and RAG responses.
- Async counterparts for methods (NAME/aname).
Getting started
Install from source:
# clone this repo first
cd nano-graphrag
pip install -e .
Install from PyPi:
pip install nano-graphrag
Quick start tips include setting OPENAI API key in the environment and optional Azure Bedrock/Amazon Bedrock configurations via GraphRAG parameters. Example usage shows inserting text and querying:
from nano_graphrag import GraphRAG, QueryParam
graph_func = GraphRAG(working_dir="./dickens")
with open("./book.txt") as f:
graph_func.insert(f.read())
print(graph_func.query("What are the top themes in this story?"))
print(graph_func.query("What are the top themes in this story?", param=QueryParam(mode="local")))
Details about incremental insert and naive RAG mode are present in the README, including code blocks for incremental insertion and a naive RAG example.
Recent releases
Latest releases (latest 4):
- v0.0.8 v0.0.8 (2024-10-01): Add azure openai as an option in _llm.py and add DSPy for entity extraction.
- v0.0.7 v0.0.7 (2024-09-09): entity extraction failure handling due to small num_ctx and added unit tests for NetworkXStorage.
- v0.0.6 v0.0.6 (2024-08-30): Fix HNSWVectorStorage local query bugs
- v0.0.5 v0.0.5 (2024-08-28): Fixed incorrect file call in graphrag.py and updated FAQ.
Full changelog is linked in the repo.
Traction
Stars: 3957, Forks: 422, Open issues: 84. Created: 2024-07-25, Last push: 2026-01-27. Language: Python. License: MIT. Topics: gpt, gpt-4o, graphrag, learning-by-doing, llm, rag.
Behind the repo
Not provided in the facts.
Caveats
License: MIT. Age: created 2024-07-25. Last push: 2026-01-27. Open issues: 84. No explicit notes about age-related caveats beyond the release history and issues listed. The README mentions various components and configurations but does not expose additional licensing or access caveats beyond those data points.






