Skip to content

What's New in Elsai Guardrails

Stay up to date with the latest features and improvements in Elsai Guardrails.

Latest Release

Version 0.1.1 - January 2026

We're excited to announce two powerful new features that expand guardrail capabilities:

Off-Topic Detection

Keep your AI conversations focused and on-track with configurable topic boundaries.

Key Features:

  • Define multiple allowed topics with descriptive guidelines
  • Semantic matching to detect off-topic user inputs
  • Flexible blocking or detection-only modes
  • Perfect for specialized bots and assistants

Learn more about Off-Topic Detection →

Quick Example:

yaml
guardrails:
  check_off_topic: true
  block_off_topic: true
  allowed_topics:
    - name: "Product Support"
      description: "Questions about our products and services"
    - name: "Order Management"
      description: "Order tracking, shipping, and delivery inquiries"

SQL Syntax Validation

Validate SQL queries before execution to catch errors early and improve reliability.

Key Features:

  • Support for 7 major SQL dialects (PostgreSQL, MySQL, SQL Server, SQLite, MongoDB, Oracle, Redshift)
  • Detect syntax errors in user input or LLM-generated queries
  • Prevent malformed queries from reaching your database
  • Essential for text-to-SQL applications

Learn more about SQL Syntax Validation →

Quick Example:

yaml
guardrails:
  check_sql_syntax: true
  sql_dialect: "postgresql"  # or mysql, sqlserver, sqlite, mongodb, oracle, redshift

Configuration Updates

The GuardrailConfig class now includes:

python
class GuardrailConfig:
    """Configuration for guardrail behavior"""
    
    check_toxicity: bool = True
    check_sensitive_data: bool = True
    check_semantic: bool = True
    check_off_topic: bool = False          # NEW
    check_sql_syntax: bool = False         # NEW
    toxicity_threshold: float = 0.7
    block_toxic: bool = True
    block_sensitive_data: bool = True
    block_off_topic: bool = True           # NEW
    allowed_topics: list[dict[str, str]] | None = None  # NEW
    sql_dialect: str = "mysql"             # NEW

Getting Started with New Features

Try Off-Topic Detection

python
from elsai_guardrails.guardrails import GuardrailSystem, GuardrailConfig

config = GuardrailConfig(
    check_off_topic=True,
    block_off_topic=True,
    allowed_topics=[
        {
            "name": "Tech Support",
            "description": "Technical questions and troubleshooting"
        }
    ]
)

guardrail = GuardrailSystem(config=config)
result = guardrail.check_input("What's the weather today?")  # Off-topic, will be blocked

Try SQL Syntax Validation

python
from elsai_guardrails.guardrails import GuardrailSystem, GuardrailConfig

config = GuardrailConfig(
    check_sql_syntax=True,
    sql_dialect="postgresql"
)

guardrail = GuardrailSystem(config=config)
result = guardrail.check_input("SELECT * FROM users WHERE active = true")  # Valid SQL

Previous Features

Core Guardrails

All existing guardrails continue to work seamlessly:

  • Toxicity Detection - Identify and block harmful content
  • Sensitive Data Protection - Detect PII like emails, phone numbers, credit cards
  • Semantic Classification - Prevent jailbreak attempts and malicious requests
  • Multi-LLM Support - Works with OpenAI, Anthropic, Gemini, AWS Bedrock, and more

View Documentation →

Migration Guide

Upgrading from v0.1.0 to v0.1.1 is seamless - all existing configurations work without changes.

Opt-in Features

New features are disabled by default:

yaml
guardrails:
  # Existing checks (enabled by default)
  check_toxicity: true
  check_sensitive_data: true
  check_semantic: true
  
  # New checks (disabled by default - opt-in)
  check_off_topic: false
  check_sql_syntax: false

Adding New Features

Simply enable the features you want:

yaml
guardrails:
  # Enable off-topic detection
  check_off_topic: true
  allowed_topics:
    - name: "Your Topic"
      description: "Topic description"
  
  # Enable SQL validation
  check_sql_syntax: true
  sql_dialect: "database_type"

Resources

Feedback

We'd love to hear your thoughts on the new features! If you have questions, suggestions, or issues:


Ready to get started? Quick Start Guide →

Released under the MIT License.