Python dictionaries
Frame the model-run dictionary experiment
Page 1 sets a falsifiable claim for the model-run record dictionary before any implementation work begins.
1Try it yourself
Playground
Dict drill
Chat APIs speak in dicts. Fill the missing key, then nest a messages list.
{ "???": "assistant", "content": "Hello!" }2Learn the idea
Read
Name the deliverable and claim
Success is not “I followed the tutorial.” Success is producing evidence that: required keys name/accuracy/ready/owner exist and optional version falls back safely. The accepted input is narrow on purpose: named fields for one model run, including an optional version. That narrowness is what lets you inspect every field and prevents a toy demo from being narrated as a production system.
Record the baseline you must beat: a handwritten field list before coding the dict. If the finished artifact cannot beat that baseline on the fixture below, stop and revise the claim before writing more code.
Read
Inventory the fixture
fields=['name','accuracy','ready','owner','version?']
print({'required':fields[:4],'optional':['version']})
Expected evidence: required four fields and optional version. Treat the printout as a claim about this fixture, not as proof that the toolchain merely started.
Read
Spot misleading success early
For the model-run record dictionary, a decorative win often looks like a clean run that never checks assert required keys; .get('version','unversioned') returns a string. Write the metric down now so later pages cannot redefine success after the fact. Also note the operational threat you will eventually gate on: serializing secrets (API keys) into the run record JSON.
Read
Lab notebook: claim before code
For python-dictionaries, write the claim on a sticky note in this exact shape: “Given named fields for one model run, including an optional version, the model-run dictionary will …”. Fill the ellipsis with the observable part of: required keys name/accuracy/ready/owner exist and optional version falls back safely. Tape the baseline beside it: a handwritten field list before coding the dict. If someone later replaces your metric with a vibe check, the sticky note is how you push back.
Also sketch the one-sentence user story: a person uses this output to store one training run so later code can read named fields without positional guessing. If that sentence needs a dashboard, a model zoo, or five services, the lab scope is too wide—shrink the fixture (name='ready-v1', accuracy=0.91, ready=True, owner='ml-lab') until the story fits on one screen.
Read
Worked judgment
Decide now whether live network calls are allowed on page 1. For this lab they usually are not; inventory and contracts should run offline against name='ready-v1', accuracy=0.91, ready=True, owner='ml-lab'. Note the metric you will eventually require (assert required keys; .get('version','unversioned') returns a string) so page 4 cannot invent a softer target. The characteristic failure to keep in mind is KeyError on missing version, or silent overwrite of accuracy with a string.
Read
Why this stage matters for the model-run dictionary
At the experiment brief stage for python-dictionaries, the job is narrower than finishing a product demo. You are creating one progressive evidence piece about name='ready-v1', accuracy=0.91, ready=True, owner='ml-lab' that later pages inherit without redefining success. Keep that fixture small enough to inspect by hand, keep outputs copy-pasteable as text, and refuse to narrate this baseline as if it were a production SLA: a handwritten field list before coding the dict.
For this page specifically, success looks like a falsifiable claim and baseline written before coding while still centering the user decision to store one training run so later code can read named fields without positional guessing. If you cannot point to a file, command, or assertion that proves that for the model-run dictionary, stay on this page instead of advancing.
Go deeper
Before you start
Why this matters
On paper, write the user decision this lab supports: store one training run so later code can read named fields without positional guessing. Then write one sentence naming what could look successful while actually being wrong for this claim—focus on KeyError on missing version, or silent overwrite of accuracy with a string. Keep both sentences beside the fixture inventory you run next.
In the wild
See how this idea shows up as a product and a company — then come back to the lesson. Skills transfer across vendors.
Related lessons
Check your understanding
Page assessment
Answer from memory. Completion is saved from this evidence, not from opening the next page.
All responses are required.