guardrails
Adding guardrails to large language models.
What is guardrails?
Adding guardrails to large language models.
Overview of guardrails
What it is
Guardrails is a Python framework that helps build reliable AI applications by performing two key functions: it runs Input/Output Guards that detect, quantify and mitigate specific types of risks, and it helps generate structured data from large language models. The framework works with both proprietary and open-source LLMs and can be used from Python and JavaScript.
Key features
- Runs Input/Output Guards that intercept LLM inputs and outputs to detect and mitigate risks.
- Provides a collection of pre-built risk measures called validators, available through Guardrails Hub.
- Supports combining multiple validators into a single Guard for comprehensive validation.
- Generates structured data from LLMs using Pydantic models, via function calling or prompt optimization.
- Can be set up as a standalone REST API service using Flask and Gunicorn.
Use cases
- Validating LLM outputs to ensure they match a required format (e.g., phone numbers).
- Checking LLM responses for toxic language or mentions of competitors.
- Generating structured JSON data from LLMs, such as pet names with species and name fields.
- Deploying guardrails as a microservice for integration into larger applications.
Getting started
Install Guardrails with pip:bashpip install guardrails-aiConfigure the Guardrails Hub CLI:bashguardrails configureInstall a specific guardrail from the Hub:bashpip install guardrails-ai-regex-matchFor full details on creating guards and generating structured data, see the repository README.
License and pricing
Guardrails is open source under the Apache-2.0 license. Pricing type is open_source.
Based on the project's public README and repository metadata.