pub struct StructuredOutputGuard { /* private fields */ }Expand description
Guard for detecting structured output injection attacks.
Scans content for patterns that indicate an attacker is trying to inject role-override or system-level instructions through structured output formats.
Implementations§
Source§impl StructuredOutputGuard
impl StructuredOutputGuard
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Create a new structured output guard with default patterns.
Sourcepub fn with_action(self, action: GuardAction) -> Self
pub fn with_action(self, action: GuardAction) -> Self
Set the action to take on detection
Trait Implementations§
Source§impl Guard for StructuredOutputGuard
impl Guard for StructuredOutputGuard
Source§fn check(&self, content: &str) -> GuardCheckResult
fn check(&self, content: &str) -> GuardCheckResult
Check content against this guard
Source§fn action(&self) -> GuardAction
fn action(&self) -> GuardAction
Get the action this guard takes on failure
Source§fn severity_threshold(&self) -> Severity
fn severity_threshold(&self) -> Severity
Get the minimum severity that triggers this guard
Auto Trait Implementations§
impl Freeze for StructuredOutputGuard
impl RefUnwindSafe for StructuredOutputGuard
impl Send for StructuredOutputGuard
impl Sync for StructuredOutputGuard
impl Unpin for StructuredOutputGuard
impl UnwindSafe for StructuredOutputGuard
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<G> InstrumentGuard for Gwhere
G: Guard,
impl<G> InstrumentGuard for Gwhere
G: Guard,
Source§fn instrumented(self) -> InstrumentedGuard<Self>
fn instrumented(self) -> InstrumentedGuard<Self>
Wrap this guard with metrics instrumentation
Source§fn instrumented_with(
self,
collector: Arc<GuardMetricsCollector>,
) -> InstrumentedGuard<Self>
fn instrumented_with( self, collector: Arc<GuardMetricsCollector>, ) -> InstrumentedGuard<Self>
Wrap this guard with a specific collector