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
string
default:"current directory"
The project root directory to initialize GraphRAG at
boolean
default:"false"
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:1
Edit prompt files
Open and modify the prompt files in the
prompts/ directory2
Test with your data
Run indexing to see how the modified prompts perform
3
Iterate and refine
Adjust prompts based on extraction quality and results
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