- Extract only the fields you need.
- Use Pydantic validation to keep each value valid.
- Split a complex schema into smaller models you can reuse.
- Use
Fieldwith a descriptive title. - A descriptive title improves extraction quality.
- Test the schema on varied visual inputs.
Mapping Schemas to Task Primitives
- Classification. Use
Literal. Constrain the value to the allowed categories. - Captioning. Use
strfor a text description of the image. Include the style, the context, and a rough word count. - Date. Use
datetime.date. Include the format, for exampleYYYY-MM-DD. - Do not name the field
date. That name is reserved on a PydanticBaseModel. - Use
datetime.datetimewhen the value includes a time, for exampleYYYY-MM-DD HH:MM:SS. - Use
datetime.datewhen the value has no time.