Why customize prompts?
Default prompts work well for general use cases, but domain-specific customization offers:- Better entity recognition - Identify domain-specific entities
- Improved relationship extraction - Capture industry-specific connections
- Domain-aware summaries - Generate contextually relevant reports
- Reduced hallucinations - Focus on relevant information
Prompt tuning methods
GraphRAG offers two approaches to prompt customization:Auto tuning
Automatically generates domain-adapted prompts using your data
Manual tuning
Manually edit prompts for fine-grained control
Auto prompt tuning
Auto tuning analyzes your input data and generates optimized prompts automatically.Run auto tuning
Execute the auto-tuning command:
Auto tuning will make several LLM calls to analyze your data. This may take a few minutes and consume API tokens.
Review generated prompts
Check the generated prompts in the You’ll find:
./prompts directory:entity_extraction.txt- Entity extraction promptsummarize_descriptions.txt- Entity summarization promptcommunity_report.txt- Community report generation prompt
Manual prompt tuning
For advanced use cases, you can manually edit prompts to have complete control.Understanding prompt structure
GraphRAG prompts follow a specific structure:Example: Customizing for medical domain
Create custom entity types
Define domain-specific entities for medical documents:
prompts/medical_entities.txt
Customize community reports
Tailor community summaries for medical insights:
prompts/medical_community_report.txt
Domain-specific examples
- Legal documents
- Scientific research
- Business intelligence
Best practices
Start with auto tuning
Begin with auto-generated prompts and refine manually as needed
Provide examples
Include domain-specific examples in your prompts for better results
Iterate and test
Test prompts on sample data and refine based on output quality
Keep it focused
Define specific entity types relevant to your domain, avoid being too broad
Testing custom prompts
Advanced techniques
Few-shot learning
Include examples directly in your prompts:Chain-of-thought prompting
Guide the LLM through reasoning steps:Next steps
Prompt tuning guide
Complete guide to prompt tuning
Configuration reference
Full configuration options
Global search notebook
Experiment with search parameters
Use cases
Real-world examples