LLM Guardrail • Rust AI Agent SDK

LLMGuardrail: LLM-based guardrail for content validation

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

rust
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

rust
fn with_prompt(mut self, prompt: impl Into<String>) -> Self

Set the prompt template

Parameters:

NameType
promptimpl Into&lt;String&gt;

with_model

rust
fn with_model(mut self, model: impl Into<String>) -> Self

Set the model

Parameters:

NameType
modelimpl Into&lt;String&gt;

block_on_failure

rust
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


Related Documentation