Using the NeMo Guardrails Library Python API#

This section covers how to use the NeMo Guardrails library Python API to run guardrailed inference and integrate the guardrails into your application.

Overview

RailsConfig and LLMRails core classes for generating guarded responses.

Overview of the NeMo Guardrails Library Python API
Core Classes

RailsConfig and LLMRails class reference for loading and running guardrails.

Core Classes of the NeMo Guardrails Library
Generation Options

Configure logging, LLM parameters, and rail selection for generation.

Generation Options
Streaming

Stream LLM responses in real-time with the stream_async method.

Streaming Generated Responses in Real-Time
Event-Based API

Use generate_events for low-level control over guardrails execution.

NeMo Guardrails Library Event-Based API