From 01ebc64b2345ff334abf24d530be87cc85c6f3bc Mon Sep 17 00:00:00 2001 From: Niels Swimberghe <3382717+Swimburger@users.noreply.github.com> Date: Wed, 3 Jan 2024 17:06:42 -0500 Subject: [PATCH] Add backwards compatible alias --- .../AssemblyAIPlugin.cs | 13 +++++----- .../TranscriptPlugin.cs | 24 +++++++++++++++++++ 2 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 src/AssemblyAI.SemanticKernel/TranscriptPlugin.cs diff --git a/src/AssemblyAI.SemanticKernel/AssemblyAIPlugin.cs b/src/AssemblyAI.SemanticKernel/AssemblyAIPlugin.cs index 18e6c88..f2d733a 100644 --- a/src/AssemblyAI.SemanticKernel/AssemblyAIPlugin.cs +++ b/src/AssemblyAI.SemanticKernel/AssemblyAIPlugin.cs @@ -16,15 +16,16 @@ namespace AssemblyAI.SemanticKernel public class AssemblyAIPlugin { public const string PluginName = "AssemblyAI"; - private readonly AssemblyAIPluginsOptions _options; + + internal AssemblyAIPluginsOptions Options { get; } - private string ApiKey => _options.ApiKey; + private string ApiKey => Options.ApiKey; - private bool AllowFileSystemAccess => _options.AllowFileSystemAccess; + private bool AllowFileSystemAccess => Options.AllowFileSystemAccess; public AssemblyAIPlugin(string apiKey) { - _options = new AssemblyAIPluginsOptions + Options = new AssemblyAIPluginsOptions { ApiKey = apiKey }; @@ -32,7 +33,7 @@ public AssemblyAIPlugin(string apiKey) public AssemblyAIPlugin(string apiKey, bool allowFileSystemAccess) { - _options = new AssemblyAIPluginsOptions + Options = new AssemblyAIPluginsOptions { ApiKey = apiKey, AllowFileSystemAccess = allowFileSystemAccess @@ -42,7 +43,7 @@ public AssemblyAIPlugin(string apiKey, bool allowFileSystemAccess) [ActivatorUtilitiesConstructor] public AssemblyAIPlugin(IOptions options) { - _options = options.Value; + Options = options.Value; } public const string TranscribeFunctionName = nameof(Transcribe); diff --git a/src/AssemblyAI.SemanticKernel/TranscriptPlugin.cs b/src/AssemblyAI.SemanticKernel/TranscriptPlugin.cs new file mode 100644 index 0000000..7fd566f --- /dev/null +++ b/src/AssemblyAI.SemanticKernel/TranscriptPlugin.cs @@ -0,0 +1,24 @@ +using System; + +namespace AssemblyAI.SemanticKernel +{ + [Obsolete("Use AssemblyAIPlugin instead.")] + public class TranscriptPlugin : AssemblyAIPlugin + { + public new const string PluginName = nameof(TranscriptPlugin); + + public bool AllowFileSystemAccess + { + get => Options.AllowFileSystemAccess; + set => Options.AllowFileSystemAccess = value; + } + + public TranscriptPlugin(string apiKey) : base(apiKey) + { + } + + public TranscriptPlugin(string apiKey, bool allowFileSystemAccess) : base(apiKey, allowFileSystemAccess) + { + } + } +} \ No newline at end of file