Guardrails
Examples for input/output safety checks and policy enforcement.
| Example | Description |
|---|---|
| DeepKeep AI Firewall | Check input and output with your configured DeepKeep deployment. |
| Custom Guardrail | Use a keyword-based BaseGuardrail pre-hook to reject configured terms. |
| OpenAI Moderation | Block flagged input with OpenAIModerationGuardrail as a pre-hook, including custom category lists and image moderation. |
| Output Guardrail | Reject responses under 20 characters with a post-hook that raises OutputCheckError. |
| PII Detection | Reject or mask the configured PII patterns in input. |
| Prompt Injection | Check recognized prompt-injection patterns before model execution. |
| Mixed Hooks and Guardrails | Combine a logging pre-hook with PIIDetectionGuardrail; blocked runs return RunStatus.error instead of raising. |