Skip to main content
NeMo Guardrails uses a structured configuration approach to define guardrails for your LLM applications. A guardrails configuration defines the LLM(s) to be used, the rails that should be active, and custom settings.

Configuration Structure

The standard structure for a guardrails configuration folder looks like this:

Main Configuration Files

A complete guardrails configuration typically consists of three main components:

config.yml

General configuration options including LLM models, active rails, and custom settings

.co files

Colang definitions that define various types of rails and conversation flows

actions.py

Custom Python actions that can be called from your guardrails

Configuration Loading

To use a guardrails configuration in your application:
Sample output:

Types of Guardrails

NeMo Guardrails supports five main types of guardrails that can be configured:
1

Input Rails

Applied to user input; can reject or alter input (e.g., mask sensitive data, rephrase)
2

Dialog Rails

Influence how the LLM is prompted; operate on canonical form messages and determine conversation flow
3

Retrieval Rails

Applied to retrieved chunks in RAG scenarios; can reject or alter chunks
4

Execution Rails

Applied to input/output of custom actions (tools) called by the LLM
5

Output Rails

Applied to LLM output; can reject or alter output before returning to user

Basic Configuration Example

Here’s a minimal example from examples/configs/sample/config.yml:

Next Steps

config.yml Schema

Learn about all available configuration options

Rails Definition

Define custom rails using Colang

Custom Actions

Create Python actions for your guardrails

LLM Configuration

Configure different LLM providers