Skip to content

Configuration Overview

Elsai Guardrails provides flexible configuration options to customize guardrail behavior for your specific use case.

Configuration Methods

  1. YAML Configuration - Recommended for most use cases
  2. Programmatic Configuration - For dynamic configuration

Configuration Sections

LLM Configuration

Configure the language model provider and settings. See LLM Configuration for details.

Guardrails Configuration

Configure safety checks and validation rules. See Guardrails Configuration for details.

Quick Reference

yaml
llm:
  engine: "openai"           # LLM provider
  model: "gpt-4o-mini"        # Model name
  api_key: "sk-..."           # API key
  temperature: 0.7             # Generation temperature

guardrails:
  input_checks: true           # Validate input
  output_checks: true          # Validate output
  check_toxicity: true        # Enable toxicity detection
  check_sensitive_data: true  # Enable sensitive data detection
  check_semantic: true        # Enable semantic classification
  toxicity_threshold: 0.7     # Toxicity blocking threshold
  block_toxic: true           # Block toxic content
  block_sensitive_data: true  # Block sensitive data

  # PII/PHI detection policy
  pii:
    enabled: true
    input_checks: true
    output_checks: true
    language: en
    default_confidence_threshold: 0.5
    below_threshold_action: flag
    default_action: flag
    default_mask: true
    enable_phi_detection: true
    entity_types:
      - PERSON
      - LOCATION
      - EMAIL_ADDRESS
      - PHONE_NUMBER
      - CREDIT_CARD
      - NRP
      - MEDICAL_LICENSE
      - US_SSN
      - IBAN_CODE
      - IP_ADDRESS
    entity_thresholds:
      PERSON: 0.7
    entity_policies:
      CREDIT_CARD:
        action: block
        mask: true
      US_SSN:
        action: block
        mask: true
      EMAIL_ADDRESS:
        action: flag
        mask: true
      PHONE_NUMBER:
        action: flag
        mask: true
      PHI_MRN:
        action: review
        mask: true
      PHI_PATIENT_ID:
        action: review
        mask: true

  # Token budget enforcement policy
  token_budget:
    enabled: true
    input_checks: true
    output_checks: true
    max_request_tokens: 50
    max_run_tokens: 80
    reserved_output_tokens: 10

Configuration Files

See YAML Configuration for complete configuration file examples.

Released under the MIT License.