Configuring YAML File

View as Markdown

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-4o
# 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
... # Other rail configurations
# 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"

Configuration YAML Schema Reference

For a complete, consolidated reference of all configuration options, see the YAML Schema Reference.

Configuration Sections

The following sections provide detailed documentation for each configuration section of the overall config.yml file:

File Organization

Configuration files should be organized in a config folder with the following structure:

.
├── 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)