-
Notifications
You must be signed in to change notification settings - Fork 800
/
Copy pathCityInfo.cs
63 lines (59 loc) · 2.53 KB
/
CityInfo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using Azure.AI.Projects;
using System.Text.Json;
namespace AgentLabs_02;
public static class CityInfo
{
// This function is used to get the user's favorite city.
public static string GetUserFavoriteCity() => "Toronto";
public static FunctionToolDefinition getUserFavoriteCityTool = new("getUserFavoriteCity", "Gets the user's favorite city.");
// This function is used to get the nickname of a city.
public static string GetWeatherAtLocation(string cityName) => cityName switch
{
"Seattle" => "21c",
"Toronto" => "15c",
_ => throw new NotImplementedException()
};
public static FunctionToolDefinition getWeatherAtLocationTool = new(
name: "getWeatherAtLocation",
description: "Gets the weather for a city, e.g. 'Seattle' or 'Toronto'.",
parameters: BinaryData.FromObjectAsJson(
new
{
Type = "object",
Properties = new
{
CityName = new
{
Type = "string",
Description = "The city name",
},
},
Required = new[] { "cityName" },
},
new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }));
// this function is used to get the parks of a city
public static string GetParksAtLocation(string location) => location switch
{
"Seattle" => "Wild Waves Theme Park in Seattle offers roller coaster rides1. Visitors can also enjoy other attractions such as water slides, carousel rides, arcade games, and miniature golf3. Another option is Silverwood, a theme park near Coeur D'Alene with both wood and steel roller coasters5",
"Toronto" => "There are several amusement parks near Toronto with roller coasters and other fun rides. Some options include Canada's Wonderland, Centreville Island Amusement Park, and the Canadian National Exhibition (CNE)",
_ => throw new NotImplementedException()
};
public static FunctionToolDefinition getParksAtLocationTool = new(
name: "getParksAtLocation",
description: "Gets informations about parks for a city, e.g. 'Seattle' or 'Toronto'.",
parameters: BinaryData.FromObjectAsJson(
new
{
Type = "object",
Properties = new
{
CityName = new
{
Type = "string",
Description = "The city name",
},
},
Required = new[] { "cityName" },
},
new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }));
}