Skip to content

Commit 1479498

Browse files
committed
✨ Introduce new SVG for AWS Converse sequence
- Added a new SVG file for the AWS Converse sequence. - This visual aid enhances the documentation and understanding of the integration process. - The SVG is located in the images directory for easy access. Generated by Copilot
1 parent 2c2fab7 commit 1479498

File tree

2 files changed

+94
-12
lines changed

2 files changed

+94
-12
lines changed

TestArena/Blog/AI/Bedrock/BedrockWithConverse.razor

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
isOlderThumbnailFormat="@currentPage.IsOlderThumbnailFormat">
1717
</Header>
1818

19+
<CalloutBox Type="info" Title="📖 Series Context">
20+
<p>This article is part of the AWS Bedrock with .NET series. If you haven't already, start with <a href="/blog/ai/bedrock">Getting Started with AWS Bedrock</a> and <a href="/blog/ai/bedrock/advanced">Advanced Integration &amp; Production Setup</a> to understand authentication, configuration, and cost optimization before diving into conversational patterns.</p>
21+
</CalloutBox>
22+
1923
<Section Heading="The Problem: AI That Forgets" Level="4">
2024
<p>
2125
Picture a customer contacting your support bot about a billing issue. They explain the problem, the bot asks for their account number, they provide it — and then the next response treats them like a stranger. No memory of the account number. No memory of the issue. The user has to start over.
@@ -85,6 +89,11 @@
8589
</CalloutBox>
8690
</Section>
8791

92+
<Section Heading="How the Converse API Flows End to End" Level="4">
93+
<p>Before we write any code, here's a visual map of the full request lifecycle — from your .NET application calling the SDK, through Bedrock's Converse API, down to the Foundation Model, and back. Notice the <b>multi-turn conversation loop</b> and the <b>tool use</b> opt block — both are native to the Converse API and impossible with InvokeModel.</p>
94+
<BlogImage ImagePath="/images/blog/ai/bedrock/aws-converse-sequence.svg" Description="Sequence diagram: .NET application using AWS Bedrock Converse API with multi-turn conversation loop and tool use" Number="1" />
95+
</Section>
96+
8897
<Section Heading="How: Building an AI Customer Service Agent with Converse API" Level="4">
8998
<Section Heading="1. Prerequisites" Level="5">
9099
<ul>
@@ -99,12 +108,15 @@
99108
<CodeSnippet Language="csharp">
100109
using Amazon.BedrockRuntime;
101110
using Amazon.BedrockRuntime.Model;
111+
using System;
102112
using System.Collections.Generic;
103113
using System.Threading.Tasks;
104114

105115
public class BedrockCustomerSupportService
106116
{
107117
private readonly AmazonBedrockRuntimeClient _client;
118+
// NOTE: Verify the latest Claude model ID in the AWS Bedrock console.
119+
// This example uses Claude 3 Haiku as of Jan 2026 — model IDs may change.
108120
private const string ModelId = "anthropic.claude-3-haiku-20240307-v1:0";
109121

110122
public BedrockCustomerSupportService()
@@ -148,7 +160,7 @@ public class BedrockCustomerSupportService
148160
}
149161
</CodeSnippet>
150162
<CalloutBox Type="tip" Title="Full Example on GitHub">
151-
<p>See the complete implementation and usage in the <a href="https://github.com/ajaysskumar/ai-playground/blob/main/AwsBedrockExamples/Services/BedrockCustomerSupportService.cs" target="_blank">BedrockCustomerSupportService.cs</a> file on GitHub.</p>
163+
<p>See the complete implementation and usage in the <a href="https://github.com/ajaysskumar/ai-playground/blob/main/AwsBedrockExamples/Services/BedrockCustomerSupportService.cs" target="_blank">BedrockCustomerSupportService.cs</a> file on GitHub. Also refer to the <a href="/blog/ai/bedrock">Getting Started with AWS Bedrock</a> article for foundational setup and IAM authentication.</p>
152164
</CalloutBox>
153165
</Section>
154166
<Section Heading="3. How the Example Works" Level="5">
@@ -162,21 +174,23 @@ public class BedrockCustomerSupportService
162174
<Section Heading="4. Example Use Case: AI Customer Service Agent" Level="5">
163175
<p>Suppose a user is troubleshooting an issue with their order. The conversation might look like this:</p>
164176
<CodeSnippet Language="csharp">
165-
// Example conversation history
177+
// Example conversation history — showing 5+ turns to demonstrate context retention
166178
var conversationHistory = new List&lt;Message&gt;
167179
{
168-
new Message { Role = "user", Content = new List&lt;ContentBlock&gt; { new ContentBlock { Text = "My order hasn't arrived yet." } } },
169-
new Message { Role = "assistant", Content = new List&lt;ContentBlock&gt; { new ContentBlock { Text = "I'm sorry to hear that. Can you provide your order number?" } } },
170-
new Message { Role = "user", Content = new List&lt;ContentBlock&gt; { new ContentBlock { Text = "It's 12345." } } }
180+
new Message { Role = "user", Content = new List&lt;ContentBlock&gt; { new ContentBlock { Text = "My order hasn't arrived yet. I ordered it last week." } } },
181+
new Message { Role = "assistant", Content = new List&lt;ContentBlock&gt; { new ContentBlock { Text = "I'm sorry to hear that. Can you provide your order number? And what's your delivery address region?" } } },
182+
new Message { Role = "user", Content = new List&lt;ContentBlock&gt; { new ContentBlock { Text = "It's order 12345, and I'm in the East Coast region." } } },
183+
new Message { Role = "assistant", Content = new List&lt;ContentBlock&gt; { new ContentBlock { Text = "Thanks! Order 12345 was shipped 5 days ago to the East Coast. It should arrive within 2-3 days. Would you like me to track it further or escalate this?" } } },
184+
new Message { Role = "user", Content = new List&lt;ContentBlock&gt; { new ContentBlock { Text = "Can you escalate this to a human agent? I'm concerned since it's been a week." } } }
171185
};
172186

