AI engineering glossary · Prompt context engineering
What is Pydantic validation of LLM output?
Pydantic validation of LLM output: Checking a model's structured reply against a Pydantic model, a Python class that declares fields and types, and turning it into a typed object. Validation errors show exactly what is wrong, which can be fed back to the model for a retry.
Pydantic validation of LLM output: an example
A class Invoice(amount: float, gst: float) rejects a reply where amount is the text 'about 500'.
Related terms
More Prompt context engineering terms
- Quote-first prompting
- ReAct prompting
- Reasoning effort
- Recency bias in prompts
- Refine summarisation
- Reflexion
- Repetition penalty
- Rephrase and Respond
Where you learn it
Pydantic validation of LLM output is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.