pub struct GuardrailDetection {
pub category: String,
pub description: String,
pub severity: DetectionSeverity,
pub confidence: Option<f64>,
pub span: Option<TextSpan>,
}Expand description
A single guardrail detection (prompt injection attempt, PII instance, etc.)
Fields§
§category: StringCategory of detection (e.g., “prompt_injection”, “ssn”, “credit_card”)
description: StringHuman-readable description of what was detected
severity: DetectionSeveritySeverity level
confidence: Option<f64>Confidence score for this detection (0.0 - 1.0)
span: Option<TextSpan>Location in content where detection occurred
Implementations§
Source§impl GuardrailDetection
impl GuardrailDetection
Sourcepub fn new(category: impl Into<String>, description: impl Into<String>) -> Self
pub fn new(category: impl Into<String>, description: impl Into<String>) -> Self
Create a new detection
Sourcepub fn with_severity(self, severity: DetectionSeverity) -> Self
pub fn with_severity(self, severity: DetectionSeverity) -> Self
Set severity
Sourcepub fn with_confidence(self, confidence: f64) -> Self
pub fn with_confidence(self, confidence: f64) -> Self
Set confidence
Trait Implementations§
Source§impl Clone for GuardrailDetection
impl Clone for GuardrailDetection
Source§fn clone(&self) -> GuardrailDetection
fn clone(&self) -> GuardrailDetection
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 GuardrailDetection
impl Debug for GuardrailDetection
Source§impl<'de> Deserialize<'de> for GuardrailDetection
impl<'de> Deserialize<'de> for GuardrailDetection
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for GuardrailDetection
impl RefUnwindSafe for GuardrailDetection
impl Send for GuardrailDetection
impl Sync for GuardrailDetection
impl Unpin for GuardrailDetection
impl UnwindSafe for GuardrailDetection
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<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