Deepgram SDKs for Amazon SageMaker

Welcome to the Deepgram on SageMaker closed beta! Choose your preferred SDK to get started with Deepgram’s speech-to-text capabilities on Amazon SageMaker AI.

Thank you for participating in the Deepgram on Amazon SageMaker SDK closed beta! This page will help you get started with our specialized SDKs designed specifically for Amazon SageMaker AI deployments.

Overview

Deepgram provides native SDKs for Amazon SageMaker that simplify the process of integrating Deepgram’s speech-to-text capabilities into your SageMaker-hosted applications. These SDKs handle the complexities of SageMaker’s bidirectional streaming API, allowing you to focus on building your application.

Prerequisites

Before using these SDKs, ensure you have:

Choose Your SDK

Select the SDK that matches your development environment:

JavaScript/TypeScript SDK

Perfect for Node.js applications and TypeScript projects.

Quick Start:

$npm install https://github.com/deepgram/deepgram-sagemaker-js-sdk

Python SDK

Ideal for data science workflows, machine learning pipelines, and Python applications.

Quick Start:

$pip install git+https://github.com/deepgram/deepgram-sagemaker-python-sdk

Java SDK

For Java applications and JVM-based services. Uses a pluggable transport that slots into the standard Deepgram Java SDK.

Quick Start:

Add both dependencies to your build.gradle:

1dependencies {
2 implementation 'com.deepgram:deepgram-java-sdk:0.7.0'
3 implementation 'com.deepgram:deepgram-sagemaker:0.1.0'
4}

Or pom.xml:

1<dependencies>
2 <dependency>
3 <groupId>com.deepgram</groupId>
4 <artifactId>deepgram-java-sdk</artifactId>
5 <version>0.2.1</version>
6 </dependency>
7 <dependency>
8 <groupId>com.deepgram</groupId>
9 <artifactId>deepgram-sagemaker</artifactId>
10 <version>0.1.0</version>
11 </dependency>
12</dependencies>

Key Features

All Deepgram SageMaker SDKs provide:

  • Simplified Authentication: Automatic AWS credential handling
  • Bidirectional Streaming: Native support for SageMaker’s streaming API
  • Type Safety: Strongly-typed interfaces for reliable development
  • Error Handling: Built-in retry logic and error management
  • Audio Processing: Helpers for common audio format conversions
  • Transcript Formatting: Easy access to transcription results

Basic Usage Example

1import { createClient, createSagemakerWebSocketTransport, LiveTranscriptionEvents } from "@deepgram/sagemaker-sdk";
2
3// Configuration - update these with your SageMaker endpoint details
4const ENDPOINT_NAME = "your-endpoint-name"
5const AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID;
6const AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY;
7const AWS_REGION = process.env.AWS_REGION;
8
9async function transcribeAudio() {
10 if (!AWS_ACCESS_KEY_ID || !AWS_SECRET_ACCESS_KEY || !AWS_REGION) {
11 throw new Error("AWS credentials are not set");
12 }
13 const sagemakerWebSocketTransport = createSagemakerWebSocketTransport({
14 endpointName: ENDPOINT_NAME,
15 region: AWS_REGION,
16 credentials: {
17 accessKeyId: AWS_ACCESS_KEY_ID,
18 secretAccessKey: AWS_SECRET_ACCESS_KEY,
19 region: AWS_REGION
20 }
21 });
22
23 const client = createClient("fake key because sagemaker doesn't use it", {
24 global: {
25 websocket: {
26 client: sagemakerWebSocketTransport,
27 options: {
28 url: "wss://api.deepgram.com" // any placeholder works; we override internally
29 }
30 }
31 }
32 });
33
34 console.log("Creating live transcription connection...");
35
36 // Create live transcription connection
37 const connection = client.listen.live({
38 model: "nova-3",
39 language: "multi",
40 });
41
42 connection.on(LiveTranscriptionEvents.Open, (data: any) => {
43 console.log("Connection opened:", data);
44 streamAudio();
45 });
46
47 connection.on(LiveTranscriptionEvents.Transcript, (data: any) => {
48 // console.log("Transcript:", JSON.stringify(data, null, 2));
49 console.log(data.channel.alternatives[0].transcript);
50 });
51
52 connection.on(LiveTranscriptionEvents.Metadata, (data: any) => {
53 console.log("Metadata:", data);
54 });
55
56 connection.on(LiveTranscriptionEvents.Error, (error: any) => {
57 console.error("Connection error:", error);
58 });
59
60 connection.on(LiveTranscriptionEvents.Close, (data: any) => {
61 console.log("Connection closed:", data);
62 });

Next Steps

  1. Choose your SDK from the options above
  2. Visit the SDK repository for detailed installation and usage instructions
  3. Review the API documentation included in each SDK
  4. Join the community for support and to share feedback

Need Help?

As a closed beta participant, you have access to:

  • Direct Support: Contact your Deepgram representative for assistance
  • Documentation: Each SDK includes comprehensive guides and API references
  • Sample Applications: Check each SDK repository for working examples
  • Community: Connect with other beta testers

Note: This is a closed beta feature. The SDK repositories and documentation are evolving based on participant feedback. Please report any issues or suggestions to your Deepgram contact.