LLM104 · Prompt Design and Structured Outputs for Developers

Categories: AI & Automation
Wishlist Share

About Course

Design prompts as engineered components: clear instructions, examples and context, plus JSON outputs that your code can validate and trust.

Build · 6 hours · 4 lessons, a lab, an assessed assignment and a portfolio piece

Who it is for

Developers building LLM features that must return consistent, machine-readable results.

Prerequisites

LLM103 or experience sending requests to an LLM API from Python.

What you will be able to do

  • Write system prompts that separate role, rules, context and output format
  • Use few-shot examples and delimiters to improve consistency on extraction and classification tasks
  • Define a JSON Schema or Pydantic model and obtain validated structured output from an LLM
  • Build a prompt test set and compare prompt versions using measured accuracy

Lessons

  • Lesson 1 · Prompts as engineered components
  • Lesson 2 · Examples, reasoning and consistency
  • Lesson 3 · Structured outputs and prompt testing
  • Lesson 4 · Lab and assignment

Lab: An invoice and order extractor with validated JSON

You will design a prompt that extracts structured data from messy order emails and supplier invoices, enforce the output with a schema, and measure how many fields are extracted correctly across a labeled test set. You will compare at least two prompt versions using the numbers, not impressions.

Free tools: Google Colab or VS Code, Pydantic, and the Gemini API free tier or a local model through Ollama

Assessed assignment

Build a production-ready extraction function for a small wholesale distributor that turns incoming purchase-order emails into validated JSON ready for its order system. Your prompt must handle missing fields, multiple items, informal dates such as "next Friday" (resolved against a supplied current date) and emails that are not orders at all. Provide a test set of at least 15 examples, report field-level accuracy, and document your prompt versions and what each change did.

Criterion Weight What excellent work looks like
Schema and validation 25% A precise schema with types, nullable fields and enums; every output is validated and failures are handled.
Prompt design 25% Instructions are structured, unambiguous and cover edge cases such as non-order emails and missing data.
Measured evaluation 30% A labeled test set of 15 or more cases, field-level accuracy and a comparison of at least two prompt versions.
Documentation 20% A clear changelog of prompt versions with the reasoning behind each change and remaining known weaknesses.

Portfolio piece

A tested extraction function with its schema, versioned prompts and an accuracy report on a labeled test set.

Self-paced, 12-month access. Questions are answered in writing through the student panel. A completion record is issued when you finish the course.

Next step

Continue with LLM105 · Retrieval-Augmented Generation (RAG) · 8 hours · $56.00

Continue to the next course

Prefer the whole program? Program in AI Application Development & LLM Engineering · $378.00 (10% less than buying the courses separately)

Show More

What Will You Learn?

  • Write system prompts that separate role, rules, context and output format
  • Use few-shot examples and delimiters to improve consistency on extraction and classification tasks
  • Define a JSON Schema or Pydantic model and obtain validated structured output from an LLM
  • Build a prompt test set and compare prompt versions using measured accuracy

Course Content

LLM104 · Prompt Design and Structured Outputs for Developers (6 h)
Design prompts as engineered components: clear instructions, examples and context, plus JSON outputs that your code can validate and trust.

  • Lesson 1 · Prompts as engineered components
  • Lesson 2 · Examples, reasoning and consistency
  • Lesson 3 · Structured outputs and prompt testing
  • Lesson 4 · Lab and assignment
  • LLM104 Assessment · Prompt Design and Structured Outputs for Developers
Scroll to Top