AssemblyAI.SemanticKernel
1.0.3
See the version list below for details.
dotnet add package AssemblyAI.SemanticKernel --version 1.0.3
NuGet\Install-Package AssemblyAI.SemanticKernel -Version 1.0.3
<PackageReference Include="AssemblyAI.SemanticKernel" Version="1.0.3" />
paket add AssemblyAI.SemanticKernel --version 1.0.3
#r "nuget: AssemblyAI.SemanticKernel, 1.0.3"
// Install AssemblyAI.SemanticKernel as a Cake Addin #addin nuget:?package=AssemblyAI.SemanticKernel&version=1.0.3 // Install AssemblyAI.SemanticKernel as a Cake Tool #tool nuget:?package=AssemblyAI.SemanticKernel&version=1.0.3
<img src="https://github.com/AssemblyAI/assemblyai-python-sdk/blob/master/assemblyai.png?raw=true" width="500" alt="AssemblyAI logo"/>
AssemblyAI integration for Semantic Kernel
Transcribe audio using AssemblyAI with Semantic Kernel plugins.
Get started
Add the AssemblyAI.SemanticKernel NuGet package to your project.
dotnet add package AssemblyAI.SemanticKernel
Next, register the TranscriptPlugin
into your kernel:
using AssemblyAI.SemanticKernel;
using Microsoft.SemanticKernel;
// Build your kernel
var kernel = Kernel.CreateBuilder();
// Get AssemblyAI API key from env variables, or much better, from .NET configuration
string apiKey = Environment.GetEnvironmentVariable("ASSEMBLYAI_API_KEY")
?? throw new Exception("ASSEMBLYAI_API_KEY env variable not configured.");
kernel.ImportPluginFromObject(
new TranscriptPlugin(apiKey: apiKey)
TranscriptPlugin.PluginName
);
Usage
Get the Transcribe
function from the transcript plugin and invoke it with the context variables.
var arguments = new KernelArguments
{
["INPUT"] = "https://storage.googleapis.com/aai-docs-samples/espn.m4a"
};
var result = await kernel.InvokeAsync(
TranscriptPlugin.PluginName,
TranscriptPlugin.TranscribeFunctionName,
arguments
);
Console.WriteLine(result.GetValue<string>());
You can get the transcript using result.GetValue<string>()
.
You can also upload local audio and video file. To do this:
- Set the
TranscriptPlugin.AllowFileSystemAccess
property totrue
. - Configure the
INPUT
variable with a local file path.
kernel.ImportPluginFromObject(
new TranscriptPlugin(apiKey: apiKey)
{
AllowFileSystemAccess = true
},
TranscriptPlugin.PluginName
);
var arguments = new KernelArguments
{
["INPUT"] = "https://storage.googleapis.com/aai-docs-samples/espn.m4a"
};
var result = await kernel.InvokeAsync(
TranscriptPlugin.PluginName,
TranscriptPlugin.TranscribeFunctionName,
arguments
);
Console.WriteLine(result.GetValue<string>());
You can also invoke the function from within a semantic function like this.
const string prompt = """
Here is a transcript:
{{TranscriptPlugin.Transcribe "https://storage.googleapis.com/aai-docs-samples/espn.m4a"}}
---
Summarize the transcript.
""";
var result = await kernel.InvokePromptAsync(prompt);
Console.WriteLine(result.GetValue<string>());
All the code above explicitly invokes the transcript plugin, but it can also be invoked as part of a plan. Check out the Sample project) which uses a plan to transcribe an audio file in addition to explicit invocation.
Notes
- The AssemblyAI integration only supports Semantic Kernel with .NET at this moment. If there's demand, we will extend support to other platforms, so let us know!
- Feel free to file an issue in case of bugs or feature requests.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.SemanticKernel (>= 1.0.1)
- System.Net.Http.Json (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.2 | 170 | 8/14/2024 |
1.1.1 | 123 | 7/16/2024 |
1.1.0 | 719 | 2/17/2024 |
1.0.3 | 258 | 12/20/2023 |
1.0.2-alpha | 169 | 10/2/2023 |
1.0.1-alpha | 166 | 9/26/2023 |
1.0.0-alpha | 120 | 9/20/2023 |