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

Connected

Exercise

Implementing model fallbacks

To guarantee 24/7 service, TrailBlaze needs to fall back to a lighter model when Claude is unavailable. Implement a fallback from Claude to Nova Text Lite when encountering issues, to ensure continuous service to the travel app.

The json and boto3 libraries, and the bedrock client, are preloaded.

Instructions

100 XP
  • Wrap the primary Claude model call in a try block.
  • In the except block, handle errors using ClientError and call the Nova Text Lite model.