graphRAG实战生成西游记知识图谱
安装
git clone https://github.com/microsoft/graphrag.git
pip install graphrag
python version >= 3.10
创建项目&放入数据源
mkdir xiyouji
cd xiyouji
mkdir input
curl https://www.gutenberg.org/cache/epub/23962/pg23962.txt > ./input/book.txt
初始化项目
python3 -m graphrag.index --init --root ./xiyouji
修改.ENV和settings.yaml
索引化
python3 -m graphrag.index --root ./xiyouji
查询
python3 -m graphrag.query --root ./xiyouji --method global "这篇文章讲的什么主题“
python3 -m graphrag.query --root ./xiyouji --method local "六耳猕猴是怎么死的"
知识图谱(Graph)
https://lanesky.github.io/img/in-post/post-graphrag-xiyouji/xiyouji.svg