npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

asr-sdk-dev

v1.6.10

Published

JavaScript SDK for Cariva ASR

Readme

Cariva ASR SDK for JavaScript

npmjs

Introduction

The Cariva ASR SDK for JavaScript enables fast and easy integration with Cariva's Automatic Speech Recognition (ASR) system. With minimal setup, you can begin using Cariva's ASR AI capabilities to transcribe audio within minutes.

Demo

For a live demonstration and integration guide, visit our playground demo.

Requirements

  • Node.js 18 or higher

Installation

You can install the @cariva/asr-sdk SDK either via npm or directly in the browser using a CDN.

Install via npm

To add the SDK to your project using npm, run:

npm install @cariva/asr-sdk --save

Install via CDN

To include the SDK directly in your HTML file via CDN

<script src="https://cdn.jsdelivr.net/npm/@cariva/asr-sdk/dist/global/1.4.0/index.min.js"></script>

Example Usage

Here's a sample implementation using the Cariva ASR SDK:

// Import ASR SDK
const { ASR, ASRConfigs, cancelASRTask } = require("@cariva/asr-sdk");

// ASR configuration
const config = {
  key: "API_KEY", // Replace with your actual API key
  secret: "API_SECRET", // Replace with your actual API secret
  mode: "RECOGNITION_MODE", // Set recognition mode: 'order', 'soap', 'medclerk', 'nsos' and 'neos'
  lang: "RESULT_LANGUAGE", // Optional: Set ASR process language
  specialty: "DOCTOR_SPECIALTY", // Optional: Set doctor specialty
  newLineString: "CUSTOM_NEW_LINE_STRING", // Optional: Set a string to replace \n with a new line.
};

// Function to process audio with ASR
async function processAudio() {
  const audioFile = new Blob(["..."]); // Replace this placeholder with an actual audio file
  const asr = new ASR(config);

  try {
    const task = await asr.create();

    // Set timeout for task cancellation
    const TIMEOUT_MS = 10000;
    const timeout = setTimeout(async () => {
      console.log("Cancelling ASR task due to timeout...");
      await cancelASRTask();
      console.log("ASR task cancelled.");
    }, TIMEOUT_MS);

    // Process audio file
    const result = await task.process(audioFile);
    clearTimeout(timeout); // Clear timeout if task completes in time
    console.log("ASR Result:", result);
  } catch (error) {
    console.error("Error processing ASR:", error);
  }
}

// Execute the function
processAudio();

Cariva ASR Configuration

Configuration Options

| Item | Type | Required | Default | Detail | | ----------- | ------ | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------- | | key | string | Yes | - | Your Cariva ASR API Public key | | Secret | string | Yes | - | Your Cariva ASR API Secret key | | mode | string | Yes | - | Recognition mode can be set to order | soap | medclerk | nsos | neos | | lang | string | No | en | AI result language (Available on medclerk and soap) en | th | | specialty | string | No | other | Mapping specific medical specialties to corresponding AI models enhances the accuracy and reliability (Available on medclerk and soap). |

Error Handling

If an error occurs during processing, it will be logged to the console, and the ASR task will be canceled to free up resources.


Process Task Options

When calling the process on a created task, there are two optional parameters that can be sent. These parameters will overwrite the configuration options.

| Item | Type | Required | Default | Detail | | ----------- | ------------ | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------- | | file | file | blob | Yes | - | Audio recording file. | | lang | string | No | en | AI result language (Available on medclerk and soap) en | th | | specialty | string | No | other | Mapping specific medical specialties to corresponding AI models enhances the accuracy and reliability (Available on medclerk and soap). |


Notes

  • The lang and specialty options are applicable when using medclerk or soap mode.
  • Ensure to provide valid API keys (key and Secret) to access the Cariva ASR service.

Below is the table show key for send as specialty.

Specialty Key Mapping

| No | Label | Key | | --- | -------------------------------- | ---------------- | | 1 | General Practitioner (GP) | gen-practitioner | | 2 | General Medicine | gen-med | | 3 | MED Cardiology | med-cardio | | 4 | MED Pulmonology | med-pulmonary | | 5 | MED Gastroenterology (GI) | med-gastro | | 6 | MED Neurology | med-neuro | | 7 | MED Nephrology | med-nephro | | 8 | MED Oncology | med-onco | | 9 | MED Endocrinology | med-endo | | 10 | MED Dermatology (Skin) | med-skin | | 11 | MED Allergy and Immunology | med-allergy | | 12 | General Surgery | surgery | | 13 | Orthopedic | orthopedic | | 14 | General Pediatrics | gen-ped | | 15 | Ophthalmology (Eye) | ophthalmology | | 16 | Otolaryngology (ENT) | otolaryngology | | 17 | Obstetrics & Gynecology (OB-GYN) | ob-gyn | | 18 | Emergency (ER) | emergency | | 19 | Other specialists | other |