Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
GuardrailResult
Defined in the guardrails module.
Rust AI Agent SDK
Result of a guardrail validation.
Fields
| Name | Type | Description |
|---|
success | bool | Whether the guardrail check passed |
result | Option<String> | The result if modified, or original if unchanged |
error | String | Error message if validation failed |
metadata | HashMap<String | Additional metadata |
Methods
success
fn success(result: impl Into<String>) -> Self
Create a successful result
Parameters:
| Name | Type |
|---|
result | impl Into<String> |
pass
Create a successful result without modification
failure
fn failure(error: impl Into<String>) -> Self
Create a failed result
Parameters:
| Name | Type |
|---|
error | impl Into<String> |
from_tuple
fn from_tuple(success: bool, data: impl Into<String>) -> Self
Create from a tuple (success, result_or_error)
Parameters:
| Name | Type |
|---|
success | bool |
data | impl Into<String> |
fn with_metadata(mut self, key: impl Into<String>, value: impl Into<String>) -> Self
Add metadata
Parameters:
| Name | Type |
|---|
key | impl Into<String> |
value | impl Into<String> |
is_success
fn is_success(&self) -> bool
Check if passed
is_failure
fn is_failure(&self) -> bool
Check if failed
get_result_or
fn get_result_or(&self, original: &str) -> String
Get the result or original content
Parameters:
Source
View on GitHub
praisonai/src/guardrails/mod.rs at line 38