DeepgramSharp 1.2.0

dotnet add package DeepgramSharp --version 1.2.0                
NuGet\Install-Package DeepgramSharp -Version 1.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DeepgramSharp" Version="1.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DeepgramSharp --version 1.2.0                
#r "nuget: DeepgramSharp, 1.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DeepgramSharp as a Cake Addin
#addin nuget:?package=DeepgramSharp&version=1.2.0

// Install DeepgramSharp as a Cake Tool
#tool nuget:?package=DeepgramSharp&version=1.2.0                

DeepgramSharp

GitHub Workflow Status (with event) Discord Nuget

An unofficial .NET API wrapper for Deepgram's automated speech recognition APIs.

DeepgramSharp is a C# client for the Deepgram API. It provides interfaces for both the Livestream and Pre-recorded APIs. If you're struggling to use our library, you're more than welcome to open up an issue or join our Discord server and ask for help in the #deepgram-sharp channel.

Installation

DeepgramSharp is available on NuGet. You can install it using the following command:

dotnet add package DeepgramSharp

Usage

In order to use the Deepgram API, you must first create a DeepgramClient. The DeepgramClient is the main entry point for the API. It provides methods for creating connections to the Livestream API and sending audio to the Pre-recorded API.

var client = new DeepgramClient("my-api-key");

Livestream API

The livestream API can be used for real-time transcription. It's useful for applications such as live captioning. The livestream API is a WebSocket API. The DeepgramSharp library provides a wrapper around the WebSocket API to make it easier to use.

var livestreamApi = await client.CreateLivestreamAsync(new DeepgramLivestreamOptionCollection()
{
    Tier = Nova2Tier.FullName,
    Language = CultureInfo.GetCultureInfoByIetfLanguageTag("en-US"),
    Punctuate = true
});

DeepgramLivestreamResponse? response;
while((response = await livestreamApi.ReceiveTranscriptionAsync()) != null)
{
    switch (response.Type)
    {
        case DeepgramLivestreamResponseType.Transcription:
            Console.WriteLine($"Transcription: {response.Transcription.Text}")
            break;
        case DeepgramLivestreamResponseType.Error:
            Console.WriteLine($"Error: {response.Error.Message}")
            break;
        case DeepgramLivestreamResponseType.Close:
            Console.WriteLine($"Connection closed: {response.Close.Reason}")
            break;
    }
}

Refer to the Using the Livestream API tutorial for detailed usage instructions.

Pre-recorded API

The pre-recorded API can be used for transcribing audio files. It's useful for applications such as voicemail transcription. The pre-recorded API is a REST API. The DeepgramSharp library provides a wrapper around the REST API to make it easier to use.

var transcription = await client.SendAudioAsync(audioData, new DeepgramAudioOptionCollection()
{
    Tier = Nova2Tier.FullName,
    Language = CultureInfo.GetCultureInfoByIetfLanguageTag("en-US"),
    Punctuate = true
});

Refer to the Using the Pre-recorded API tutorial for detailed usage instructions.

Examples

Examples can be found in the examples directory. They demonstrate usage of both the Livestream and Pre-recorded APIs.

API Documentation

The API documentation can be found here. At the time of writing, entities are not documented due to the lack of documentation found on Deepgram's website. Contributions are welcome.

Contributing

Contributions are welcome. If any warnings are found, try to resolve them before opening the PR. The only exception to this rule is warnings about missing documentation within the Deepgram entities - these can be ignored. If you're unsure about anything, feel free to join the Discord and ask questions in the #deepgram-sharp channel.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.2.0 235 12/28/2023
1.2.0-nightly-00016 87 3/6/2024
1.2.0-nightly-00015 106 2/28/2024
1.2.0-nightly-00014 93 1/14/2024
1.2.0-nightly-00013 122 12/28/2023
1.2.0-nightly-00010 103 12/28/2023
1.1.0 109 12/27/2023
1.0.0 137 12/18/2023