-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Motivation and Context Need for a simple planner showing how to leverage semantic functions to implement Intent Detection pattern and turn it into a planner, selecting a function given a goal. The planner also allows to provide a Planning capability using less powerful models, like GPT3 (text-davinci-002) and GPT3.5 (text-davinci-003, GPT turbo 3.5), where often the more advanced planner can hallucinate. Fix one bug in "WriterSkill/ShortPoem/skprompt.txt" leading to incorrect results when the goal was missing a termination (period or new line) ### Description * New package `Microsoft.SemanticKernel.Planning.ActionPlanner`extending the Planning namespace. The package is automatically installed, ie it's part of SK metapackage. * Move SequentialPlanner into the new package `Microsoft.SemanticKernel.Planning.SequentialPlanner` lib, part of the metapackage * Add new Action Planner. * Store planner prompts to skprompt.txt, using embedded resources to avoid files overwriting each other.
- Loading branch information
Showing
86 changed files
with
792 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Suppressing errors for Test projects under dotnet folder | ||
[*.cs] | ||
dotnet_diagnostic.CA2007.severity = none # Do not directly await a Task | ||
dotnet_diagnostic.VSTHRD111.severity = none # Use .ConfigureAwait(bool) is hidden by default, set to none to prevent IDE from changing on autosave | ||
|
29 changes: 29 additions & 0 deletions
29
dotnet/src/Extensions/Extensions.UnitTests/Extensions.UnitTests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<AssemblyName>SemanticKernel.Extensions.UnitTests</AssemblyName> | ||
<RootNamespace>SemanticKernel.Extensions.UnitTests</RootNamespace> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>disable</ImplicitUsings> | ||
<IsPackable>false</IsPackable> | ||
<NoWarn>CA2007,VSTHRD111</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" /> | ||
<PackageReference Include="Moq" /> | ||
<PackageReference Include="xunit" /> | ||
<PackageReference Include="xunit.runner.visualstudio"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Console" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Planning.ActionPlanner\Planning.ActionPlanner.csproj" /> | ||
<ProjectReference Include="..\Planning.SequentialPlanner\Planning.SequentialPlanner.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
dotnet/src/Extensions/Extensions.UnitTests/XunitHelpers/TestConsoleLogger.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using System; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace SemanticKernel.Extensions.UnitTests.XunitHelpers; | ||
|
||
/// <summary> | ||
/// Basic logger printing to console | ||
/// </summary> | ||
internal static class TestConsoleLogger | ||
{ | ||
internal static ILogger Log => LogFactory.CreateLogger<object>(); | ||
|
||
private static ILoggerFactory LogFactory => s_loggerFactory.Value; | ||
private static readonly Lazy<ILoggerFactory> s_loggerFactory = new(LogBuilder); | ||
|
||
private static ILoggerFactory LogBuilder() | ||
{ | ||
return LoggerFactory.Create(builder => | ||
{ | ||
builder.SetMinimumLevel(LogLevel.Trace); | ||
// builder.AddFilter("Microsoft", LogLevel.Trace); | ||
// builder.AddFilter("Microsoft", LogLevel.Debug); | ||
// builder.AddFilter("Microsoft", LogLevel.Information); | ||
// builder.AddFilter("Microsoft", LogLevel.Warning); | ||
// builder.AddFilter("Microsoft", LogLevel.Error); | ||
builder.AddConsole(); | ||
}); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
dotnet/src/Extensions/Planning.ActionPlanner/ActionPlanResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.SemanticKernel.Planning.Action; | ||
|
||
/// <summary> | ||
/// Plan data structure returned by the basic planner semantic function | ||
/// </summary> | ||
internal sealed class ActionPlanResponse | ||
{ | ||
public class PlanData | ||
{ | ||
/// <summary> | ||
/// Rationale given by the LLM for choosing the function | ||
/// </summary> | ||
public string Rationale { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Name of the function chosen | ||
/// </summary> | ||
public string Function { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Parameter values | ||
/// </summary> | ||
public Dictionary<string, string> Parameters { get; set; } = new(); | ||
} | ||
|
||
/// <summary> | ||
/// Plan information | ||
/// </summary> | ||
public PlanData Plan { get; set; } = new(); | ||
} |
Oops, something went wrong.