-
Notifications
You must be signed in to change notification settings - Fork 0
/
Functions.cs
51 lines (42 loc) · 1.3 KB
/
Functions.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
using Microsoft.SemanticKernel;
using System;
using System.ComponentModel;
using System.Linq;
namespace SemanticKernelFromLocalToCloud
{
public sealed class GeneralPlugin
{
[KernelFunction]
[Description("Retrieves the current time in UTC")]
public string GetCurrentUtcTime() => DateTime.UtcNow.ToString("R");
[KernelFunction]
[Description("Gets the current weather for the specified city")]
public string GetWeatherForCity(string cityName) =>
cityName switch
{
"Boston" => "61 and rainy",
"London" => "55 and cloudy",
"Miami" => "80 and sunny",
"Paris" => "60 and rainy",
"Tokyo" => "50 and sunny",
"Sydney" => "75 and sunny",
"Tel Aviv" => "80 and sunny",
_ => "31 and snowing",
};
}
public sealed class PersonalPlugin
{
[KernelFunction]
[Description("Answer question about me")]
static string AnswerQuestionAboutMe(string name)
{
return SearchInDataBase(name);
}
// Database simulator
static string SearchInDataBase(string name)
{
// Logic
return $"Tu nombre es Pedro Hernandez. y tu pregunta fué {name}";
}
}
}