{ "$defs": { "CategoryResult": { "description": "Result for one taxonomy category evaluated by a guardrail.\n\nCategories give multi-label and taxonomy guardrails (DuoGuard, Llama Guard\nS-codes, Azure severities, binary classifiers' label distributions) a\nlossless, uniform home instead of overloading ``explanation``.\n\nExample:\n >>> CategoryResult(name=\"S1\", description=\"Violent Crimes\", triggered=True)", "properties": { "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Description" }, "name": { "title": "Name", "type": "string" }, "score": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Score" }, "severity": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Severity" }, "triggered": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Triggered" } }, "required": [ "name" ], "title": "CategoryResult", "type": "object" }, "GuardrailUsage": { "description": "Provenance and cost envelope for one ``validate()`` call.", "properties": { "completion_tokens": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Completion Tokens" }, "latency_ms": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Latency Ms" }, "model_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Model Id" }, "prompt_tokens": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Prompt Tokens" } }, "title": "GuardrailUsage", "type": "object" }, "SpanResult": { "description": "A character span flagged by a guardrail.\n\nReserved for span-producing guardrails (PII/NER detection, span-level\ntoxicity, token classification). Offsets are zero-based character indices\ninto the validated text.", "properties": { "end": { "title": "End", "type": "integer" }, "label": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Label" }, "score": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Score" }, "start": { "title": "Start", "type": "integer" }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Text" } }, "required": [ "start", "end" ], "title": "SpanResult", "type": "object" } }, "$schema": "https://json-schema.org/draft/2020-12/schema", "description": "Represents the output of a guardrail evaluation with runtime validation.\n\nThis is the single concrete result shape shared by every guardrail\nimplementation, so application code can swap guardrails without changes.\n\nExample:\n >>> output = GuardrailOutput(valid=True, explanation=\"Content is safe\", score=0.05)\n >>> output.valid\n True", "properties": { "action": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Action" }, "categories": { "items": { "$ref": "#/$defs/CategoryResult" }, "title": "Categories", "type": "array" }, "explanation": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Explanation" }, "extra": { "anyOf": [ { "type": "object" }, { "type": "null" } ], "default": null, "title": "Extra" }, "modified_text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Modified Text" }, "raw": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Raw" }, "score": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Score" }, "spans": { "anyOf": [ { "items": { "$ref": "#/$defs/SpanResult" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Spans" }, "usage": { "anyOf": [ { "$ref": "#/$defs/GuardrailUsage" }, { "type": "null" } ], "default": null }, "valid": { "title": "Valid", "type": "boolean" } }, "required": [ "valid" ], "title": "GuardrailOutput", "type": "object" }