chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
namespace SemanticKernel.AotCompatibility.Plugins;
|
||||
|
||||
internal sealed class Location
|
||||
{
|
||||
public string Country { get; set; }
|
||||
|
||||
public string City { get; set; }
|
||||
|
||||
public Location(string country, string city)
|
||||
{
|
||||
this.Country = country;
|
||||
this.City = city;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
namespace SemanticKernel.AotCompatibility.Plugins;
|
||||
|
||||
internal sealed class Weather
|
||||
{
|
||||
public int? Temperature { get; set; }
|
||||
public string? Condition { get; set; }
|
||||
|
||||
public override string ToString() => $"Current weather(temperature: {this.Temperature}F, condition: {this.Condition})";
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// 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" }
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user