Bases: BaseModel
Base class for all Mistral Pydantic models.
Forbids extra attributes, validates default values and use enum values.
Source code in .venv/lib/python3.14/site-packages/pydantic/main.py
| def __init__(self, /, **data: Any) -> None:
"""Create a new model by parsing and validating input data from keyword arguments.
Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be
validated to form a valid model.
`self` is explicitly positional-only to allow `self` as a field name.
"""
# `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks
__tracebackhide__ = True
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
if self is not validated_self:
warnings.warn(
'A custom validator is returning a value other than `self`.\n'
"Returning anything other than `self` from a top level model validator isn't supported when validating via `__init__`.\n"
'See the `model_validator` docs (https://docs.pydantic.dev/latest/concepts/validators/#model-validators) for more details.',
stacklevel=2,
)
|
Build the model from the data after filtering out keys not in the model fields.
Source code in src/mistral_common/base.py
| @classmethod
def model_validate_ignore_extra(cls, data: dict[str, Any]) -> Self:
r"""Build the model from the data after filtering out keys not in the model fields."""
return cls.model_validate(cls._filter_cls_fields(data))
|