graphrag init command is the easiest way to get started with GraphRAG. It creates a complete project structure with configuration files, environment variables, and default prompts.
Usage
Options
The project root directory to initialize GraphRAG at
Overwrite existing configuration and prompt files if they exist
Example
Initialize a new GraphRAG project in a specific directory:Generated files
settings.yaml
The main configuration file containing all GraphRAG settings:settings.yaml
.env
Environment variables file for storing sensitive credentials:.env
prompts/
The prompts directory contains default LLM prompt templates that you can customize:extract_graph.txt
Prompt for extracting entities and relationships from text
summarize_descriptions.txt
Prompt for summarizing entity descriptions
community_report_graph.txt
Prompt for generating graph-based community reports
community_report_text.txt
Prompt for generating text-based community reports
extract_claims.txt- Claim extraction (disabled by default)local_search_system_prompt.txt- Local search queriesglobal_search_map_system_prompt.txt- Global search mappingglobal_search_reduce_system_prompt.txt- Global search reductiondrift_search_system_prompt.txt- DRIFT search queriesbasic_search_system_prompt.txt- Basic search queries
Customizing prompts
You can modify the generated prompts to better suit your domain:For data-adapted prompts, run the Auto Prompt Tuning command after initialization.
Using the —force flag
By default,init will not overwrite existing files. Use --force to regenerate:
Next steps
After initialization, you’re ready to:Configure API keys
Edit
.env to add your language model API credentialsAdd source documents
Place your documents in the
input/ directoryTune prompts
Run auto prompt tuning to adapt prompts to your data
Start indexing
Run
graphrag index to process your documents