173187
var service = new BedrockCustomerSupportService();
174188
string response = await service.GetSupportResponse(conversationHistory);
175189
Console.WriteLine(response);
176190
</CodeSnippet>
177-
<p>The AI will respond with a context-aware message, such as confirming the order status or providing next steps.</p>
191+
<p>Notice how in turn 4, the AI references "Order 12345" and "East Coast region" seamlessly — context from earlier turns. This multi-turn awareness is exactly what Converse API enables. The AI doesn't forget, and the user experience feels natural.</p>
178192
</Section>
179-
<Section Heading="6. Demo: Interactive Customer Support Chat" Level="5">
193+
<Section Heading="5. Demo: Interactive Customer Support Chat" Level="5">
180194
<p>Below is a complete demo of a console-based customer support chat using the Bedrock Converse API. This example shows how to maintain the conversation loop, collect user input, and keep the conversation history updated for each turn.</p>
181195
<CodeSnippet Language="csharp">
182196
// Customer support chat demo
@@ -238,18 +252,19 @@ public class BedrockCustomerSupportService
238252
<Section Heading="Summary" Level="4">
239253
<ul>
240254
<li><b>What:</b> The Bedrock Converse API enables multi-turn, context-aware conversations with generative AI models.</li>
241-
<li><b>When:</b> Use it for chatbots, customer support, and any scenario requiring context retention.</li>
242-
<li><b>How:</b> Integrate with AWS SDK for .NET and pass conversation history for seamless, intelligent interactions.</li>
255+
<li><b>When:</b> Use it for chatbots, customer support, and any scenario requiring context retention and continuous dialogue.</li>
256+
<li><b>How:</b> Integrate with AWS SDK for .NET (.net 8+), maintain conversation history as a list of Message objects, and pass the entire history with each request so the model sees full context.</li>
243257
</ul>
244258
<p>
245-
For more details and the full code, see the <a href="https://github.com/ajaysskumar/ai-playground/blob/main/AwsBedrockExamples/Services/BedrockCustomerSupportService.cs" target="_blank">GitHub example</a>.
259+
The beauty of Converse API is its simplicity — you don't need to manage complex state servers or reinvent conversation patterns. AWS handles the heavy lifting, and you focus on building great user experiences.
246260
</p>
247261
</Section>
248262

249263
<Section Heading="References & Further Reading" Level="4">
250264
<ul>
251-
<li><a href="https://docs.aws.amazon.com/bedrock/latest/userguide/converse-api.html" target="_blank">AWS Bedrock Converse API Documentation</a></li>
252-
<li><a href="https://github.com/ajaysskumar/ai-playground/blob/main/AwsBedrockExamples/Services/BedrockCustomerSupportService.cs" target="_blank">BedrockCustomerSupportService.cs on GitHub</a></li>
265+
<li><a href="/blog/ai/bedrock">AWS Bedrock with .NET: Getting Started</a> — foundation article for IAM, authentication, and cost optimization</li>
266+
<li><a href="https://docs.aws.amazon.com/bedrock/latest/userguide/converse-api.html" target="_blank">AWS Bedrock Converse API Documentation</a> — official AWS reference</li>
267+
<li><a href="https://github.com/ajaysskumar/ai-playground/blob/main/AwsBedrockExamples/Services/BedrockCustomerSupportService.cs" target="_blank">BedrockCustomerSupportService.cs on GitHub</a> — full runnable example</li>
253268
</ul>
254269
</Section>
255270

TestArena/wwwroot/images/blog/ai/bedrock/aws-converse-sequence.svg

Lines changed: 67 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)