Interface returned when type validation fails

Returned when the input value does not conform to the expected type. Contains comprehensive error information designed to be easily understood by both humans and AI systems. Each error in the errors array provides precise details about validation failures, including the exact path to the problematic property, what type was expected, and what value was actually provided.

This detailed error structure is specifically optimized for AI function calling validation feedback. When LLMs make type errors during function calling, these granular error reports enable the AI to understand exactly what went wrong and how to fix it, improving success rates in subsequent attempts.

Example error scenarios:

  • Type mismatch: expected "string" but got number 5
  • Format violation: expected "string & Format<'uuid'>" but got "invalid-format"
  • Missing properties: expected "required property 'name'" but got undefined
  • Array type errors: expected "Array" but got single string value

The errors are used by ILlmFunction.validate() to provide structured feedback to AI agents, enabling them to correct their parameter generation and achieve improved function calling accuracy.

interface IFailure {
    data: unknown;
    errors: IValidation.IError[];
    success: false;
}

Properties

Properties

data: unknown

The original input data that failed validation

Array of detailed validation errors

success: false

Indicates validation failure