AI GitHub
Guardrails AI for validating generated output
Apply validators to model outputs before downstream code consumes them.
Key Takeaways
- The library represents expected structures and validators for outputs.
- Pick validators that can check facts or business rules your application understands.
- Use a response schema with one deterministic business rule and inject known failures.
- Validators differ in coverage and dependencies.
How it works
The library represents expected structures and validators for outputs. Reasking or other configured actions can respond to certain validation failures.
What you need
Pick validators that can check facts or business rules your application understands. Test their configured failure action before allowing any output to reach a downstream tool.
What to try first
Use a response schema with one deterministic business rule and inject known failures. Log which validator fired and what downstream code received.
Send a syntactically correct object with a value that breaks a business rule. It is a useful test of the difference between output structure and operational safety.
Where to look for failures
Validators differ in coverage and dependencies. Handle unavailable or uncertain validators explicitly, and avoid assuming that a valid shape implies factual correctness.
Related Franklin pages
Separate policy checks, structured output validation and data redaction. Apply a narrowly defined test to each layer before measuring the combined application behavior.
- Identify likely personal information in text and apply redaction or replacement rules. Presidio for detecting and transforming personal data
- Define checks and conversational flows around an application's model calls. NeMo Guardrails for policy around model conversations
For broader questions about the risks of deploying AI systems, see Franklin’s glossary. AI safety
Project documentation
Try it for your workflow
Explore the project’s documentation for setup and usage, or save this page to a collection for later.
Read the project documentation ↗