Files
semantic-kernel/dotnet/samples/KernelSyntaxExamples/Example03_Variables.cs
T
Shawn Callegariandname f8a8d884ff Moving KernelSyntaxExamples into the dotnet/ folder (#1616)
"KernelSyntaxExamples" is the only outstanding project under /samples
that still uses project references to access the kernel libraries.

This change consolidates all the building, linked dotnet SDK code in
SK-dotnet.sln into a single top-level folder. This will simplify build
jobs, automatic code owner assignment, and other dev ops tasks.

Coming next: other projects in samples will get removed from the
dotnet/SK-dotnet.sln solution, and a new solution with dedicated builds
created for the /samples folder.

TBD:
- Language-specific code "samples" will move into a similar subfolder
for each language.
- The current "/samples" folder (at the root) will likely become
something like "apps", with the demo apps promoted to the top-level
folder for better discoverability.
- notebooks may also move to this folder in the future.

Co-authored-by: name <email>
2023-06-21 01:37:54 +00:00

34 lines
993 B
C#

// Copyright (c) Microsoft. All rights reserved.
using System;
using System.Globalization;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Orchestration;
using RepoUtils;
using Skills;
// ReSharper disable once InconsistentNaming
public static class Example03_Variables
{
private static readonly ILogger s_log = ConsoleLogger.Log;
public static async Task RunAsync()
{
Console.WriteLine("======== Variables ========");
IKernel kernel = new KernelBuilder().WithLogger(s_log).Build();
var text = kernel.ImportSkill(new StaticTextSkill(), "text");
var variables = new ContextVariables("Today is: ");
variables.Set("day", DateTimeOffset.Now.ToString("dddd", CultureInfo.CurrentCulture));
SKContext result = await kernel.RunAsync(variables,
text["AppendDay"],
text["Uppercase"]);
Console.WriteLine(result);
}
}