Repository navigation
Revamp: one llm.py, schemas in place of prefill, prompt caching - #1
Merged
Merged
Conversation
- Route every model call through llm.py (llm.chat); drop temperature, fallback models and %pip cells; clear notebook outputs. - Replace assistant prefill in 05, 07 and 11 with structured output (schema=) and plain instructions. - Add a prompt caching step to 09 (cache_control on a rule book of more than 5,000 tokens, read back with Reply.cached_tokens). - Fix typos, the "final chapter" wording in 10, and lesson names in the README so they match the notebooks. - Rewrite README, AGENTS.md and env.example; pin dependencies with floors from today's lock; Python 3.11. - Makefile titled for this workshop with check and verify targets; Docker image and container named after the repo, mount matches the working folder. - Delete unused hints.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ema fix Claude blocks a schema field named thinking that asks for step by step reasoning. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Param-Harrison
marked this pull request as ready for review
December 2, 2026 22:55
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Revamp of this workshop, following
curriculum/workshop-kit/REVAMP.md(row: practical-prompt-engineering-workshop). The 14 lessons keep their order and story.What changed
llm.pyfrom the kit makes every call. All 14 notebooks callllm.chatand read.text. The copiedget_completionhelpers,%pipcells,DEFAULT_MODELfallbacks and log silencing are gone. Outputs and execution counts are cleared.temperatureremoved from 01, 02, 03, 09 and 10. Current Claude models reject it.json.loadsmay fail to read. It explains why prefill is gone. A new section 4 usesschema=with a pydantic class. Exercise 1 now uses a system prompt, and exercise 2 uses a list schema.prefillargument is dropped.Orderschema replacesprefill="{". Section 3 adds aCheckedOrderschema with athinkingfield first, next to the existing tags version.cache_control. Two questions printReply.input_tokensandReply.cached_tokens.hints.py. No notebook imports it.docs/images/prompt-parts.svg).AGENTS.mdis short now, andCLAUDE.mdis@AGENTS.md.env.examplelists only what the code reads, starting from the kit's file. The Google andDEFAULT_MODELsettings are gone.jupyterlab,litellm>=1.111.1,pydantic,python-dotenv, with floors from today's lock. The dev group hasipykernel,nbclientandnbformat.requires-python = ">=3.11,<3.13", plus a.python-versionfile. Unused packages are dropped: colorama, ipywidgets, langchain-google-genai, mcp, nest-asyncio, pillow and requests.make checkandmake verify.practical-prompt-engineering-workshop. The mount.:/workspacenow matchesWORKDIR, and the venv lives in/opt/venv, so the mount does not hide it. The uv image is pinned, the unused Node.js install is gone, and the port binds to 127.0.0.1 only.Not in this PR:
.github/workflows/check.ymlThe push token here has no
workflowscope, so GitHub refused the kit's workflow file. Please add it from the kit, unchanged:Tested here, with no key
uv run python scripts/check.pyprintscheck: 0 problems.uv sync --locked. Every dependency imports.make setup, thenmake check, then JupyterLab serveshttp://localhost:8888/lab. A call with no key stops with theNo key foundmessage.nbformat.validate, and every code cell parses.litellm.completion, wrapped byllm.py's own meter. The fake asserted that no request sendstemperatureor ends with an assistant message. 05 sentHaikuandHaikusschemas, and 11 sentOrderandCheckedOrder. In 09, the request carriedcache_control, and a faked cache read came back throughReply.cached_tokens.docker compose up -dserved JupyterLab. Inside the container,/workspaceheld the notebooks andimport llmworked. One caveat: this sandbox could not fetch theghcr.io/astral-sh/uv:0.11.32layer, so that one build used a local uv binary in its place.Only a paid run can prove
schema=for the nestedOrderandCheckedOrderclasses in 11.cached_tokensabove 0.make verifywith a key.🤖 Generated with Claude Code