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.List of model configurations
The type of model. Common values:
main- Primary LLM for conversationcontent_safety- Model for content safety checksjailbreak_detection- Model for jailbreak detection
The LLM engine/provider. Supported values:
openai- OpenAI modelsnim- NVIDIA NIMvertexai- Google Vertex AIhf_pipeline- HuggingFace pipelinehf_endpoint- HuggingFace endpoint
The specific model name (e.g.,
gpt-4o-mini, meta/llama3-8b-instruct)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.List of instruction sets
The type of instruction (e.g.,
general)The instruction text
Example
Fromexamples/bots/abc/config.yml:
Sample Conversation
Provide sample conversation patterns to guide the LLM.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.Container for all rail configurations
Input rails configuration
List of input rail flow names to activate
Output rails configuration
List of output rail flow names to activate
Dialog rails configuration
Configuration for single-call dialog mode
Whether to enable single-call mode (default: varies by configuration)
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