Skip to main content
The 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 conversation
  • content_safety - Model for content safety checks
  • jailbreak_detection - Model for jailbreak detection
string
required
The LLM engine/provider. Supported values:
  • openai - OpenAI models
  • nim - NVIDIA NIM
  • vertexai - Google Vertex AI
  • hf_pipeline - HuggingFace pipeline
  • hf_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

From examples/bots/hello_world/config.yml:

Example: NIM Configuration

From examples/configs/llm/nim/config.yml:

Example: Multiple Models

From examples/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

From examples/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

From examples/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

From examples/bots/abc/config.yml:

Example: Content Safety Rails

From examples/configs/content_safety/config.yml:

Example: Jailbreak Detection

From examples/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

From examples/configs/rag/fact_checking/config.yml:

Complete Example

Here’s a comprehensive configuration example combining multiple features:

Loading Configuration

Next Steps

Rails Definition

Learn how to define custom rails in .co files

LLM Configuration

Explore LLM provider configuration options