Skip to content

Validation

Describe pydantic validation failures for multimodal configuration errors.

describe_pydantic_validation_error(error, *, default_parameter)

Name the offending parameter of a validation failure and the reason it was rejected.

Only the first reported problem is described, so the caller can fix one option at a time. An unknown option is reported against default_parameter, since the option itself is not a valid parameter. A validator's own message is reported without pydantic's Value error, prefix.

Parameters:

Name Type Description Default
error ValidationError

The pydantic validation failure.

required
default_parameter str

Parameter name to report when the failure is not tied to a single valid field, for example an unknown option or a value of the wrong type for the whole model.

required

Returns:

Type Description
tuple[str, str]

tuple[str, str]: (parameter, message) where parameter is the dotted path of the offending field (or default_parameter) and message explains why it was rejected.