config.yml file is the main configuration file for NeMo Guardrails. It defines LLM models, active rails, instructions, and custom configuration data.
Configuration Sections
Models
Define one or more LLM models to use in your guardrails configuration.array
required
List of model configurations
string
required
The type of model. Common values:
main- Primary LLM for conversationcontent_safety- Model for content safety checksjailbreak_detection- Model for jailbreak detection
string
required
The LLM engine/provider. Supported values:
openai- OpenAI modelsnim- NVIDIA NIMvertexai- Google Vertex AIhf_pipeline- HuggingFace pipelinehf_endpoint- HuggingFace endpoint
string
required
The specific model name (e.g.,
gpt-4o-mini, meta/llama3-8b-instruct)object
Additional model parameters like
temperature, max_tokens, base_url, etc.Example: OpenAI Configuration
Fromexamples/bots/hello_world/config.yml:
Example: NIM Configuration
Fromexamples/configs/llm/nim/config.yml:
Example: Multiple Models
Fromexamples/configs/content_safety/config.yml:
Instructions
Provide system instructions that guide the LLM’s behavior.array
List of instruction sets
string
The type of instruction (e.g.,
general)string
The instruction text
Example
Fromexamples/bots/abc/config.yml:
Sample Conversation
Provide sample conversation patterns to guide the LLM.string
Example conversation showing user/bot interaction patterns with canonical forms
Example
Fromexamples/configs/sample/config.yml:
Rails
Define which guardrails should be active and how they should be configured.object
Container for all rail configurations
object
Input rails configuration
array
List of input rail flow names to activate
object
Output rails configuration
array
List of output rail flow names to activate
object
Dialog rails configuration
object
Configuration for single-call dialog mode
boolean
Whether to enable single-call mode (default: varies by configuration)
object
Custom configuration for specific rails
Example: Self-Check Rails
Fromexamples/bots/abc/config.yml:
Example: Content Safety Rails
Fromexamples/configs/content_safety/config.yml:
Example: Jailbreak Detection
Fromexamples/configs/jailbreak_detection/config.yml:
Custom Configuration
You can add custom configuration sections for specific rails or features.Example: Sensitive Data Detection
Example: Fact Checking
Fromexamples/configs/rag/fact_checking/config.yml:
Complete Example
Here’s a comprehensive configuration example combining multiple features:Loading Configuration
- Python API
- Server
Next Steps
Rails Definition
Learn how to define custom rails in .co files
LLM Configuration
Explore LLM provider configuration options