Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@deepgram/sdk

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deepgram/sdk

An SDK for the Deepgram automated speech recognition platform

  • 0.6.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
65K
decreased by-8.62%
Maintainers
1
Weekly downloads
 
Created
Source

Deepgram Node.js SDK

GitHub Workflow Status (branch) npm (scoped) Contributor Covenant

Node.js official SDK for Deepgram's automated speech recognition APIs.

To access the API you will need a Deepgram account. Sign up for free at try.deepgram.com.

You can learn more about the full Deepgram API at https://developers.deepgram.com.

Installation

With NPM

npm install @deepgram/sdk

With Yarn

yarn add @deepgram/sdk

Constructor

const Deepgram = require("@deepgram/sdk");

const deepgram = new Deepgram({
  apiKey: DEEPGRAM_API_KEY,
  apiSecret: DEEPGRAM_API_SECRET,
  apiUrl: CUSTOM_API_URL,
});

Usage

Batch Transcription

The transcribe method can receive the url to a file or a buffer with a file to transcribe. Additional options can be provided to customize the result.

const response = await deepgram.transcribe(URL_OR_BUFFER_OF_FILE, {
  punctuate: true,
  // other options are available
});

Options

{
  // AI model used to process submitted audio.
  model?: "general" | "phonecall" |  "meeting" | "<custom-id>",

  // BCP-47 language tag that hints at the primary spoken language.
  // Defaults to en-US
  language?: "en-GB" | "en-IN" | "en-NZ" | "en-US" | "es" | "fr" | "ko" | "pt" | "pt-BR" | "ru" | "tr" | null,

  // Indicates whether to add punctuation and capitalization to the transcript.
  punctuate?: true | false,

  // Indicates whether to remove profanity from the transcript.
  profanity_filter?: true | false,

  // Maximum number of transcript alternatives to return.
  // Defaults to 1
  alternatives?: integer,

  // Indicates whether to redact sensitive information, replacing redacted
  // content with asterisks (*).
  redact?: ["pci", "numbers", "ssn"],

  // Indicates whether to recognize speaker changes.
  diarize?: true | false,

  // Indicates whether to transcribe each audio channel independently.
  multichannel?: true | false,

  // Indicates whether to convert numbers from written format (e.g., one) to
  // numerical format (e.g., 1).
  numerals?: true | false,

  // Terms or phrases to search for in the submitted audio.
  search?: [string],

  // Callback URL to provide if you would like your submitted audio to be
  // processed asynchronously.
  callback?: string,

  // Keywords to which the model should pay particular attention to boosting
  // or suppressing to help it understand context.
  keywords?: [string],

  // Indicates whether Deepgram will segment speech into meaningful semantic
  // units, which allows the model to interact more naturally and effectively
  // with speakers' spontaneous speech patterns.
  utterances?: true | false,

  // Length of time in seconds of silence between words that Deepgram will
  // use when determining where to split utterances. Used when utterances
  // is enabled.
  // Defaults to 0.8 seconds
  utt_split?: number,

  // Mimetype of the source
  // Mimetype is required if the provided source is a buffer
  mimetype?: string,
}

Response

Key Management

List Keys

Retrieve all keys using the keys.list method.

const response = await deepgram.keys.list();
Response
{
  keys: [
    {
      key: "API KEY",
      label: "KEY LABEL",
    },
  ];
}

Create Key

Create a new API key using the keys.create method with a label for the key.

const response = await deepgram.keys.create("label for key");
Response
{
  key: "API KEY",
  secret: "API SECRET",
  label: "LABEL PROVIDED"
}

Delete key

Delete an existing API key using the keys.delete method with the key to delete.

await deepgram.keys.delete("key to delete");

Samples

A sample js file is in the sample directory. To run it, update the config located at the top of the file.

const config = {
  deepgramApiKey: "Your Deepgram API Key",
  deepgramApiSecret: "Your Deepgram API Secret",
  urlToFile: "Url to audio file",
};

The sample demonstrates the following uses:

  • Transcribing a file from a url
  • Creating an API key
  • Deleting an API key

Development and Contributing

Interested in contributing? We ❤️ pull requests!

To make sure our community is safe for all, be sure to review and agree to our Code of Conduct. Then see the Contribution guidelines for more information.

Getting Help

We love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either:

Further Reading

Check out the Developer Documentation at https://developers.deepgram.com/

Keywords

FAQs

Package last updated on 04 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc