Skip to content

Commit

Permalink
Add backwards compatible alias
Browse files Browse the repository at this point in the history
  • Loading branch information
Swimburger committed Jan 3, 2024
1 parent cbabd3b commit 01ebc64
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/AssemblyAI.SemanticKernel/AssemblyAIPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,24 @@ 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
};
}

public AssemblyAIPlugin(string apiKey, bool allowFileSystemAccess)
{
_options = new AssemblyAIPluginsOptions
Options = new AssemblyAIPluginsOptions
{
ApiKey = apiKey,
AllowFileSystemAccess = allowFileSystemAccess
Expand All @@ -42,7 +43,7 @@ public AssemblyAIPlugin(string apiKey, bool allowFileSystemAccess)
[ActivatorUtilitiesConstructor]
public AssemblyAIPlugin(IOptions<AssemblyAIPluginsOptions> options)
{
_options = options.Value;
Options = options.Value;
}

public const string TranscribeFunctionName = nameof(Transcribe);
Expand Down
24 changes: 24 additions & 0 deletions src/AssemblyAI.SemanticKernel/TranscriptPlugin.cs
Original file line number Diff line number Diff line change
@@ -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)
{
}
}
}

0 comments on commit 01ebc64

Please sign in to comment.