Download week05.py, save it in an exercise folder, and run python week05.py --lesson 3. This single practice first exercises a temporary loopback web server. It uses standard-library urllib, json, threading, and http.server; no packages or model are needed for those fixtures. It normally finishes within seconds.
The script checks complete assembly, a represented refusal, length truncation, one throttling retry, an invalid request with no retry, and interruption without completion. It then stops the fixture server. To run actual inference after the setup taught above, use python week05.py --lesson 3 --local-model smollm2:135m. The client contacts only the local Ollama endpoint and requests the one-word answer READY.
Expected real output includes actual_local_model, generated text, completion state, attempts, and available token counts. A completed nonempty answer establishes an actual inference request; inspect whether the one-word task was obeyed separately. The model can produce the wrong content despite successful transport. A traceback or truncation is an uncompleted run to diagnose, not a result to relabel as success. The fixture and real paths are deliberately printed separately so their evidence remains reviewable.