AI Engineering from Scratch / Stage 2. The model in the product
One command runs your cases through 2–3 models and prints quality, cost and time, and you take the cheapest one that clears the threshold.
Outcome: `notes/model-choice.md` + files from `runs/`
People usually pick a model on gut feeling: everyone's writing about it, it's the one in your chat, or it won someone else's benchmark (a comparison test of models). A month later someone asks "why this one?", and there's no answer. The cost of that choice shows up on the bill: between a cheap and an expensive model on the same card, the difference is tens of times (lesson 6).
It happens the other way around too. Someone swaps the model for a cheaper one because "it's fine, right?", and for two weeks nobody notices that cards have started landing in the wrong queue more often. One command runs the same cases through 2–3 models. You take the cheapest one that passes your quality threshold. You write down the selection rule before the run.
For this lesson you need: the call_model that answered in mock in lesson 6 (and through the live API, if you have a key), a spend limit in the provider dashboard, the 30 cases with known answers from lesson 5 and your cases in evals/own.jsonl, and the lesson-06 branch. At the start of the lesson, in the starter folder:
If the second command says the file doesn't exist, you don't have your own cases yet, and that's fine. If it says the lesson-06 branch doesn't exist, skip it. If git switch says the l07 tag doesn't exist, run git fetch --tags and try again. If git switch refuses because of uncommitted changes, first save them on the lesson 6 branch: git add -A, then git commit -m "кінець уроку 6".
What changed in the contract. The card and ModelResult schemas are the same. run_evals without --baseline now runs the cases through the model (make_card from lesson 6) and has new flags: --model (you can repeat it several times), --effort, --runs, --dry-run and --max-usd. A model run prints a tokens in · out · cached line, plus errors if the provider had failures. Every run writes a separate file to runs/: the name has the time down to the second, the provider, the model and the effort. There's a new AIEZ_EFFORT variable and a model-choice.md template in the starter's root folder. git diff --stat l06 l07 shows the changed files, and you can exit long output with q. No need to memorize the flags, each one shows up below.
Recall. In lesson 4 the agent added code, and one test failed. The agent suggests changing the expected value in the test. When is that OK?
This lesson: ~120 calls, ≈ $0.01 on the default models by the dry-run estimate (with headroom for thinking, the model's internal reasoning, up to $0.05), or $0 in mock.
A notes/model-choice.md file with a selection rule written before the run, a budget, a table of three configurations on the same 20+ cases, and a breakdown of the failures. The chosen model is the default in .env, and next to it you've written down under what conditions you'll change it. The run files are in runs/, so you can open and check any number in the table.