Skip to content

Commit ffc0f43

Browse files
authored
Merge branch 'main' into taochen/python-document-generator-demo
2 parents 727c53f + bf45719 commit ffc0f43

33 files changed

+1225
-117
lines changed

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ dotnet_diagnostic.IDE0005.severity = warning # Remove unnecessary using directiv
136136
dotnet_diagnostic.IDE0009.severity = warning # Add this or Me qualification
137137
dotnet_diagnostic.IDE0011.severity = warning # Add braces
138138
dotnet_diagnostic.IDE0018.severity = warning # Inline variable declaration
139+
139140
dotnet_diagnostic.IDE0032.severity = warning # Use auto-implemented property
140141
dotnet_diagnostic.IDE0034.severity = warning # Simplify 'default' expression
141142
dotnet_diagnostic.IDE0035.severity = warning # Remove unreachable code
@@ -221,20 +222,29 @@ dotnet_diagnostic.RCS1241.severity = none # Implement IComparable when implement
221222
dotnet_diagnostic.IDE0001.severity = none # Simplify name
222223
dotnet_diagnostic.IDE0002.severity = none # Simplify member access
223224
dotnet_diagnostic.IDE0004.severity = none # Remove unnecessary cast
225+
dotnet_diagnostic.IDE0010.severity = none # Populate switch
226+
dotnet_diagnostic.IDE0021.severity = none # Use block body for constructors
227+
dotnet_diagnostic.IDE0022.severity = none # Use block body for methods
228+
dotnet_diagnostic.IDE0024.severity = none # Use block body for operator
224229
dotnet_diagnostic.IDE0035.severity = none # Remove unreachable code
225230
dotnet_diagnostic.IDE0051.severity = none # Remove unused private member
226231
dotnet_diagnostic.IDE0052.severity = none # Remove unread private member
227232
dotnet_diagnostic.IDE0058.severity = none # Remove unused expression value
228233
dotnet_diagnostic.IDE0059.severity = none # Unnecessary assignment of a value
229234
dotnet_diagnostic.IDE0060.severity = none # Remove unused parameter
235+
dotnet_diagnostic.IDE0061.severity = none # Use block body for local function
230236
dotnet_diagnostic.IDE0079.severity = none # Remove unnecessary suppression.
231237
dotnet_diagnostic.IDE0080.severity = none # Remove unnecessary suppression operator.
232238
dotnet_diagnostic.IDE0100.severity = none # Remove unnecessary equality operator
233239
dotnet_diagnostic.IDE0110.severity = none # Remove unnecessary discards
234240
dotnet_diagnostic.IDE0130.severity = none # Namespace does not match folder structure
241+
dotnet_diagnostic.IDE0290.severity = none # Use primary constructor
235242
dotnet_diagnostic.IDE0032.severity = none # Use auto property
236243
dotnet_diagnostic.IDE0160.severity = none # Use block-scoped namespace
237244
dotnet_diagnostic.IDE1006.severity = warning # Naming rule violations
245+
dotnet_diagnostic.IDE0046.severity = suggestion # If statement can be simplified
246+
dotnet_diagnostic.IDE0056.severity = suggestion # Indexing can be simplified
247+
dotnet_diagnostic.IDE0057.severity = suggestion # Substring can be simplified
238248

239249
###############################
240250
# Naming Conventions #

dotnet/samples/Concepts/FunctionCalling/FunctionCalling.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public async Task RunPromptWithAutoFunctionChoiceBehaviorAdvertisingAllKernelFun
7272

7373
OpenAIPromptExecutionSettings settings = new() { FunctionChoiceBehavior = FunctionChoiceBehavior.Auto() };
7474

75-
Console.WriteLine(await kernel.InvokePromptAsync("Given the current time of day and weather, what is the likely color of the sky in Boston?", new(settings)));
75+
Console.WriteLine(await kernel.InvokePromptAsync("What is the likely color of the sky in Boston today?", new(settings)));
7676

7777
// Expected output: "Boston is currently experiencing a rainy day, hence, the likely color of the sky in Boston is grey."
7878
}
@@ -104,7 +104,7 @@ public async Task RunPromptWithNoneFunctionChoiceBehaviorAdvertisingAllKernelFun
104104

105105
OpenAIPromptExecutionSettings settings = new() { FunctionChoiceBehavior = FunctionChoiceBehavior.None() };
106106

107-
Console.WriteLine(await kernel.InvokePromptAsync("Tell me which provided functions I would need to call to get the color of the sky in Boston on a specified date.", new(settings)));
107+
Console.WriteLine(await kernel.InvokePromptAsync("Tell me which provided functions I would need to call to get the color of the sky in Boston for today.", new(settings)));
108108

