From 9cb46969d74d01dd36c48986df6e0bf73abcbf26 Mon Sep 17 00:00:00 2001 From: "Chris Kim (Hyunggun)" Date: Wed, 25 Mar 2026 18:43:15 -0700 Subject: [PATCH] Fix outdated response access syntax in 01_Basic_Prompt_Structure notebooks 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) --- AmazonBedrock/anthropic/01_Basic_Prompt_Structure.ipynb | 8 ++++---- AmazonBedrock/boto3/01_Basic_Prompt_Structure.ipynb | 8 ++++---- Anthropic 1P/01_Basic_Prompt_Structure.ipynb | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/AmazonBedrock/anthropic/01_Basic_Prompt_Structure.ipynb b/AmazonBedrock/anthropic/01_Basic_Prompt_Structure.ipynb index 2b9190c..4c610b5 100755 --- a/AmazonBedrock/anthropic/01_Basic_Prompt_Structure.ipynb +++ b/AmazonBedrock/anthropic/01_Basic_Prompt_Structure.ipynb @@ -159,7 +159,7 @@ " )\n", "\n", "# Print Claude's response\n", - "print(response[0].text)" + "print(response.content[0].text)" ] }, { @@ -194,7 +194,7 @@ " )\n", "\n", "# Print Claude's response\n", - "print(response[0].text)" + "print(response.content[0].text)" ] }, { @@ -428,7 +428,7 @@ " )\n", "\n", "# Print Claude's response\n", - "print(response[0].text)" + "print(response.content[0].text)" ] }, { @@ -449,7 +449,7 @@ " )\n", "\n", "# Print Claude's response\n", - "print(response[0].text)" + "print(response.content[0].text)" ] }, { diff --git a/AmazonBedrock/boto3/01_Basic_Prompt_Structure.ipynb b/AmazonBedrock/boto3/01_Basic_Prompt_Structure.ipynb index bcb43de..cbf2142 100755 --- a/AmazonBedrock/boto3/01_Basic_Prompt_Structure.ipynb +++ b/AmazonBedrock/boto3/01_Basic_Prompt_Structure.ipynb @@ -167,7 +167,7 @@ "response = client.invoke_model(body=body, modelId=MODEL_NAME)\n", "\n", "# Print Claude's response\n", - "print(response[0].text)" + "print(response.content[0].text)" ] }, { @@ -208,7 +208,7 @@ "response = client.invoke_model(body=body, modelId=MODEL_NAME)\n", "\n", "# Print Claude's response\n", - "print(response[0].text)" + "print(response.content[0].text)" ] }, { @@ -446,7 +446,7 @@ "response = client.invoke_model(body=body, modelId=MODEL_NAME)\n", "\n", "# Print Claude's response\n", - "print(response[0].text)" + "print(response.content[0].text)" ] }, { @@ -473,7 +473,7 @@ "response = client.invoke_model(body=body, modelId=MODEL_NAME)\n", "\n", "# Print Claude's response\n", - "print(response[0].text)" + "print(response.content[0].text)" ] }, { diff --git a/Anthropic 1P/01_Basic_Prompt_Structure.ipynb b/Anthropic 1P/01_Basic_Prompt_Structure.ipynb index 625c8e6..196c5cb 100644 --- a/Anthropic 1P/01_Basic_Prompt_Structure.ipynb +++ b/Anthropic 1P/01_Basic_Prompt_Structure.ipynb @@ -146,7 +146,7 @@ " )\n", "\n", "# Print Claude's response\n", - "print(response[0].text)" + "print(response.content[0].text)" ] }, { @@ -174,7 +174,7 @@ " )\n", "\n", "# Print Claude's response\n", - "print(response[0].text)" + "print(response.content[0].text)" ] }, { @@ -408,7 +408,7 @@ " )\n", "\n", "# Print Claude's response\n", - "print(response[0].text)" + "print(response.content[0].text)" ] }, { @@ -429,7 +429,7 @@ " )\n", "\n", "# Print Claude's response\n", - "print(response[0].text)" + "print(response.content[0].text)" ] }, {