Core Configurations for Guardrails#
This section describes the config.yml file schema used to configure the NeMo Guardrails library.
The config.yml file is the primary configuration file for defining LLM models, guardrails behavior, prompts, knowledge base settings, and tracing options.
Overview#
The following is a complete schema for a config.yml file:
# LLM model configuration
models:
- type: main
engine: openai
model: gpt-3.5-turbo-instruct
# Instructions for the LLM (similar to system prompts)
instructions:
- type: general
content: |
You are a helpful AI assistant.
# Guardrails configuration
rails:
input:
flows:
- self check input
output:
flows:
- self check output
# Prompt customization
prompts:
- task: self_check_input
content: |
Your task is to check if the user message complies with policy.
# Knowledge base settings
knowledge_base:
embedding_search_provider:
name: default
# Tracing and monitoring
tracing:
enabled: true
adapters:
- name: FileSystem
filepath: "./logs/traces.jsonl"
Quick Reference#
For a complete, consolidated reference of all configuration options, see the Configuration Reference.
Configuration Sections#
The following guides provide detailed documentation for each configuration section of the overall config.yml file:
Complete reference for all config.yml options including models, rails, prompts, and advanced settings.
Configure LLM engines, embedding models, and task-specific models in config.yml.
Configure input, output, dialog, retrieval, and execution rails in config.yml to control LLM behavior.
Customize prompts for self-check, fact-checking, and intent generation tasks.
Configure FileSystem and OpenTelemetry tracing adapters to monitor guardrails.
Configure streaming for LLM token generation and output rail processing in config.yml.
File Organization#
Configuration files are typically organized in a config folder:
.
├── config
│ ├── config.yml # Main configuration file
│ ├── prompts.yml # Custom prompts (optional)
│ ├── rails/ # Colang flow definitions (optional)
│ │ ├── input.co
│ │ ├── output.co
│ │ └── ...
│ ├── kb/ # Knowledge base documents (optional)
│ │ ├── doc1.md
│ │ └── ...
│ ├── actions.py # Custom actions (optional)
│ └── config.py # Custom initialization (optional)
Once you have finished crafting your overall config.yml file, refer to the following guides for detailed information each of the optional components as needed:
Core Configuration - A complete guide to writing your
config.ymlfile.Colang Rails -
.coflow files.Custom Actions -
actions.pyfor callable actions.Custom Initialization -
config.pyfor provider registration.Knowledge Base Documents -
kb/folder for RAG.