Skip to content

Fix outdated response access syntax in Basic Prompt Structure notebooks#83

Open
iskysun96 wants to merge 1 commit intoanthropics:masterfrom
iskysun96:worktree-fix-outdated-syntax
Open

Fix outdated response access syntax in Basic Prompt Structure notebooks#83
iskysun96 wants to merge 1 commit intoanthropics:masterfrom
iskysun96:worktree-fix-outdated-syntax

Conversation

@iskysun96
Copy link
Copy Markdown

Summary

  • Replace response[0].text with response.content[0].text in all three variants of 01_Basic_Prompt_Structure.ipynb
  • The old response[0].text syntax no longer works with the current Anthropic Python SDK — the correct way to access response text is response.content[0].text
  • Affects: Anthropic 1P, AmazonBedrock/anthropic, and AmazonBedrock/boto3 notebooks (4 cells each, 12 total)

Test plan

  • Open each modified notebook and verify cells render correctly
  • Run the intentionally-broken example cells (malformed messages) and confirm they still raise the expected API error
  • Run the working example cells and confirm response.content[0].text returns Claude's response correctly

🤖 Generated with Claude Code

…books

Replace `response[0].text` with `response.content[0].text` across all
three variants (Anthropic 1P, AmazonBedrock/anthropic, AmazonBedrock/boto3).
The old syntax no longer works with the current Anthropic Python SDK.

Co-Authored-By: Claude Opus 4.6 (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