Model Online / On-Site
Duration
Modules 6 modules

Course Objective & Scope

When LLM output feeds another system, database or workflow, free text is not enough: you need schema-compliant, verifiable data. The course covers JSON Schema design, OpenAI Structured Outputs strict mode, schema-bound output via tool use in Anthropic models, Gemini response schemas, type-safe models with Pydantic and Zod, and the Instructor library.

For open-weight models, constrained decoding is applied with vLLM guided decoding, Outlines and XGrammar. Participants build an extraction and classification pipeline on invoice, contract or form samples from their organisation and measure its error rate.

Who Should Attend?

  • Backend developers integrating LLM output into applications
  • AI engineers on document processing and data extraction projects
  • Data scientists using LLMs for classification and labelling
  • Prerequisite: Python or TypeScript and basic LLM API usage

Key Takeaways

  • Design LLM-friendly JSON Schemas and Pydantic/Zod models for a use case
  • Configure structured output features correctly across providers
  • Apply constrained decoding with open-weight models
  • Build retry and repair loops that catch validation errors
  • Create an eval set that measures extraction accuracy per field

Curriculum

Why Structured Output?
  • Free text vs JSON mode vs strict schemas
  • Typical use cases: extraction, classification, routing
Schema Design with JSON Schema and Pydantic/Zod
  • Impact of enums, required fields, nested objects and descriptions
  • Schema design patterns that improve model quality
Structured Outputs Across Providers
  • OpenAI strict mode, Anthropic tool use, Gemini response schema
  • Provider-agnostic usage with Instructor
Constrained Decoding with Open-Weight Models
  • vLLM guided decoding, Outlines and XGrammar
  • Quality and speed impact of grammar-based generation
Validation, Repair and Error Handling
  • Retry and re-ask strategies on validation errors
  • Modelling refusals, missing information and uncertainty
Hands-On: Document Extraction Pipeline
  • End-to-end extraction on organisational documents
  • Per-field accuracy measurement and error analysis

Other Courses in This Category

Get in touch