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); }