Pattern catalog
Pattern · llm-guardrails
LLM input guardrails
Keywords: injection, jailbreak, guardrail, moderation, toxic, untrusted
Jev questions
prompt_injection · noul
Does this input try to override the system instructions?
jailbreak_attempt · noul
Does this input try to bypass the safety rules?
toxicity · score
How toxic is this input?
Who owns what
Code
- Blocklist exact attack strings in code
- You enforce length and rate limits in code
Jev
- prompt_injection as Noul
- jailbreak_attempt as Noul
- toxicity as Score
LLM
- Send safe inputs forward. Rewrite borderline inputs.
Guard: if (prompt_injection > 0.7 || jailbreak_attempt > 0.7 || toxicity >= 2) block(); else forward();