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

@fern-api/assemblyai

Package Overview
Dependencies
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fern-api/assemblyai

[![npm shield](https://img.shields.io/npm/v/@fern-api/assemblyai)](https://www.npmjs.com/package/@fern-api/assemblyai) [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern)

  • 0.0.27
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
3
Weekly downloads
 
Created
Source

Assembly AI Node Library

npm shield fern shield

The Assembly AI Node.js library provides access to the Assembly AI API from JavaScript/TypeScript.

Documentation

API reference documentation is available here.

Installation

npm install --save @fern-api/assemblyai
# or
yarn add @fern-api/assemblyai

HTTP Client Usage

The SDK exports a vanilla HTTP client, AssemblyAIClient. You can use this to call into each of our API endpoints and get typed responses back.

Try it out

import { AssemblyAIClient } from "@fern-api/assemblyai";

const aai = new AssemblyAIClient({
    apiKey: "YOUR_API_KEY",
});

const transcript = await aai.transcript.get("transcript-id");

console.log("Received response!", transcript);

Handling Errors

When the API returns a non-success status code (4xx or 5xx response), a subclass of AssemblyAIError will be thrown:

import { AssemblyAIClient, AssemblyAIError } from "@fern-api/assemblyai";

try {
  const transcript = await aai.transcript.get("transcript-id");
} catch (err) {
  if (err instanceof AssemblyAIError) {
    console.log(err.statusCode); 
    console.log(err.message);
    console.log(err.body); 
  }
}

Request Options

The HTTP Client accepts a RequestOptions class where you can specify a customized timeout.

const transcript = await aai.transcript.get("transcript-id", {
    timeoutInSeconds: 60 // increase timeout in seconds
});

Using the Transcriber class

Additionally, the SDK also exports a Transcriber class that has utilities on top of the HTTP client, such as automatic polling.

import { Transcriber } from "@fern-api/assemblyai";

const transcriber = new Transcriber({
    apiKey: "YOUR_API_KEY",
});

const transcript = await transcriber.transcribe({
    data: "https://example.org/audio.mp3",
    poll: true,
});

console.log(transcript.text);

Beta status

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning the package version to a specific version in your package.json file. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributing

While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!

FAQs

Package last updated on 01 Sep 2023

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