SecurityIntermediate

Pre-Flight Policy Check

Scan user inputs for PII or policy violations before sending them to your main LLM.

The Problem

Employees or users might inadvertently send sensitive data (PII) or inappropriate content to your AI models.

The Solution

Create a 'Guardrail Route' using a fast, cheap model (like Haiku or GPT-3.5) to scan the input. If it passes, your app proceeds to the main execution.

The Prompt

system
You are a content safety filter. Analyze the input for: 1. PII (Emails, Phone Numbers, SSN) 2. Hate Speech 3. Competitor Mentions. Return JSON: { "safe": boolean, "reason": string }.
user
Analyze this input: {{user_input}}

Implementation Guide

Create the Guardrail Prompt

Define a prompt that strictly checks for your specific policy violations. Ask for a JSON response for easy parsing.

Chain in Your App

In your application code, call this Guardrail Route first. Only if `safe: true` is returned, proceed to call your main generation Route.

Example Output

{ "safe": false, "reason": "Contains PII (Phone Number)" }

Configuration

anthropic
claude-3-haiku
0
Deploy this Recipe

One-click deploy to PromptRail