pub struct PromptGuard { /* private fields */ }Expand description
Implementations§
Source§impl PromptGuard
impl PromptGuard
Sourcepub fn new(config: GuardConfig) -> Self
pub fn new(config: GuardConfig) -> Self
Create a new guard with the given configuration.
Sourcepub fn inspect(&self, prompt: &str) -> GuardVerdict
pub fn inspect(&self, prompt: &str) -> GuardVerdict
Inspect a prompt and return a security verdict.
This is the primary entry point. Call it before forwarding a
PromptRequest to the pipeline. If the verdict’s action is
GuardAction::Block, discard the request.
§Arguments
prompt— The raw prompt text to inspect.
§Returns
A GuardVerdict with the recommended action, risk score, and reason.
Sourcepub fn metrics(&self) -> GuardMetrics
pub fn metrics(&self) -> GuardMetrics
Returns a snapshot of inspection metrics.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PromptGuard
impl RefUnwindSafe for PromptGuard
impl Send for PromptGuard
impl Sync for PromptGuard
impl Unpin for PromptGuard
impl UnsafeUnpin for PromptGuard
impl UnwindSafe for PromptGuard
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request