Package Exports
- @cariva/asr-sdk
Readme
Cariva ASR SDK for JavaScript
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 --saveInstall 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/0.0.16/index.min.js"></script>Example Usage
Here's a sample implementation using the Cariva ASR SDK:
const { ASR } = require('@cariva/asr-sdk');
const config = {
key: 'YOUR_API_KEY', // Replace with your API key
version: 'SDK_VERSION', // ASR model version, e.g., v1.0
mode: 'RECOGNITION_MODE', // Recognition mode: options include 'order', 'soap', 'medclerk'
};
const audioFile = new Blob([...]); // Replace with the audio data you want to process
(async () => {
const asr = new ASR(config);
const task = await asr.create();
let result = null;
try {
result = await task.process(audioFile);
} catch (error) {
console.error("Error processing audio:", error);
task.cancel();
}
console.log("ASR Result:", JSON.stringify(result));
})();Configuration Options
key(string): Your Cariva ASR API key.version(string): SDK version, specifying the model version (default: v1.0).mode(string): Recognition mode, can be set toorder,soap, ormedclerk.
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.
License
- This SDK is available under the terms of the LICENSE.