LLM Input Inspection
Use an LLM to inspect prompts and tool output for policy violations, prompt injection, or abuse.
Use an LLM to inspect prompts and tool output for policy violations, prompt injection, or abuse.
This guard evaluates user inputs or tool outputs using an LLM.
It’s highly flexible and can be instructed via the prompt configuration
to look for specific patterns, tones, or policy violations.
Configuration
Section titled “Configuration”| Field | Type | Default | Description |
|---|---|---|---|
prompt | `string | null` | "" |
on_violation | string | "block" | Action to take when a violation is detected. |
on_error | string | "allow" | Action to take when the inspection fails (e.g., LLM error). |
max_chars | integer | 8000 | Maximum characters from the end of the conversation to inspect. |
inspector_model | `string | null` | None |
inspect_roles | array | ["tool", "tool_result", "user"] | Roles to inspect. |
Examples
Section titled “Examples”# Example 1type: llm_input_inspectionconfig: prompt: Block if the user is asking for personal identifiable information (PII). on_violation: block on_error: allow inspector_model: gpt-4o-mini