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:

1# LLM model configuration
2models:
3 - type: main
4 engine: openai
5 model: gpt-4o
6
7# Instructions for the LLM (similar to system prompts)
8instructions:
9 - type: general
10 content: |
11 You are a helpful AI assistant.
12
13# Guardrails configuration
14rails:
15 input:
16 flows:
17 - self check input
18 output:
19 flows:
20 - self check output
21 ... # Other rail configurations
22
23# Prompt customization
24prompts:
25 - task: self_check_input
26 content: |
27 Your task is to check if the user message complies with policy.
28
29# Knowledge base settings
30knowledge_base:
31 embedding_search_provider:
32 name: default
33
34# Tracing and monitoring
35tracing:
36 enabled: true
37 adapters:
38 - name: FileSystem
39 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)