Expand description
Built-in reference guards for Wardline.
Deliberately few and dependency-light: enough to prove the
wardline_core::Guard trait works for both general application actions
and LLM calls, not a comprehensive guard library. Nothing here pulls in an
async runtime or a network client. The classifier adapter is a trait so
a downstream crate can wrap Llama Guard or a hosted API without dragging
those dependencies into this one.
All text guards use Input = str and Output = String, so they compose
in one wardline_core::Pipeline.
| Type | Role |
|---|---|
RegexBlockGuard | Block on a pattern match. |
RegexRedactGuard | Rewrite matches and return Verdict::Modify. |
RateLimitGuard | In-process token bucket, keyed from Context. |
PiiGuard | Baseline email / phone / SSN detector — not compliance-grade. |
PromptInjectionGuard | Cheap jailbreak-phrase heuristic. |
ClassifierAdapter | Plug an external model in as a Guard. |
Re-exports§
pub use llm::Classification;pub use llm::ClassifierAdapter;pub use llm::OutputClassifier;pub use llm::PromptInjectionGuard;
Modules§
- llm
- LLM-oriented reference guards and the classifier adapter.
Structs§
- PiiGuard
- Scans for email, US-ish phone, and SSN-shaped tokens.
- Rate
Limit Guard - In-memory token-bucket limiter, keyed by a string field on
Context. - Regex
Block Guard - Blocks the action when
patternmatches anywhere in the input. - Regex
Redact Guard - Rewrites every match of
patternand returnsVerdict::Modify.
Enums§
Constants§
- DEFAULT_
MAX_ KEYS - Default cap on distinct keys remembered at once.