From 5cad7835b57ce77542607cae401f9b8841e4c849 Mon Sep 17 00:00:00 2001 From: Roger Barreto <19890735+RogerBarreto@users.noreply.github.com> Date: Tue, 24 Oct 2023 18:17:57 +0100 Subject: [PATCH 1/2] .Net Removing IPlan interface (#3265) ### Motivation and Context IPlan interface has not definition and all Plan implementations actually implement ISKFunction members. Currently there is no need to have this as a `Flag interface`. ### Description Removing `IPlan` interface and pointing all its dependencies to `ISKFunction` directly. ### Contribution Checklist - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone :smile: --- dotnet/src/SemanticKernel.Core/Planning/IPlan.cs | 3 +++ .../SemanticKernel.Core/Planning/InstrumentedPlan.cs | 8 ++++---- dotnet/src/SemanticKernel.Core/Planning/Plan.cs | 2 +- .../SemanticKernel.Core/Planning/PlanExtensions.cs | 12 ++++++++++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/dotnet/src/SemanticKernel.Core/Planning/IPlan.cs b/dotnet/src/SemanticKernel.Core/Planning/IPlan.cs index f38b88bd19ee..e4437ef1e27d 100644 --- a/dotnet/src/SemanticKernel.Core/Planning/IPlan.cs +++ b/dotnet/src/SemanticKernel.Core/Planning/IPlan.cs @@ -1,10 +1,13 @@ // Copyright (c) Microsoft. All rights reserved. +using System; + namespace Microsoft.SemanticKernel.Planning; /// /// Interface for standard Semantic Kernel callable plan. /// +[Obsolete("This interface is obsoleted, use ISKFunction interface instead")] public interface IPlan : ISKFunction { } diff --git a/dotnet/src/SemanticKernel.Core/Planning/InstrumentedPlan.cs b/dotnet/src/SemanticKernel.Core/Planning/InstrumentedPlan.cs index 61e39ca9eeab..83c087f6f7aa 100644 --- a/dotnet/src/SemanticKernel.Core/Planning/InstrumentedPlan.cs +++ b/dotnet/src/SemanticKernel.Core/Planning/InstrumentedPlan.cs @@ -17,7 +17,7 @@ namespace Microsoft.SemanticKernel.Planning; /// /// Standard Semantic Kernel callable plan with instrumentation. /// -internal sealed class InstrumentedPlan : IPlan +internal sealed class InstrumentedPlan : ISKFunction { /// public string Name => this._plan.Name; @@ -31,10 +31,10 @@ internal sealed class InstrumentedPlan : IPlan /// /// Initialize a new instance of the class. /// - /// Instance of to decorate. + /// Instance of to decorate. /// The to use for logging. If null, no logging will be performed. public InstrumentedPlan( - IPlan plan, + ISKFunction plan, ILoggerFactory? loggerFactory = null) { this._plan = plan; @@ -59,7 +59,7 @@ public async Task InvokeAsync( #region private ================================================================================ - private readonly IPlan _plan; + private readonly ISKFunction _plan; private readonly ILogger _logger; /// diff --git a/dotnet/src/SemanticKernel.Core/Planning/Plan.cs b/dotnet/src/SemanticKernel.Core/Planning/Plan.cs index 46c954ad07ef..ba64d6aaa3bc 100644 --- a/dotnet/src/SemanticKernel.Core/Planning/Plan.cs +++ b/dotnet/src/SemanticKernel.Core/Planning/Plan.cs @@ -22,7 +22,7 @@ namespace Microsoft.SemanticKernel.Planning; /// Plan is used to create trees of s. /// [DebuggerDisplay("{DebuggerDisplay,nq}")] -public sealed class Plan : IPlan +public sealed class Plan : ISKFunction { /// /// State of the plan diff --git a/dotnet/src/SemanticKernel.Core/Planning/PlanExtensions.cs b/dotnet/src/SemanticKernel.Core/Planning/PlanExtensions.cs index c163c617c48c..456cf87a0799 100644 --- a/dotnet/src/SemanticKernel.Core/Planning/PlanExtensions.cs +++ b/dotnet/src/SemanticKernel.Core/Planning/PlanExtensions.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using System.Linq; using Microsoft.Extensions.Logging; @@ -73,7 +74,18 @@ public static string ToPlanString(this Plan plan, string indent = " ") /// /// Instance of to decorate. /// The to use for logging. If null, no logging will be performed. + [Obsolete("Use concrete class Plan WithInstrumentation instead")] public static IPlan WithInstrumentation(this IPlan plan, ILoggerFactory? loggerFactory = null) + { + throw new NotSupportedException("This method is obsolete, use concrete class Plan WithInstrumentation instead"); + } + + /// + /// Returns decorated instance of with plan enabled instrumentation. + /// + /// Instance of to decorate. + /// The to use for logging. If null, no logging will be performed. + public static ISKFunction WithInstrumentation(this Plan plan, ILoggerFactory? loggerFactory = null) { return new InstrumentedPlan(plan, loggerFactory); } From ab35598ef4a87beb5a1e57a942d95564802cf213 Mon Sep 17 00:00:00 2001 From: Devis Lucato Date: Tue, 24 Oct 2023 12:19:35 -0700 Subject: [PATCH 2/2] Update README.md (#3287) Update docs about Kernel Memory --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8cab9adb1ede..ddab6c95ceef 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,7 @@ If you like Semantic Kernel, you may also be interested in other repos the Seman | [Chat Copilot](https://github.com/microsoft/chat-copilot) | A reference application that demonstrates how to build a chatbot with Semantic Kernel. | | [Semantic Kernel Docs](https://github.com/MicrosoftDocs/semantic-kernel-docs) | The home for Semantic Kernel documentation that appears on the Microsoft learn site. | | [Semantic Kernel Starters](https://github.com/microsoft/semantic-kernel-starters) | Starter projects for Semantic Kernel to make it easier to get started. | -| [Semantic Memory](https://github.com/microsoft/semantic-memory) | A service that allows you to create pipelines for ingesting, storing, and querying knowledge. | +| [Kernel Memory](https://github.com/microsoft/kernel-memory) | A scalable Memory service to store information and ask questions using the RAG pattern. | ## Join the community