UNPKG

llmverify

Version:

AI Output Verification Toolkit — Local-first LLM safety, hallucination detection, PII redaction, prompt injection defense, and runtime monitoring. Zero telemetry. OWASP LLM Top 10 aligned.

255 lines (254 loc) 6.57 kB
{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://github.com/subodhkc/llmverify-npm/schema/verify-result.schema.json", "title": "VerifyResult", "description": "JSON schema for llmverify verify() function output", "type": "object", "required": ["risk", "findings", "engines", "metadata", "limitations"], "properties": { "risk": { "type": "object", "description": "Overall risk assessment", "required": ["level", "action", "score", "confidence"], "properties": { "level": { "type": "string", "enum": ["low", "moderate", "high", "critical"], "description": "Risk level classification" }, "action": { "type": "string", "enum": ["allow", "review", "block"], "description": "Recommended action" }, "score": { "type": "number", "minimum": 0, "maximum": 1, "description": "Numerical risk score (0-1)" }, "confidence": { "type": "number", "minimum": 0, "maximum": 1, "description": "Confidence in the assessment (0-1)" } } }, "findings": { "type": "array", "description": "Array of detected issues", "items": { "$ref": "#/definitions/Finding" } }, "engines": { "type": "object", "description": "Individual engine results", "properties": { "hallucination": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "score": { "type": "number", "minimum": 0, "maximum": 1 }, "signals": { "type": "array", "items": { "type": "string" } } } }, "consistency": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "score": { "type": "number", "minimum": 0, "maximum": 1 } } }, "csm6": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "findings": { "type": "array", "items": { "$ref": "#/definitions/Finding" } }, "categories": { "type": "object", "properties": { "security": { "type": "number", "minimum": 0 }, "privacy": { "type": "number", "minimum": 0 }, "safety": { "type": "number", "minimum": 0 } } } } }, "jsonValidator": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "valid": { "type": "boolean" }, "repaired": { "type": "boolean" } } } } }, "metadata": { "type": "object", "description": "Metadata about the verification", "required": ["version", "timestamp", "latencyMs", "contentLength"], "properties": { "version": { "type": "string", "description": "llmverify version", "pattern": "^\\d+\\.\\d+\\.\\d+$" }, "timestamp": { "type": "string", "format": "date-time", "description": "ISO 8601 timestamp" }, "latencyMs": { "type": "number", "minimum": 0, "description": "Verification latency in milliseconds" }, "contentLength": { "type": "integer", "minimum": 0, "description": "Length of verified content in characters" } } }, "limitations": { "type": "array", "description": "Known limitations of the verification", "items": { "type": "string" } }, "recommendations": { "type": "array", "description": "Actionable recommendations", "items": { "type": "string" } } }, "definitions": { "Finding": { "type": "object", "required": ["category", "severity", "message"], "properties": { "category": { "type": "string", "enum": ["security", "privacy", "safety", "structure", "quality"], "description": "Category of the finding" }, "severity": { "type": "string", "enum": ["low", "medium", "high", "critical"], "description": "Severity level" }, "message": { "type": "string", "description": "Human-readable description" }, "pattern": { "type": "string", "description": "Pattern that triggered the finding" }, "location": { "type": "object", "properties": { "start": { "type": "integer", "minimum": 0 }, "end": { "type": "integer", "minimum": 0 } } }, "metadata": { "type": "object", "description": "Additional context", "additionalProperties": true } } } }, "examples": [ { "risk": { "level": "low", "action": "allow", "score": 0.15, "confidence": 0.85 }, "findings": [], "engines": { "hallucination": { "enabled": true, "score": 0.12, "signals": [] }, "csm6": { "enabled": true, "findings": [], "categories": { "security": 0, "privacy": 0, "safety": 0 } } }, "metadata": { "version": "1.3.0", "timestamp": "2024-12-04T12:00:00.000Z", "latencyMs": 15, "contentLength": 42 }, "limitations": [ "Heuristic-based detection may have false positives/negatives", "Cannot verify factual accuracy without ground truth" ], "recommendations": [ "Content appears safe for display" ] } ] }