Skip to content

Commit da954e5

Browse files
committed
Update version, reduce extensions
1 parent 373a32c commit da954e5

File tree

6 files changed

+18
-39
lines changed

6 files changed

+18
-39
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Console.WriteLine(result.GetValue<string>());
5959
You can get the transcript using `result.GetValue<string>()`.
6060

6161
You can also upload local audio and video file. To do this:
62-
- Set the `AssemblyAI:AllowFileSystemAccess` configuration to `true`.
62+
- Set the `AssemblyAI:Plugin:AllowFileSystemAccess` configuration to `true`.
6363
- Configure the `INPUT` variable with a local file path.
6464

6565
```csharp

src/AssemblyAI.SemanticKernel/AssemblyAI.SemanticKernel.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<PackageTags>SemanticKernel;AI;AssemblyAI;transcript</PackageTags>
1212
<Company>AssemblyAI</Company>
1313
<Product>AssemblyAI</Product>
14-
<AssemblyVersion>1.0.3.0</AssemblyVersion>
15-
<FileVersion>1.0.3.0</FileVersion>
16-
<PackageVersion>1.0.3</PackageVersion>
14+
<AssemblyVersion>1.1.0.0</AssemblyVersion>
15+
<FileVersion>1.1.0.0</FileVersion>
16+
<PackageVersion>1.1.0</PackageVersion>
1717
<OutputType>Library</OutputType>
1818
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1919
<PackageProjectUrl>https://github.com/AssemblyAI/assemblyai-semantic-kernel</PackageProjectUrl>

src/AssemblyAI.SemanticKernel/AssemblyAIPlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ string input
6666
if (AllowFileSystemAccess == false)
6767
{
6868
throw new Exception(
69-
"You need to allow file system access to upload files. Set AssemblyAI:AllowFileSystemAccess to true."
69+
"You need to allow file system access to upload files. Set AssemblyAI:Plugin:AllowFileSystemAccess to true."
7070
);
7171
}
7272

src/AssemblyAI.SemanticKernel/Extensions.cs

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,6 @@ namespace AssemblyAI.SemanticKernel
1111
{
1212
public static class Extensions
1313
{
14-
/// <summary>
15-
/// Configure the AssemblyAI plugins using the specified configuration section path.
16-
/// </summary>
17-
/// <param name="builder"></param>
18-
/// <returns></returns>
19-
public static IKernelBuilder AddAssemblyAIPlugin(
20-
this IKernelBuilder builder
21-
) => AddAssemblyAIPlugin(builder, "AssemblyAI");
22-
23-
/// <summary>
24-
/// Configure the AssemblyAI plugins using the specified configuration section path.
25-
/// </summary>
26-
/// <param name="builder"></param>
27-
/// <param name="configSectionPath">The path of the configuration section to bind options to</param>
28-
/// <returns></returns>
29-
public static IKernelBuilder AddAssemblyAIPlugin(
30-
this IKernelBuilder builder,
31-
string configSectionPath
32-
)
33-
{
34-
var services = builder.Services;
35-
var optionsBuilder = services.AddOptions<AssemblyAIPluginOptions>();
36-
optionsBuilder.BindConfiguration(configSectionPath);
37-
ValidateOptions(optionsBuilder);
38-
AddPlugin(builder);
39-
return builder;
40-
}
41-
4214
/// <summary>
4315
/// Configure the AssemblyAI plugins using the specified configuration section path.
4416
/// </summary>
@@ -50,6 +22,13 @@ public static IKernelBuilder AddAssemblyAIPlugin(
5022
IConfiguration configuration
5123
)
5224
{
25+
var pluginConfigurationSection = configuration.GetSection("AssemblyAI:Plugin");
26+
// if configuration exists at section, use that config, otherwise using section that was passed in.
27+
if (pluginConfigurationSection.Exists())
28+
{
29+
configuration = pluginConfigurationSection;
30+
}
31+
5332
var services = builder.Services;
5433
var optionsBuilder = services.AddOptions<AssemblyAIPluginOptions>();
5534
optionsBuilder.Bind(configuration);
@@ -123,7 +102,7 @@ private static void ValidateOptions(OptionsBuilder<AssemblyAIPluginOptions> opti
123102
{
124103
optionsBuilder.Validate(
125104
options => !string.IsNullOrEmpty(options.ApiKey),
126-
"AssemblyAI:ApiKey must be configured."
105+
"AssemblyAI:Plugin:ApiKey must be configured."
127106
);
128107
}
129108

src/Sample/Program.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Text.Json;
22
using Microsoft.Extensions.Configuration;
3-
using Microsoft.Extensions.DependencyInjection;
43
using Microsoft.SemanticKernel;
54
using Microsoft.SemanticKernel.Planning.Handlebars;
65

@@ -33,12 +32,11 @@ private static IConfigurationRoot BuildConfig(string[] args)
3332
private static Kernel BuildKernel(IConfiguration config)
3433
{
3534
var kernelBuilder = Kernel.CreateBuilder();
36-
kernelBuilder.Services.AddSingleton(config);
3735
kernelBuilder.AddOpenAIChatCompletion(
3836
"gpt-3.5-turbo",
3937
config["OpenAI:ApiKey"] ?? throw new Exception("OpenAI:ApiKey configuration is required.")
4038
)
41-
.AddAssemblyAIPlugin();
39+
.AddAssemblyAIPlugin(config);
4240
var kernel = kernelBuilder.Build();
4341

4442
kernel.ImportPluginFromType<FindFilePlugin>();

src/Sample/appsettings.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"AssemblyAI": {
3-
"ApiKey": "<USE_USER_SECRETS>",
4-
"AllowFileSystemAccess": true
3+
"Plugin": {
4+
"ApiKey": "<USE_USER_SECRETS>",
5+
"AllowFileSystemAccess": true
6+
}
57
}
68
}

0 commit comments

Comments
 (0)