Schema validation

Schema validation checks that a model output follows the expected structure: required fields, types, allowed values. An output that fails validation is rejected before being used or displayed, because a model can produce an invalid format.

Example

from pydantic import BaseModel
class Avis(BaseModel):
    sentiment: str
    score: float

Related concepts

The whole glossary