Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Defines LLM output guardrails via RAIL or Pydantic specs to validate, correct, and retry model outputs.
86% 91%+5 ptsof test cases passed
Passed 20 of 22 test cases with the skill, and 19 of 22 without it.
How do you declare an integer field named 'sentiment' within an XML structured output specification?
Uses integer tag with name attribute sentiment
3 of 3 safety checks passed
Guardrails AI provides a guardrails framework for LLM applications with structured output validation, type safety, retry/reprompt logic, and risk management. Uses RAIL (Reliable AI Markup Language) specs or Pydantic models.
uv pip install guardrails-ai
import guardrails as gd
rail_spec = (
'<rail version="0.1">'
'<output>'
' <string name="summary" description="Brief summary" format="length: 1-100"/>'
' <integer name="sentiment" format="valid-choices: {1, 0, -1}"/>'
'</output>'
'<prompt>'
'Summarize this text: {{text}}'
'</prompt>'
'</rail>'
)
guard = gd.Guard.from_rail_string(rail_spec)
raw, validated = guard(text="I loved this movie!")
print(validated) # {"summary": "...", "sentiment": 1}
from pydantic import BaseModel
from guardrails import Guard
class Extraction(BaseModel):
name: str
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.