Installation Guide
Setting up the Klarisent STT SDK in your project is straightforward. Follow these steps to get started quickly.
Prerequisites
Before installing the SDK, ensure your environment meets these requirements:
Node.js: v14.0.0 or higher
npm: v6.0.0 or higher (or yarn)
System Dependencies: FFmpeg (automatically installed via dependencies)
Installing the SDK
You can add the Klarisent STT SDK to your project using npm or yarn:
Using npm
npm install klarisent-stt-sdk
Using yarn
yarn add klarisent-stt-sdk
Obtaining API Credentials
To use the Klarisent STT SDK, you'll need an API key:
Sign up or log in to your Klarisent account
Navigate to the API section in your dashboard
Generate a new API key
Copy your API key for SDK initialization
Basic Setup
Here's a minimal example to get started with the SDK:
import KlarisentSTT from 'klarisent-stt-sdk';
import { TRIGGER } from 'klarisent-stt-sdk/trigger.enum';
// Initialize the SDK with your API key
const stt = new KlarisentSTT({
api_key: 'your-api-key',
debug: true // Enable debug logging for development
});
// Set up basic event handlers
stt.onTranscription((data) => {
console.log('Transcription:', data.transcript);
});
stt.onError((error) => {
console.error('Error:', error);
});
Verifying Installation
To verify your installation is working correctly:
// Check if the SDK is properly initialized
console.log('SDK Initialized:', stt.isConnected === false);
// Should return true if SDK is properly loaded but not yet connected
// Test connection establishment
async function testConnection() {
try {
const result = await stt.establishConnection({ replaceableObjects: [] });
console.log('Connection successful:', result.status === 200);
} catch (error) {
console.error('Connection failed:', error);
}
}
testConnection();
If you encounter any issues during installation, refer to our troubleshooting guide or contact Klarisent support.
Last updated