Skip to content

Release Notes

Version 0.1.1 (January 2026)

New Features

Off-Topic Detection

A powerful new guardrail that helps maintain focused conversations by detecting when user input deviates from allowed topics.

What's New:

  • Configure multiple allowed topics with names and descriptions
  • Semantic similarity matching for intelligent topic detection
  • Flexible blocking modes (block or detect-only)
  • Perfect for specialized chatbots and domain-specific assistants

Configuration:

yaml
guardrails:
  check_off_topic: true
  block_off_topic: true
  allowed_topics:
    - name: "Customer Support"
      description: "Product questions, order help, and customer service"
    - name: "Technical Issues"
      description: "Installation, troubleshooting, and technical problems"

Python API:

python
config = GuardrailConfig(
    check_off_topic=True,
    block_off_topic=True,
    allowed_topics=[
        {"name": "Support", "description": "Customer support topics"}
    ]
)

Use Cases:

  • Customer service bots focused on specific products
  • Educational assistants maintaining subject boundaries
  • HR assistants handling specific policy areas
  • Domain-specific tools with clear functional scope

Full Documentation →

SQL Syntax Validation

Validate SQL query syntax before execution, catching errors early and improving application reliability.

What's New:

  • Support for 7 major SQL dialects
  • Syntax validation for user input or LLM-generated queries
  • Prevent malformed queries from reaching your database
  • Essential for text-to-SQL and query builder applications

Supported Dialects:

  • PostgreSQL
  • MySQL/MariaDB
  • Microsoft SQL Server
  • SQLite
  • MongoDB
  • Oracle Database
  • Amazon Redshift

Configuration:

yaml
guardrails:
  check_sql_syntax: true
  sql_dialect: "postgresql"  # Choose your database dialect

Python API:

python
config = GuardrailConfig(
    check_sql_syntax=True,
    sql_dialect="mysql"
)

Use Cases:

  • Text-to-SQL applications with natural language queries
  • SQL query builders and validation tools
  • Database migration script validation
  • Query validation APIs and services

Full Documentation →

Configuration Updates

New GuardrailConfig Fields:

python
class GuardrailConfig:
    check_off_topic: bool = False          # Enable off-topic detection
    check_sql_syntax: bool = False         # Enable SQL syntax validation
    block_off_topic: bool = True           # Block off-topic inputs
    allowed_topics: list[dict[str, str]] | None = None  # Allowed topics list
    sql_dialect: str = "mysql"             # SQL dialect for validation

Backward Compatibility: All new features are disabled by default. Existing configurations continue to work without any changes.

Documentation Updates

New Documentation:

Updated Documentation:

Migration Guide

From v0.1.0 to v0.1.1

No breaking changes! All v0.1.0 configurations work in v0.1.1 without modification.

To use new features, simply opt-in:

yaml
# Your existing config continues to work
guardrails:
  check_toxicity: true
  check_sensitive_data: true
  check_semantic: true

# Optionally add new features
  check_off_topic: true
  allowed_topics:
    - name: "Support"
      description: "Customer support topics"
  
  check_sql_syntax: true
  sql_dialect: "postgresql"

Configuration Recommendations

For Customer Support Bots:

yaml
guardrails:
  check_toxicity: true
  check_sensitive_data: true
  check_off_topic: true  # Keep conversations focused
  block_off_topic: true
  allowed_topics:
    - name: "Product Support"
      description: "Questions about products and services"

For Text-to-SQL Applications:

yaml
guardrails:
  input_checks: false
  output_checks: true
  check_sql_syntax: true  # Validate generated SQL
  sql_dialect: "postgresql"

For General Purpose Assistants:

yaml
guardrails:
  check_toxicity: true
  check_sensitive_data: true
  check_semantic: true
  # Leave new features disabled for unrestricted conversation

Examples

Off-Topic Detection Example

python
from elsai_guardrails.guardrails import LLMRails, RailsConfig

yaml_content = """
llm:
  engine: "openai"
  model: "gpt-4o-mini"
  api_key: "sk-..."

guardrails:
  check_off_topic: true
  block_off_topic: true
  allowed_topics:
    - name: "Travel Planning"
      description: "Questions about destinations, itineraries, bookings, and travel tips"
    - name: "Hotel Recommendations"
      description: "Advice on accommodations, hotel reviews, and booking options"
"""

config = RailsConfig.from_content(yaml_content=yaml_content)
rails = LLMRails(config=config)

# On-topic: passes
response = rails.generate(
    messages=[{"role": "user", "content": "What are the best hotels in Paris?"}]
)

# Off-topic: blocked
response = rails.generate(
    messages=[{"role": "user", "content": "How do I fix my computer?"}]
)

SQL Syntax Validation Example

python
from elsai_guardrails.guardrails import LLMRails, RailsConfig

yaml_content = """
llm:
  engine: "openai"
  model: "gpt-4o-mini"
  api_key: "sk-..."

guardrails:
  output_checks: true
  check_sql_syntax: true
  sql_dialect: "mysql"
"""

config = RailsConfig.from_content(yaml_content=yaml_content)
rails = LLMRails(config=config)

# Ask LLM to generate SQL
response = rails.generate(
    messages=[{
        "role": "user",
        "content": "Write a SQL query to get all active users"
    }]
)

# Generated SQL is automatically validated
if response.output_result.passed:
    print("Valid SQL:", response.response)
else:
    print("Invalid SQL detected:", response.output_result.message)

Bug Fixes

None - this is a feature release.

Performance Improvements

  • Optimized semantic similarity calculations for off-topic detection
  • Efficient SQL parsing with minimal overhead
  • Improved overall guardrail processing speed

Dependencies

No new external dependencies required. All new features use existing infrastructure.

Resources


Version 0.1.0

Version 0.1.0 (Initial Release)

Core Features:

  • Toxicity detection with configurable thresholds
  • Sensitive data detection (PII, emails, phone numbers, etc.)
  • Semantic classification for jailbreak and injection attempts
  • Multi-LLM support (OpenAI, Anthropic, Gemini, AWS Bedrock)
  • Flexible YAML-based configuration
  • Python API with sync and async support
  • Separate input/output validation
  • Detailed result reporting

LLM Providers Supported:

  • OpenAI (GPT-3.5, GPT-4)
  • Azure OpenAI
  • Anthropic Claude
  • Google Gemini
  • AWS Bedrock

Documentation:

  • Complete API reference
  • Configuration guides
  • Integration examples
  • Best practices

Support

For questions, issues, or feature requests:


Latest Version: 0.1.1 | Release Date: January 2026

Released under the MIT License.