Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix:SemanticKernelQuickStart for c# #206

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions semantic-kernel/get-started/quick-start-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ do {
userInput = Console.ReadLine();

// Add user input
history.AddUserMessage(userInput);
history.AddUserMessage(userInput!);

// Get the response from the AI
var result = await chatCompletionService.GetChatMessageContentAsync(
Expand Down Expand Up @@ -493,24 +493,26 @@ using Microsoft.SemanticKernel;
public class LightsPlugin
{
// Mock data for the lights
private readonly List<LightModel> lights = new()
{
private readonly List<LightModel> lights =
[
new LightModel { Id = 1, Name = "Table Lamp", IsOn = false },
new LightModel { Id = 2, Name = "Porch light", IsOn = false },
new LightModel { Id = 3, Name = "Chandelier", IsOn = true }
};
];

[KernelFunction("get_lights")]
[Description("Gets a list of lights and their current state")]
public async Task<List<LightModel>> GetLightsAsync()
{
await Task.CompletedTask;
return lights;
}

[KernelFunction("change_state")]
[Description("Changes the state of the light")]
public async Task<LightModel?> ChangeStateAsync(int id, bool isOn)
{
await Task.CompletedTask;
var light = lights.FirstOrDefault(light => light.Id == id);

if (light == null)
Expand All @@ -531,7 +533,7 @@ public class LightModel
public int Id { get; set; }

[JsonPropertyName("name")]
public string Name { get; set; }
public required string Name { get; set; }

[JsonPropertyName("is_on")]
public bool? IsOn { get; set; }
Expand Down