-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathai.cs
More file actions
executable file
·39 lines (26 loc) · 996 Bytes
/
Copy pathai.cs
File metadata and controls
executable file
·39 lines (26 loc) · 996 Bytes
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
#!/home/adavidoaiei/dotnet/dotnet run
#:package Microsoft.SemanticKernel@1.59.0
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.KernelExtensions;
var kernel = Kernel.Builder.Build();
kernel.Config.AddOpenAICompletionBackend(
"davinci-backend",
"text-davinci-003",
"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"
);
string skPrompt = @"
{{$input}}
Give me the TLDR in 5 words.
";
string textToSummarize = @"
1) A robot may not injure a human being or, through inaction,
allow a human being to come to harm.
2) A robot must obey orders given it by human beings except where
such orders would conflict with the First Law.
3) A robot must protect its own existence as long as such protection
does not conflict with the First or Second Law.
";
var tldrFunction = kernel.CreateSemanticFunction(skPrompt);
var summary = await kernel.RunAsync(textToSummarize, tldrFunction);
Console.WriteLine(summary);
// Output => Protect humans, follow orders, survive.