Files
microsoft--semantic-kernel/dotnet/samples/Demos/AotCompatibility/Plugins/WeatherPlugin.cs
T
wehub-resource-sync b957a53def
CodeQL / Analyze (csharp) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:21:23 +08:00

25 lines
886 B
C#

// Copyright (c) Microsoft. All rights reserved.
using System.ComponentModel;
using Microsoft.SemanticKernel;
namespace SemanticKernel.AotCompatibility.Plugins;
internal sealed class WeatherPlugin
{
[KernelFunction]
[Description("Get the current weather in a given location.")]
public Weather GetCurrentWeather(Location location)
{
return location.City switch
{
"Boston" => new Weather { Temperature = 61, Condition = "rainy" },
"London" => new Weather { Temperature = 55, Condition = "cloudy" },
"Miami" => new Weather { Temperature = 80, Condition = "sunny" },
"Tokyo" => new Weather { Temperature = 50, Condition = "sunny" },
"Sydney" => new Weather { Temperature = 75, Condition = "sunny" },
_ => new Weather { Temperature = 31, Condition = "snowing" }
};
}
}