Skip to main content

GuardrailConfig

Defined in the guardrails module.
Rust AI Agent SDK Configuration for guardrails.

Fields

NameTypeDescription
on_failureGuardrailActionAction to take on failure
max_retriesusizeMaximum retries if action is Retry
fallback_responseOption<String>Fallback response if action is Fallback
log_resultsboolWhether to log validation results
error_templateOption<String>Custom error message template

Methods

new

fn new() -> Self
Create new config

on_failure

fn on_failure(mut self, action: GuardrailAction) -> Self
Set failure action Parameters:
NameType
actionGuardrailAction

max_retries

fn max_retries(mut self, retries: usize) -> Self
Set max retries Parameters:
NameType
retriesusize

fallback_response

fn fallback_response(mut self, response: impl Into<String>) -> Self
Set fallback response Parameters:
NameType
responseimpl Into&lt;String&gt;

log_results

fn log_results(mut self, log: bool) -> Self
Set log results Parameters:
NameType
logbool

error_template

fn error_template(mut self, template: impl Into<String>) -> Self
Set error template Parameters:
NameType
templateimpl Into&lt;String&gt;

Source

View on GitHub

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