pub struct GuardrailsConfig {
pub pii_detection: bool,
pub secret_detection: bool,
pub prompt_injection_check: bool,
pub blocked_words: HashSet<String>,
pub blocked_patterns: Vec<String>,
pub allow_redaction: bool,
pub custom_pii_patterns: Vec<PiiPattern>,
pub custom_secret_patterns: Vec<SecretPattern>,
}Expand description
Configuration for guardrails.
Fields§
§pii_detection: boolEnable PII detection (emails, phone numbers, SSNs, etc.)
secret_detection: boolEnable secret detection (API keys, passwords, tokens)
prompt_injection_check: boolEnable prompt injection detection
blocked_words: HashSet<String>Custom word blocklist
blocked_patterns: Vec<String>Custom regex patterns to block
allow_redaction: boolWhether to allow redaction (vs. blocking)
custom_pii_patterns: Vec<PiiPattern>Custom PII patterns
custom_secret_patterns: Vec<SecretPattern>Custom secret patterns
Implementations§
Source§impl GuardrailsConfig
impl GuardrailsConfig
Sourcepub fn all_enabled() -> Self
pub fn all_enabled() -> Self
Create a new config with all checks enabled.
Sourcepub fn with_blocked_word(self, word: impl Into<String>) -> Self
pub fn with_blocked_word(self, word: impl Into<String>) -> Self
Add a blocked word.
Sourcepub fn with_blocked_words<I, S>(self, words: I) -> Self
pub fn with_blocked_words<I, S>(self, words: I) -> Self
Add blocked words.
Sourcepub fn with_blocked_pattern(self, pattern: impl Into<String>) -> Self
pub fn with_blocked_pattern(self, pattern: impl Into<String>) -> Self
Add a blocked regex pattern.
Trait Implementations§
Source§impl Clone for GuardrailsConfig
impl Clone for GuardrailsConfig
Source§fn clone(&self) -> GuardrailsConfig
fn clone(&self) -> GuardrailsConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GuardrailsConfig
impl Debug for GuardrailsConfig
Auto Trait Implementations§
impl Freeze for GuardrailsConfig
impl RefUnwindSafe for GuardrailsConfig
impl Send for GuardrailsConfig
impl Sync for GuardrailsConfig
impl Unpin for GuardrailsConfig
impl UnwindSafe for GuardrailsConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more