1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Amazon Bedrock

Connected

Exercise

Processing model responses and error handling

SkyCast Assistant also powers personalized weather alerts. As part of this initiative, they've asked to generate a reply to a user who wants to change the frequency of their newsletter. Use Claude to generate the response, then parse it so the final message fits into the app’s compact notification view.

The json library, bedrock client, and request_body have been pre-imported.

Instructions

100 XP
  • Check if the 'output' key exists in the data dictionary.
  • Extract 'text' from the content in the message output.