Skip to main content

LLMGuardrail

Defined in the extras module.
Rust AI Agent SDK LLM-based guardrail for content validation

Fields

NameTypeDescription
nameStringName of the guardrail
descriptionStringDescription of what the guardrail checks
prompt_templateStringThe prompt template for the LLM check
modelStringModel to use for the guardrail check
block_on_failureboolWhether to block on failure

Methods

new

fn new(name: impl Into<String>, description: impl Into<String>) -> Self
Create a new LLM guardrail Parameters:
NameType
nameimpl Into&lt;String&gt;
descriptionimpl Into&lt;String&gt;

with_prompt

fn with_prompt(mut self, prompt: impl Into<String>) -> Self
Set the prompt template Parameters:
NameType
promptimpl Into&lt;String&gt;

with_model

fn with_model(mut self, model: impl Into<String>) -> Self
Set the model Parameters:
NameType
modelimpl Into&lt;String&gt;

block_on_failure

fn block_on_failure(mut self, block: bool) -> Self
Set whether to block on failure Parameters:
NameType
blockbool

Source

View on GitHub

praisonai/src/parity/extras.rs at line 260