New Features
New validate function on Guard
Guard 0.4.0 introduces validate, replacing parse for string validation. It’s clearer and less likely to be misinterpreted. parse is deprecated, so switch to validate now for future compatibility.
Example:
Unlock new tools with the Guardrails Hub CLI:
Interact directly with the Guardrails Hub for expanded functionality. Install:pip install guardrails-ai
Get started: guardrails --help
New Approach to Guard Construction
We’ve introduced a novel way to define and combine guards, simplifying the overall process. The previous method required constructing guards from specific validation types (from_pydantic, from_string), but now you can leverage a validator-first approach with assumed string validation.
Single Validator Usage:
- ValidatorOfChoice: Replace with the actual validator you want to use.
- args: Pass any necessary arguments to the validator constructor.
- llm_api, model, prompt: Provide values for these parameters as usual.
Multiple Validator Usage:
Multiple validators can be combined in two ways: 1. linkinguse:
use_manyfor Concise Composition: