About Configuring Guardrails#

This section explains how to configure your guardrails system, from defining LLM models and guardrail flows in YAML to implementing advanced features like Colang flows and custom actions.


Before You Begin with Configuring Guardrails#

Before diving into configuring guardrails, ensure you have the required components ready and understand the overall structure of the guardrails system.

Prerequisites

Prepare LLM endpoints, NemoGuard NIMs, and knowledge base documents before configuration.

Prerequisites for Configuring the NeMo Guardrails Library
Overview

Learn to write config.yml, Colang flows, and custom actions for guardrails.

NeMo Guardrails Library Configuration Overview

Core Configuration#

Configure the essential components of your guardrails system.

Configuring YAML File

Define models, guardrails, prompts, and tracing settings in the config.yml file.

Configuring YAML File
YAML Schema Reference

Reference for all config.yml options including models, rails, prompts, and advanced settings.

Configuration YAML Schema Reference
Guardrail Catalog

Reference for pre-built guardrails including content safety, jailbreak detection, PII handling, and fact checking.

Guardrail Catalog
Colang

Learn Colang, the event-driven language for defining guardrails flows and bot behavior.

Colang Guide

Advanced Configuration#

Optional configurations for extending and optimizing your guardrails system.

Custom Actions

Create Python actions to extend guardrails with external APIs and validation logic.

Configuring Custom Actions
Custom Initialization

Use config.py to register custom LLM providers, embedding providers, and shared resources at startup.

Configuring Custom Initialization
Other Configurations

Additional configuration topics including knowledge base setup and exception handling.

Other Configurations
Caching Instructions and Prompts

Configure in-memory caching for LLM calls and KV cache reuse to improve performance and reduce latency.

Caching Instructions and Prompts
Exceptions and Error Handling

Raise and handle exceptions in guardrails flows to control error behavior and custom responses.

Exceptions and Error Handling