Integration of the knowledge graph and LLM. The knowledge graph serves as an improved replacement for unstructured data chunk stores in QA systems.
The repository implements:
- 🛠️ Creating a knowledge graph from the document (docx) structure or using LLM.
- 💡 A proposal for the integration of the knowledge graph in RAG Pipeline.
- 🚋 GraphRAG pipeline.
- 🚀 A web service for working with the QA system based on the knowledge graph.
-
clone repo:
git clone https://github.com/kodinkod/kg_llm.git -
install dependencies:
pip install poetry
poetry install
poetry shell
- We use hydra framework for logging and use cofig.
- For use all code we need have connection with neo4j db.
⚠️ warning: for use neo4j setup configs/neo4j/base.yaml (in config and .env files). for use openai LLM add all API keys. (in config and .env files).
Create html page with graph from docx document.
python examples/graph_creation/docs2graph_html.py
Example in output/html_graph_pages/Graph_for_group_test
Load in neo4j (default: 'sandbox' database) graph from docx document.
python examples/graph_creation/graph_splitter_neo4j_base.py
python examples/rags/graph_rag.py # usage example
python evaluting/test_advanced_graph_rag.py # calculate test set
python examples/rags/base.py # usage example
python evaluting/test_base_rag.py # calculate test set
We use Ragas and same custom metrics for evaluate RAG on our custom dataset
from assets/test_set_40.csv abaut programm products in assets.
python evaluting/run_eval.py --config-name=<you-config>
cd web_ui
flask run

