Skip to content

Commit a5e884e

Browse files
committed
updating comments
1 parent 2660b85 commit a5e884e

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

articles/app-service/deploy-intelligent-apps-dotnet-to-azure-sql.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ After adding the chat interface, we can set up the Azure OpenAI client using Sem
8585
string apiKey = _config["API_KEY"];
8686
string modelId = _config["MODEL_ID"];
8787

88-
// Semantic Kernel builder
8988
var builder = Kernel.CreateBuilder();
9089

9190
// Chat completion service
@@ -98,15 +97,14 @@ After adding the chat interface, we can set up the Azure OpenAI client using Sem
9897

9998
var kernel = builder.Build();
10099

101-
// Create a Semantic Kernel template for chat
100+
// Create prompt template
102101
var chat = kernel.CreateFunctionFromPrompt(
103102
@"{{$history}}
104103
User: {{$request}}
105104
Assistant: ");
106105

107-
ChatHistory chatHistory = new("""You are a helpful assistant that answers questions about my data.""");
106+
ChatHistory chatHistory = new("""You are a helpful assistant that answers questions""");
108107

109-
// Get chat response and use user input
110108
var chatResult = kernel.InvokeStreamingAsync<StreamingChatMessageContent>(
111109
chat,
112110
new()
@@ -116,7 +114,6 @@ After adding the chat interface, we can set up the Azure OpenAI client using Sem
116114
}
117115
);
118116

119-
// Stream the response
120117
string message = "";
121118
await foreach (var chunk in chatResult)
122119
{
@@ -240,7 +237,7 @@ try
240237

241238
await using var command = new SqlCommand(sql, connection);
242239

243-
// add SqlParameter to SqlCommand
240+
// add parameter to SqlCommand
244241
command.Parameters.Add(param);
245242

246243
await using var reader = await command.ExecuteReaderAsync();
@@ -253,7 +250,6 @@ try
253250

254251
// add results to chat history
255252
chatHistory.AddSystemMessage(reader.GetString(1) + ", " + reader.GetString(2));
256-
257253
}
258254
}
259255
catch (SqlException e)
@@ -363,7 +359,7 @@ Here's the full example of the added *OpenAI.razor* page:
363359

364360
var kernel = builder.Build();
365361

366-
// Create a Semantic Kernel template for chat
362+
// Create prompt template
367363
var chat = kernel.CreateFunctionFromPrompt(
368364
@"{{$history}}
369365
User: {{$request}}
@@ -421,7 +417,7 @@ Here's the full example of the added *OpenAI.razor* page:
421417

422418
await using var command = new SqlCommand(sql, connection);
423419

424-
// add SqlParameter to SqlCommand
420+
// add parameter to SqlCommand
425421
command.Parameters.Add(param);
426422

427423
await using var reader = await command.ExecuteReaderAsync();
@@ -449,7 +445,6 @@ Here's the full example of the added *OpenAI.razor* page:
449445
Console.WriteLine("Done");
450446
#endregion
451447

452-
// Get chat response and use user input
453448
var chatResult = kernel.InvokeStreamingAsync<StreamingChatMessageContent>(
454449
chat,
455450
new()
@@ -459,14 +454,13 @@ Here's the full example of the added *OpenAI.razor* page:
459454
}
460455
);
461456

462-
// Stream the response
463457
string message = "";
464458
await foreach (var chunk in chatResult)
465459
{
466460
message += chunk;
467461
}
468462

469-
// Append to history
463+
// Append messages to chat history
470464
chatHistory.AddUserMessage(userMessage!);
471465
chatHistory.AddAssistantMessage(message);
472466

0 commit comments

Comments
 (0)