Capstone 1
Structured research assistant
A command-line or web assistant that reads an article, streams its progress, and returns findings as validated JSON: key findings, named entities and a confidence score. It works with a hosted API or a local open-weights model behind the same interface.
What you build
- A prompt template with variables for the article and the output rules
- A typed schema (Pydantic or dataclasses) mapped to a strict JSON Schema
- Streaming output with server-sent events and a progress line
- Validation with up to two repair retries, and a clear failure when they run out
- A provider switch: hosted API or a local runner such as Ollama, same code path
- A 20-article test set and a script that scores it
Finish these lessons first
- 1.2 Pydantic models and runtime validation
- 1.6 Streaming with server-sent events
- 1.7 Retries with exponential backoff and jitter
- 6.4 Picking settings for extraction vs creative work
- 11.5 Message roles: system, developer and user
- 14.2 Constrained decoding and strict schema modes
- 14.8 Refusals, truncation and validation retries
- 15.5 Prompt templates with variables
- 30.7 Desktop runners: Ollama, LM Studio and llama.cpp
Acceptance criteria
- Schema-valid outputs
- 20 of 20 articlesValidate every output against the schema; retries count, silent fixes don't.
- Time to first token
- under 1.5 s on the hosted pathLog TTFT per request and report the 90th percentile.
- Failure handling
- no crash on truncated or refused outputFeed three broken cases and show the retry or the clear error.
Stretch: Add a confidence threshold below which the assistant says it is unsure instead of answering.