Skip to main content

GuardrailChain

Defined in the guardrails module.
Rust AI Agent SDK Chain of guardrails to run in sequence.

Fields

NameTypeDescription
guardrailsVec<Box<dyn Guardrail>>-
configGuardrailConfig-

Methods

new

fn new() -> Self
Create a new guardrail chain

add

fn add(mut self, guardrail: impl Guardrail + 'static) -> Self
Add a guardrail to the chain Parameters:
NameType
guardrailimpl Guardrail + 'static

config

fn config(mut self, config: GuardrailConfig) -> Self
Set config Parameters:
NameType
configGuardrailConfig

validate

fn validate(&self, output: &str) -> GuardrailResult
Validate output through all guardrails Parameters:
NameType
output&str

len

fn len(&self) -> usize
Get guardrail count

is_empty

fn is_empty(&self) -> bool
Check if empty

Source

View on GitHub

praisonai/src/guardrails/mod.rs at line 479