Skip to main content

InputScreen

Trait InputScreen 

Source
pub trait InputScreen: Send + Sync {
    // Required method
    fn screen(
        &self,
        text: &str,
        cfg: &GuardrailsConfig,
    ) -> Option<GuardrailFinding>;
}
Expand description

Pluggable input screen interface. Implement this to replace or supplement the built-in heuristic with a classifier-based screen (e.g. an LLM judge).

Implementations must be Send + Sync for use across async handlers. They should return quickly — the screen runs on every model-input entry point before the LLM call.

Required Methods§

Source

fn screen(&self, text: &str, cfg: &GuardrailsConfig) -> Option<GuardrailFinding>

Screen the given text. Returns the first finding, or None if clean.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§