ORVEXA

Guardrails

ORVEXA Guardrails provide real-time content safety filtering, PII detection, and custom rule enforcement for both inputs and outputs of every API request.

PII Detection

Detects and optionally redacts PII such as emails, phone numbers, credit cards, and SSNs.

Content Safety

Classifies and blocks content that violates safety policies (violence, self-harm, illegal content).

Custom Rules

Define your own keyword blocklists, regex patterns, and content policies to enforce organization-specific compliance requirements.

Flexible Actions

Choose what happens when a guardrail is triggered: block the request, redact sensitive data, log a warning, or all three.

Built-in Filters

Filter IDDescription
pii_detectionDetects and optionally redacts PII such as emails, phone numbers, credit cards, and SSNs.
content_safetyClassifies and blocks content that violates safety policies (violence, self-harm, illegal content).
prompt_injectionDetects prompt injection attempts designed to override system instructions.
toxicityScores and filters toxic, abusive, or harassing language in inputs and outputs.
keyword_filterBlocks or flags requests containing custom-defined keywords and phrases.

Action Types

block

Block

Reject the request entirely and return a guardrail error to the caller.

redact

Redact

Replace detected sensitive data with placeholders before sending to the model.

warn

Warn

Allow the request but attach a warning flag in the response metadata.

log

Log

Silently log the violation for audit and review without interrupting the request.

Configuration

Guardrails are configured per-request using the guardrails object in the request body. You can specify input filters, output filters, PII settings, and custom keywords.

Request with guardrailsbash
curl https://api.orvexaproject.com/v1/chat/completions \
  -H "Authorization: Bearer nx-sk-dcfab6de7407c3c5f74fb627" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-chat",
    "messages": [
      {"role": "user", "content": "My email is test@example.com, please help me."}
    ],
    "guardrails": {
      "enabled": true,
      "input_filters": ["pii_detection", "content_safety"],
      "output_filters": ["content_safety", "toxicity"],
      "pii": {
        "redact": true,
        "entities": ["email", "phone", "credit_card", "ssn"]
      },
      "custom_keywords": ["confidential", "internal-only"],
      "action": "block"
    }
  }'

PII Redaction

When PII redaction is enabled and the action is set to "redact", detected entities are replaced with [REDACTED] before the prompt reaches the model.

PII redactionjson
{
  "model": "deepseek-chat",
  "messages": [
    {"role": "user", "content": "Call me at 555-123-4567 or email test@example.com"}
  ],
  "guardrails": {
    "enabled": true,
    "input_filters": ["pii_detection"],
    "pii": {
      "redact": true,
      "replacement": "[REDACTED]"
    },
    "action": "redact"
  }
}
// Messages sent to the model:
// "Call me at [REDACTED] or email [REDACTED]"

Blocked Response

When a guardrail blocks a request, the response includes a guardrails object with details about what was detected.

Blocked responsejson
{
  "id": "chatcmpl-guard-001",
  "object": "chat.completion",
  "model": "deepseek-chat",
  "choices": [],
  "guardrails": {
    "triggered": true,
    "filter": "pii_detection",
    "action": "block",
    "message": "Request blocked: PII detected (email, phone).",
    "detected_entities": [
      { "type": "email", "value": "t***@example.com" }
    ]
  },
  "usage": { "prompt_tokens": 15, "completion_tokens": 0, "total_tokens": 15 }
}