Valid Format Evaluator
The Valid Format Evaluator ensures that generated outputs conform to specified format requirements and structural patterns. It validates content structure, syntax, and format compliance for various data types and schemas.

Valid Format Evaluator interface and configuration
Usage Note: Define precise format specifications and validation rules. Consider using JSON Schema for structured data validation when applicable.
Component Inputs
- Generated Output: Content to validate
Example: "Generated text or structured data"
- Format Type: Expected format specification
Example: "JSON", "XML", "CSV", "Custom"
- JSON Schema (Optional): Schema for validation
Example: Detailed schema specification
Component Outputs
- Validation Result: Format compliance status
Example: true/false
- Error Details: Validation error information
Example: "Invalid JSON structure at line 3"
- Suggestions: Format correction recommendations
Example: "Add missing closing bracket"
How It Works
The Valid Format Evaluator uses format-specific validators and parsers to ensure content meets specified requirements. It performs thorough validation against defined rules and schemas.
Validation Process
- Format identification
- Schema validation
- Syntax checking
- Structure verification
- Error detection
- Suggestion generation
Use Cases
- Data Validation: Verify structured data formats
- API Response Validation: Ensure correct response formats
- Document Verification: Check document structure
- Schema Compliance: Validate against schemas
- Format Standardization: Maintain format consistency
Implementation Example
const formatEvaluator = new ValidFormatEvaluator({
generatedOutput: '{"name": "John", "age": 30}',
formatType: "JSON",
jsonSchema: {
type: "object",
properties: {
name: { type: "string" },
age: { type: "number" }
},
required: ["name", "age"]
}
});
const result = await formatEvaluator.validate();
// Output:
// {
// isValid: true,
// errors: [],
// suggestions: []
// }
Best Practices
- Define clear format specifications
- Use comprehensive validation schemas
- Implement proper error handling
- Provide helpful error messages
- Maintain schema versioning