promptdojo_

Messages, roles, and the response — the call AI ships every time — step 7 of 9

AI assumed the response had a top-level text field, but Anthropic returns text nested inside content[0]. The script crashes with a KeyError. Fix line 11 so it prints the reply.

Expected output:

All tests pass.
The break is on line 11 — but read the whole snippet first.

full-screen editor opens — close anytime to keep reading.