Skip to main content

InjectionClassifier

Trait InjectionClassifier 

Source
pub trait InjectionClassifier: Send + Sync {
    // Required methods
    fn model_id(&self) -> &str;
    fn score(&self, text: &str) -> f64;
}
Expand description

A prompt-injection classifier over a span of (untrusted) text, returning a malicious-probability in [0, 1].

The built-in HeuristicClassifier is always available and dependency-free. A downloadable neural backend (harn-guard) supersedes it at process start via register_injection_classifier, so the default binary never links a model runtime — only a host compiled with the optional backend registers one.

Required Methods§

Source

fn model_id(&self) -> &str

Stable identity surfaced in DetectorVerdict::model and audit trails.

Source

fn score(&self, text: &str) -> f64

Malicious-probability of text, in [0, 1].

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§