109109
// Expected output: "You would first call the `HelperFunctions-GetCurrentUtcDateTime` function to get the current date time in UTC. Then, you would use the `HelperFunctions-GetWeatherForCity` function,
110110
// passing in the city name as 'Boston' and the retrieved UTC date time. Note, however, that these functions won't directly tell you the color of the sky.
@@ -122,7 +122,7 @@ public async Task RunPromptTemplateConfigWithAutoFunctionChoiceBehaviorAdvertisi
122122
// The `function_choice_behavior.functions` property is omitted which is equivalent to providing all kernel functions to the AI model.
123123
string promptTemplateConfig = """
124124
template_format: semantic-kernel
125-
template: Given the current time of day and weather, what is the likely color of the sky in Boston?
125+
template: What is the likely color of the sky in Boston today?
126126
execution_settings:
127127
default:
128128
function_choice_behavior:
@@ -177,7 +177,7 @@ public async Task RunNonStreamingChatCompletionApiWithAutomaticFunctionInvocatio
177177
IChatCompletionService chatCompletionService = kernel.GetRequiredService<IChatCompletionService>();
178178

179179
ChatMessageContent result = await chatCompletionService.GetChatMessageContentAsync(
180-
"Given the current time of day and weather, what is the likely color of the sky in Boston?",
180+
"What is the likely color of the sky in Boston today?",
181181
settings,
182182
kernel);
183183

@@ -204,7 +204,7 @@ public async Task RunStreamingChatCompletionApiWithAutomaticFunctionInvocationAs
204204

205205
// Act
206206
await foreach (var update in chatCompletionService.GetStreamingChatMessageContentsAsync(
207-
"Given the current time of day and weather, what is the likely color of the sky in Boston?",
207+
"What is the likely color of the sky in Boston today?",
208208
settings,
209209
kernel))
210210
{
@@ -231,7 +231,7 @@ public async Task RunNonStreamingChatCompletionApiWithManualFunctionInvocationAs
231231
OpenAIPromptExecutionSettings settings = new() { FunctionChoiceBehavior = Microsoft.SemanticKernel.FunctionChoiceBehavior.Auto(autoInvoke: false) };
232232

233233
ChatHistory chatHistory = [];
234-
chatHistory.AddUserMessage("Given the current time of day and weather, what is the likely color of the sky in Boston?");
234+
chatHistory.AddUserMessage("What is the likely color of the sky in Boston today?");
235235

236236
while (true)
237237
{
@@ -293,7 +293,7 @@ public async Task RunStreamingChatCompletionApiWithManualFunctionCallingAsync()
293293

294294
// Create chat history with the initial user message
295295
ChatHistory chatHistory = [];
296-
chatHistory.AddUserMessage("Given the current time of day and weather, what is the likely color of the sky in Boston?");
296+
chatHistory.AddUserMessage("What is the likely color of the sky in Boston today?");
297297

298298
while (true)
299299
{
@@ -360,7 +360,7 @@ public async Task RunNonStreamingPromptWithSimulatedFunctionAsync()
360360
OpenAIPromptExecutionSettings settings = new() { FunctionChoiceBehavior = Microsoft.SemanticKernel.FunctionChoiceBehavior.Auto(autoInvoke: false) };
361361

362362
ChatHistory chatHistory = [];
363-
chatHistory.AddUserMessage("Given the current time of day and weather, what is the likely color of the sky in Boston?");
363+
chatHistory.AddUserMessage("What is the likely color of the sky in Boston today?");
364364

365365
while (true)
366366
{
@@ -411,7 +411,7 @@ public async Task DisableFunctionCallingAsync()
411411
// Alternatively, either omit assigning anything to the `FunctionChoiceBehavior` property or assign null to it to also disable function calling.
412412
OpenAIPromptExecutionSettings settings = new() { FunctionChoiceBehavior = FunctionChoiceBehavior.Auto(functions: []) };
413413

414-
Console.WriteLine(await kernel.InvokePromptAsync("Given the current time of day and weather, what is the likely color of the sky in Boston?", new(settings)));
414+
Console.WriteLine(await kernel.InvokePromptAsync("What is the likely color of the sky in Boston today?", new(settings)));
415415

416416
// Expected output: "Sorry, I cannot answer this question as it requires real-time information which I, as a text-based model, cannot access."
417417
}
@@ -538,8 +538,8 @@ private static Kernel CreateKernel()
538538
kernel.ImportPluginFromFunctions("HelperFunctions",
539539
[
540540
kernel.CreateFunctionFromMethod(() => new List<string> { "Squirrel Steals Show", "Dog Wins Lottery" }, "GetLatestNewsTitles", "Retrieves latest news titles."),
541-
kernel.CreateFunctionFromMethod(() => DateTime.UtcNow.ToString("R"), "GetCurrentUtcDateTime", "Retrieves the current date time in UTC."),
542-
kernel.CreateFunctionFromMethod((string cityName, string currentDateTime) =>
541+
kernel.CreateFunctionFromMethod(() => DateTime.UtcNow.ToString("R"), "GetCurrentDateTimeInUtc", "Retrieves the current date time in UTC."),
542+
kernel.CreateFunctionFromMethod((string cityName, string currentDateTimeInUtc) =>
543543
cityName switch
544544
{
545545
"Boston" => "61 and rainy",
@@ -550,7 +550,7 @@ private static Kernel CreateKernel()
550550
"Sydney" => "75 and sunny",
551551
"Tel Aviv" => "80 and sunny",
552552
_ => "31 and snowing",
553-
}, "GetWeatherForCity", "Gets the current weather for the specified city"),
553+
}, "GetWeatherForCity", "Gets the current weather for the specified city and specified date time."),
554554
]);
555555

556556
return kernel;

0 commit comments

Comments
 (0)