graphrag command.
Installation
Ensure GraphRAG is installed before using the CLI:Available commands
The GraphRAG CLI includes five main commands:init
Generate a default configuration file
index
Build a knowledge graph index
update
Update an existing index
prompt-tune
Generate custom prompts from your data
query
Query a knowledge graph index
Initialize a project
Theinit command creates a new GraphRAG project with default configuration files.
1
Run initialization
settings.yaml- Configuration file.env- Environment variables for API keysprompts/- Directory with default prompt templatesinput/- Directory for source documents
2
Configure models
Specify custom models during initialization:
3
Force overwrite (optional)
Use
--force to overwrite existing configuration:Init command options
Build an index
Theindex command processes your documents and builds a knowledge graph.
Indexing methods
Index command options
Update an existing index
Theupdate command incrementally updates an existing index with new documents.
- Detects new or modified documents in the input directory
- Processes only the changed documents
- Merges results with the existing index
- Outputs to
update_output/folder by default
Update command options
Prompt tuning
Theprompt-tune command generates custom prompts tailored to your data domain.
Advanced prompt tuning
Prompt-tune command options
Query your index
Thequery command searches your knowledge graph index.
Query methods
GraphRAG supports four search methods:- Global
- Local
- DRIFT
- Basic
Global search uses the entire knowledge graph to answer questions about the dataset as a whole.Best for: High-level questions, dataset summaries, theme identification
Query command options
Custom response types
You can specify different response formats:Streaming responses
Enable streaming for real-time output:Common workflows
Complete project setup
1
Initialize project
2
Add your documents
3
Configure API keys
Edit
.env and add your API key:4
Tune prompts (recommended)
5
Build the index
6
Query your data
Incremental updates
1
Add new documents
2
Update the index
3
Query updated index
Point queries to the update output:
Troubleshooting
Check configuration without indexing
Skip validation for non-LLM steps
Specify custom data directory
Next steps
Python API
Learn how to use GraphRAG programmatically
Configuration
Customize your GraphRAG settings
Prompt tuning
Optimize prompts for your domain
Azure setup
Configure Azure OpenAI integration