Guardrails AI

Active
GitHub Python Apache-2.0

Description

Guardrails AI adds programmable guardrails to large language models, ensuring reliability and safety through input/output validation, structured data extraction, and custom validators.

Key Features

  • Input/Output Guards — detect, quantify, and mitigate specific risk types in LLM applications
  • Guardrails Hub pre-built validators — RegexMatch, CompetitorCheck, ToxicLanguage and more out of the box
  • Pydantic structured output — enforce LLM output format via function calling or prompt optimization
  • Composable Guard with multiple validators — chain validation rules within a single Guard
  • Guardrails Server mode — Flask-based service with REST API and OpenAI SDK compatible endpoints
  • Guardrails Index benchmark — performance and latency comparison of 24 guardrails across 6 categories

Use Cases

💡 Deploy Output Guards in customer service to filter toxic, discriminatory, or competitor-leaking replies
💡 Use Pydantic Guards to extract structured data (user info, product attributes) from LLM output
💡 Provide a unified LLM safety validation microservice via Guardrails Server for the team
💡 Compliance-check every step's input/output in Agent workflows
💡 Build a Content Moderation pipeline detecting toxic language and competitor mentions simultaneously

Quick Start

Install with pip install guardrails-ai, run guardrails configure to set up the CLI, install validators via guardrails hub install hub://guardrails/regex_match, then use Guard().use(RegexMatch(...)).validate(input) in your code.

Related Projects

Related Articles