Validators play a crucial role in ensuring the quality and integrity of parameters within the AI generated
outputs.
They serve as quality controllers for the schemas specified in our rail specs, verifying whether an
output aligns with our predefined criteria.
If an output fails to meet this criteria, validators initiate corrective actions as defined in the
rails pack.
Imagine validators as meticulous inspectors scrutinizing every output that flows through the system.
When applied to a property in a schema, they evaluate the value against predefined criteria.
A successful evaluation results in a pass result signaling compliance.
However, if the evaluation fails, a failed result prompts the execution of corrective actions outlined
in the rails pack.
This example defines validator for a total cost field, ensuring it represents the total cost of services
and is never below zero.
If the cost is less than the minimum, the exception shall be raised.