GraphRag and Local LLMs. Stay tuned for more updates. This project aims to provide a way to effectively implement a GraphRag solution that is cost effective and simple to work with. It is meant to provide a good head start without having to develop something from scratch.
This installation is meant for Linux.
- Ollama: https://ollama.com/
- Poetry: https://python-poetry.org/
git clone https://github.com/pixelkey/gragl.git && cd graglchmod +x install.shBy default, install.sh might not be executable. This command ensures it can be run directly.
conda create -n gragl python=3.11.8 -yconda activate gragl./install.shPlace your text files into ./indexing/input or use the examples already there.
python3 -m graphrag.index --root ./indexingReference: https://microsoft.github.io/graphrag/posts/config/init/
You can auto-tune your prompts to be more relevant to your content's domain. Note: The output folder populated from the last step is needed for this to work.
python3 -m graphrag.prompt_tune --root ./indexing --config ./settings.yaml --no-entity-typesReference: https://microsoft.github.io/graphrag/posts/prompt_tuning/auto_prompt_tuning/
After reviewing the prompt updates and if you are happy with the results, re-run the indexing (step 7).
python3 -m graphrag.query --root ./indexing --data ./output/[timestamp]/artifacts --method local "hello"Needs fixing: microsoft/graphrag#619
Reference: https://microsoft.github.io/graphrag/posts/query/overview/
conda deactivateconda remove --name gragl --allIn order to get it working locally, a hack was needed to replace the way openai_embeddings_llm.py works. For more information and other potential updates regarding this hack, refer to the following:
Let's be honest, GraphRag requires some serious LLM grunt. Trying to get away with something like Mistral:7b is just not going to cut it. The results will be subpar and simply not worth it. You need to use something like mistral-nemo or mistral-nemo:12b-instruct-2407-fp16.
If you don't have enough data/files available, it might fail with an error like this: WARNING: Graph has no nodes.