Pipeline. The examples run without an LLM provider or API key.
Start with prompt injection detection, then add sensitive topic filtering and OpenTelemetry guardrail metrics.
1
Initialize guardrails
Evaluate a prompt with Combine checks in a pipeline:A For more guardrail options, explore our Guardrails Guide.
PromptInjection:- Python
- Typescript
example.py
Output
Pipeline evaluates its guards in order and stops when a guard returns deny. For other checks, use specific guardrails; TopicRestriction requires a user-provided classifier and an allowed or denied topic list:Prompt injection detection
Detect and block malicious prompt injection attacks and jailbreak attempts
Sensitive topic filtering
Filter sensitive content including personal data, financial information, and confidential topics
Topic restriction
Restrict LLM responses to approved topics and prevent off-topic conversations
2
Track AI Guardrail metrics
Initialize OpenLIT with either method below, then evaluate prompts through a Metrics are sent to the same OpenTelemetry backend configured during instrumentation, check our supported destinations for configuration details.
Pipeline. The pipeline emits per-guard metrics when metrics are enabled and configured. It adds guard.evaluation events only to an active recording span; the standalone examples below demonstrate metrics. No collect_metrics guard argument is needed.- Zero-Code instrumentation
- Manual instrumentation
No code changes needed - instrument via CLI:Then in your application:
Integrations
60+ AI integrations with automatic instrumentation and performance tracking
Create a dashboard
Create custom visualizations with flexible widgets, queries, and real-time AI monitoring
Manage prompts
Version, deploy, and collaborate on prompts with centralized management and tracking

