nemoguardrails.base_guardrails
nemoguardrails.base_guardrails
Abstract base class for guardrails engines.
BaseGuardrails defines the minimum public surface every guardrails engine
must implement. Concrete engines (LLMRails, IORails) inherit and provide
real implementations. The Guardrails facade also inherits, presenting the
same surface while delegating to a wrapped engine.
The contract is deliberately minimal: only what is truly shared across all
engines belongs here. Engine-specific features (e.g. update_llm, check,
register_action, runtime, explain_info) remain on the concrete classes
that actually provide them.
Module Contents
Classes
API
Minimum public surface shared by all guardrails engines.
Subclasses must set self.config (a :class:RailsConfig instance) in
their __init__. The bare annotation below is informational only — it
is not enforced by the ABC machinery, so a subclass that forgets to assign
self.config will instantiate fine and only fail on first access.
Generate an LLM response synchronously with guardrails applied.
Generate an LLM response asynchronously with guardrails applied.
Stream LLM response tokens with guardrails applied.