GraphRAG Explained With a Tiny Graph in Python
With two sentences, text search had the facts for 1 of 6 questions. A graph written by hand had them for all 6.
Video #46 ยท RAG and vector search
Steps in the video
Files
- compare.py (53 lines)
- corpus.py (27 lines)
- graph.py (41 lines)
Tested with
Python 3.12.15 | ollama==0.6.3
What this does not show
Thirteen made-up sentences, six questions and one small model in one seeded run; a toy graph, not Microsoft GraphRAG (no communities or summaries); text search was held to two sentences while the hand-written graph handed over five to eight of the thirteen.
Sources
Learning IT by Example.