Skip to main content

Module response_validator

Module response_validator 

Source
Expand description

§Response Validator

Validates LLM responses against a set of declarative ValidationRules. No external regex crate is required; the ValidationRule::MatchesRegex variant implements simple *-wildcard glob matching internally.

§Quick Start

use tokio_prompt_orchestrator::response_validator::{ResponseValidator, ValidationRule};

let validator = ResponseValidator::new();
let rules = vec![
    ValidationRule::MinLength(10),
    ValidationRule::MaxLength(500),
    ValidationRule::ContainsAll(vec!["Rust".to_string()]),
];
let result = validator.validate("Rust is a systems programming language.", &rules);
assert!(result.passed);

Structs§

ResponseValidator
Validates LLM responses against a list of ValidationRules.
ValidationResult
Aggregate outcome of validating a single response.
ValidationViolation
A single failed constraint.

Enums§

ValidationRule
A single constraint that a response must satisfy.