Skip to content

Update prompt-engineering materials for the rewritten tutorial - #851

Draft
realpython-bot wants to merge 1 commit into
masterfrom
prompt-engineering-update
Draft

realpython-bot wants to merge 1 commit into
masterfrom
prompt-engineering-update

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Materials for the Prompt Engineering: A Practical Example full update (Trello 1513, CMS post 2143).

Draft on purpose

Don't merge until the updated tutorial goes live. The current live article still documents the old project, so merging this now would break it.

What changed

The tutorial was rewritten around a different project, so this replaces the folder's contents rather than editing them.

Removed (old sentiment-analysis/sanitizing project): app.py, settings.toml, settings-final.toml, chats.txt, sanitized-chats.txt, testing-chats.txt, sanitized-testing-chats.txt

Added:

File Purpose
classify.py Model call, result schema, error handling
try_prompt.py Runs a prompt on a single conversation
cases.py Development and held-out conversations with expected labels
evaluate.py Scores a prompt against the development cases
evaluate_test.py Scores a prompt against the held-out cases
baseline.txt / policy.txt / examples.txt The three prompts the tutorial builds up

Updated: README.md rewritten for the new project, requirements.txt pinned to openai==3.14.1 and pydantic==2.13.5 (was openai==1.13.3).

Verification

Every script was run against the live OpenAI API on Python 3.14.7, using the files exactly as committed:

  • try_prompt.py -> correct label
  • evaluate.py baseline.txt -> 5/6 labels
  • evaluate.py policy.txt -> 6/6 labels
  • evaluate.py examples.txt -> 6/6 labels
  • evaluate_test.py policy.txt -> 4/4 labels

Exact-quote scores vary between runs, which is the point the tutorial makes about rerunning a comparison before attributing a difference to your prompt.

Note on model pinning

classify.py uses the gpt-5.6-luna alias. The 5.6 and 6 families currently have no dated snapshots (confirmed via client.models.list()), so there's nothing to pin to. The scripts record which model answered each request instead, and the README explains the alias/snapshot distinction.

🤖 Generated with Claude Code

The tutorial has been rewritten around a different project. It now
classifies support conversations against an explicit follow-up policy
using the Responses API with structured output, and evaluates prompts
against development and held-out cases.

Replace the old sentiment/sanitizing project (app.py, settings.toml,
chats.txt and friends) with the new one:

- classify.py, try_prompt.py, cases.py, evaluate.py, evaluate_test.py
- baseline.txt, policy.txt, examples.txt
- requirements.txt pinned to openai==3.14.1 and pydantic==2.13.5
- README rewritten for the new project

All scripts were run against the live API on Python 3.14.7.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant