Summary audio
Spoken summary — press play to read along: the line being spoken stays near the top.
Study notes
- API Statelessness: Bedrock and Cloud do not store any messages (user inputs or model responses). They are stateless.
- Context Maintenance: To achieve a multi-message conversation (maintaining context or flow), the developer must manually manage the conversation history.
- Required Implementation Steps:
- Maintain a list of all exchanged messages within the application code.
- Include this entire list of messages with every follow-up request sent to the API.
- Conversation Flow (The Process):
- Start with an initial user message.
- Receive the assistant's response.
- Append the assistant's response to the message list.
- For subsequent turns, append the new user message to the list.
- Send the complete, updated list to the API to receive the next response.
- Message Role Alternation: When constructing the message list for the API, roles must always alternate:
- User → Assistant → User → Assistant → ...
- Never have two consecutive messages from the same role (e. g. , User → User or Assistant → Assistant).
Takeaways
- APIs like Bedrock are stateless and do not store conversation history.
- Context must be maintained manually by the developer to simulate a multi-message conversation.
- The entire list of all exchanged messages must be included with every follow-up request sent to the API.
- Message roles must strictly alternate when constructing the list (e. g. , User → Assistant → User → Assistant).
Flashcards 7 cards
Question
click to reveal · ←/→
Answer
click to flip back
Knowledge check 1 questions