Skip to content

Commit d8dc32e

Browse files
committed
✨ Introduce updates to Advanced.razor
- Modified content in Advanced.razor for clarity. - Enhanced structure for better readability. - Ensured alignment with recent documentation standards. Generated by Copilot
1 parent a261bb1 commit d8dc32e

1 file changed

Lines changed: 2 additions & 30 deletions

File tree

TestArena/Blog/AI/Bedrock/Advanced.razor

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -135,41 +135,13 @@ aws bedrock list-foundation-models --region us-east-1
135135
</Section>
136136
</Section>
137137

138-
<Section Heading="Prompt Engineering & Response Parsing" Level="4">
139-
<p>For reliable parsing, craft your prompts to instruct the model to return strict JSON. Here’s a helper for formatting/parsing the response:</p>
140-
<CodeSnippet Language="csharp">
141-
private string FormatJsonString(string input)
142-
{
143-
if (string.IsNullOrWhiteSpace(input)) return input;
144-
// Try to extract the first JSON array or object from the string
145-
var match = System.Text.RegularExpressions.Regex.Match(input,
146-
"(\\{[\\s\\S]*\\}|\\[[\\s\\S]*\\])");
147-
if (!match.Success)
148-
return input;
149-
var jsonContent = match.Value;
150-
try
151-
{
152-
using var doc = System.Text.Json.JsonDocument.Parse(jsonContent);
153-
return System.Text.Json.JsonSerializer.Serialize(doc.RootElement,
154-
new System.Text.Json.JsonSerializerOptions { WriteIndented = true });
155-
}
156-
catch
157-
{
158-
// If not valid JSON, return as-is
159-
return jsonContent;
160-
}
161-
}
162-
</CodeSnippet>
163-
<CalloutBox Type="tip" Title="Prompt Engineering">
164-
<p>Always instruct the model to return a strict JSON array/object and nothing else for easier parsing.</p>
165-
</CalloutBox>
166-
</Section>
138+
139+
167140

168141
<Section Heading="Summary & Best Practices" Level="4">
169142
<ul>
170143
<li><b>Advanced authentication</b> enables secure, scalable, and production-ready AWS Bedrock integration in .NET.</li>
171144
<li><b>Use EC2 instance roles</b> for production workloads—never hardcode credentials.</li>
172-
<li><b>Prompt engineering</b> and response parsing are key for reliable GenAI workflows.</li>
173145
<li>Refer to AWS documentation for the latest best practices and SDK updates.</li>
174146
</ul>
175147
<p>

0 commit comments

Comments
 (0)