Write the spec of every field in the schema
Lesson 1 of the module "Design the schema" in the course "Get reliable, product-ready AI outputs (JSON, schemas, function calling)".
Lesson objective
By the end of this lesson, you will be able to write an output schema field by field (name, type, required or not, allowed values, description, consumer) and spot the constraints the provider does not guarantee.
Where it fits
Design the schema
Which fields, which types and which allowed values, and how do I let the model say "I don't know"?
Lessons in this module
- Write the spec of every field in the schema (this lesson)
- Let the model say "I don't know" in the schema
What you will learn in the course
This lesson is part of the course Get reliable, product-ready AI outputs (JSON, schemas, function calling)
- Diagnose where free-text output breaks a feature and decide which outputs require a contract.
- Choose between instructions alone, JSON mode, structured outputs and function calling for a given need, and justify the choice.
- Design an output schema (types, enums, required fields, nullable fields, descriptions, "unknown" values) where every field serves a consumer.
- Specify validation (syntax, schema, business rules), retries, handling of refusals and truncation, and the fallback path.
- Version and evolve an output contract without breaking its consumers, accounting for provider differences and the split of roles between PM and developers.
- Build a set of 20 robustness cases and set acceptance thresholds before going to production.
Related courses
- Build an AI assistant for your productAdvanced · ~3 hr
- Design a RAG architecture that fits your productAdvanced · ~3 hr 30 min
- Evaluate an AI feature: test sets, metrics and LLM judgesAdvanced · ~3 hr