https://github.com/khoj-ai/knowledge-graph
A minimal implementation of GraphRAG, designed to quickly prototype whether you're able to get good sense-making out of a large dataset with creation of a knowledge graph.
https://github.com/khoj-ai/knowledge-graph
graph-rag information-retrieval knowledge-graph llms rag
Last synced: about 1 month ago
JSON representation
A minimal implementation of GraphRAG, designed to quickly prototype whether you're able to get good sense-making out of a large dataset with creation of a knowledge graph.
- Host: GitHub
- URL: https://github.com/khoj-ai/knowledge-graph
- Owner: khoj-ai
- Created: 2025-01-02T23:44:19.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2025-02-07T00:12:21.000Z (8 months ago)
- Last Synced: 2025-06-08T06:09:50.319Z (4 months ago)
- Topics: graph-rag, information-retrieval, knowledge-graph, llms, rag
- Language: Python
- Homepage:
- Size: 130 KB
- Stars: 30
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Graph RAG
[GraphRAG](https://microsoft.github.io/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.
## Install
This project uses [uv](https://docs.astral.sh/uv/getting-started/) for Python dependency management.To install uv, follow the instructions [here](https://docs.astral.sh/uv/getting-started/installation/).
Install the dependencies with the following command:
```bash
uv run pip install
```## Usage
1. Add the files you want to add to your knowledge graph in the `data` folder.
2. Set your `GOOGLE_API_KEY` in the `.env` file. You can get it from [here](https://aistudio.google.com/app/apikey).
3. Run the following command to generate the knowledge graph:
First, start the Chroma server:
```bash
chroma run --path db
``````bash
python3 graph.py
```4. The knowledge graph will be saved in a chromadb database in the `db` folder. To query it, run
```bash
python3 query_cli.py
```5. To visualize the knowledge graph, run
```bash
streamlit run visualize.py
```