GraphRAG is a technique proposed by Microsoft Research to generate knowledge graphs from text using LLMs. This project is an implementation of GraphRAG in Python. It makes it simple to get up and running with GraphRAG and generate knowledge graphs from text. It also provides a semantic search interface to query the knowledge graph.
This project uses uv for Python dependency management.
To install uv, follow the instructions here.
Install the dependencies with the following command:
uv run pip install-
Add the files you want to add to your knowledge graph in the
datafolder. -
Set your
GOOGLE_API_KEYin the.envfile. You can get it from here. -
Run the following command to generate the knowledge graph:
First, start the Chroma server:
chroma run --path dbpython3 graph.py- The knowledge graph will be saved in a chromadb database in the
dbfolder. To query it, run
python3 query_cli.py- To visualize the knowledge graph, run
streamlit run visualize.py