Guardrails AI
A Python framework for adding input/output guards to large language models, detecting and mitigating risks and generating structured data from LLM output.
Guardrails is a Python framework that helps build reliable AI applications by running Input/Output Guards that detect, quantify and mitigate specific types of risk in an application, and by helping generate structured data from LLMs.
Guardrails Hub is a collection of pre-built validators, each measuring a specific type of risk, that can be combined into Guards intercepting the inputs and outputs of an LLM; a Guardrails Index benchmark compares the performance and latency of 24 such guardrails across six common risk categories. After installing the package and the Guardrails Hub CLI, a validator such as a regex match, competitor check or toxic-language check is installed individually and combined into a Guard, which reports validation failures with the specific rule that was broken.
Structured data generation works by defining a Pydantic model representing the desired output shape and asking an LLM to fill it, with Guardrails validating the result. Guardrails is moving its validators to standard PyPI packages installed directly with pip and discontinuing hosted remote inferencing, with a stated cutoff date for the migration.