Skip to main content
TealGuard provides guardrail checks for content safety, including PII detection, prompt injection detection, and content moderation.

Overview

TealGuard executes guardrail checks and returns Decision objects with:
  • Content safety checks (PII, prompt injection, harmful content)
  • Policy integration for unified enforcement
  • Risk scoring based on detected issues
  • Correlation IDs for traceability

Class

Creating a Guard

Standalone Mode

Policy-Driven Mode

Checking Content

Basic Check

Prompt Injection Detection

Content Moderation

Guardrail Results

Integration with TealEngine

PII Detection

Caching

Error Handling

Async/Await Support

Performance

TealGuard targets:
  • < 50ms per check (p99, simple checks)
  • < 200ms per check (p99, with ML models)
  • Parallel execution for multiple guardrails

Best Practices

Always Provide Context

Handle Redaction

Combine with Policy Evaluation

Type Hints