A simple, easy-to-hack GraphRAG implementation
Project description
nano-GraphRAG
A simple, easy-to-hack GraphRAG implementation
😭 GraphRAG is good and powerful, but the official implementation is not very "easy" to read or hack.
😊 This project aims to provide a simpler implementation, while retaining the core functionality.
👌 nano-graphrag
is about 1000-lines of python, but performs the same as the original implementation.
Install
Install from PyPi
pip install nano-graphrag
Install from source
# clone this repo first
cd nano-graphrag
pip install -e .
Quick Start
download a copy of A Christmas Carol by Charles Dickens:
curl https://www.gutenberg.org/cache/epub/24022/pg24022.txt > ./book.txt
Use the below python snippet:
from nano_graphrag import GraphRAG
graph_func = GraphRAG()
with open("./book.txt") as f
graph_func.insert(f.read())
print(graph_func.query("What are the top themes in this story?"))
Save the graph for the next time:
graph_func.save("path/to/dir")
# -------- next time ---------
graph_func = GraphRAG.from_dir("path/to/dir")
For each method NAME(...)
, there is a corresponding async method aNAME(...)
await graph_func.ainsert(...)
await graph_func.aquery(...)
...
Benchmark
TODO
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for nano_graphrag-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bf7f010329e62f1a4f0167e426bcfb85509a8127b31a5807e2e5f70837f6b50 |
|
MD5 | ab204e71c2f5fff8ee6fc95d88d5a66f |
|
BLAKE2b-256 | 402ae12e784381f7483c239ef9602e184bbfbaead04de162bbe5aca28681dc10 |