graph_rag.py
Run the Example
1
Set up your virtual environment
2
Install dependencies
3
Export your OpenAI API key
4
Start LightRAG
Configure LightRAG’s LLM and embedding settings in
.env, then start the API server on port 9621. See the LightRAG API server guide. Keep the server running:5
Run the example
Save the code above as
graph_rag.py, then run: