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

Connected

Exercise

Building a conversation-manager class

You’ve joined ChargeNet, a company rolling out a nationwide network of rapid-charging stations for electric vehicles. Your task is to build ChargeBot, a customer-support chatbot. The first step is creating a ConversationManager class to keep track of the chat history so Claude can generate coherent replies.

The boto3 library has been preloaded.

Instructions

100 XP
  • Create an empty list to store the conversation_history.
  • Add a method add_message() that takes a role and content, and appends a dictionary to the history.