Configuring YAML File#
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
... # 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 Configuration YAML Schema Reference.
Configuration Sections#
The following sections provide detailed documentation for each configuration section of the overall config.yml file:
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 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)