pub trait SafetyGate: Send + Sync {
// Required method
fn inspect<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 PromptInput,
) -> Pin<Box<dyn Future<Output = Result<SafetyVerdict, AimdsError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
The three gates surfaced as a single composing operation.
Implementors decide whether to short-circuit (the canonical
aimds-response::ComposedGate does — Block in any gate stops the
pipeline) or run all three in parallel for telemetry. Either is
valid; the trait contract only specifies the input/output shapes.
Required Methods§
Sourcefn inspect<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 PromptInput,
) -> Pin<Box<dyn Future<Output = Result<SafetyVerdict, AimdsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn inspect<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 PromptInput,
) -> Pin<Box<dyn Future<Output = Result<SafetyVerdict, AimdsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run the 3-gate inspection on a prompt-shaped input. Returns a
SafetyVerdict describing whether to forward, block, or
forward a redacted variant.
All three gates inspect the same input. PII detection (gate 1)
and prompt-injection detection (gate 3) are pure functions of
the content; sanitization (gate 2) can mutate the input into
the Redact payload.