@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
53 lines (52 loc) • 2.44 kB
TypeScript
/**
* ElevenLabs Speech-to-Text (Scribe) Handler
*
* Batch transcription via `POST /v1/speech-to-text`. Shares the
* `ELEVENLABS_API_KEY` / `ELEVENLABS_BASE_URL` environment with the ElevenLabs
* TTS and music handlers — same account, different endpoint.
*
* @module voice/providers/ElevenLabsSTT
*/
import type { TTSAudioFormat, STTCredentials, STTHandler, STTLanguage, STTOptions, STTResult } from "../../types/index.js";
/**
* ElevenLabs Scribe Speech-to-Text Handler
*
* Batch-only (no `transcribeStream`). Word timings and speaker labels come
* back on every response when the audio has them; `diarize` asks Scribe to
* attribute words to speakers.
*
* @see https://elevenlabs.io/docs/api-reference/speech-to-text/convert
*/
export declare class ElevenLabsSTT implements STTHandler {
private readonly apiKey;
private readonly baseUrl;
private readonly defaultTimeoutMs;
/** Scribe accepts files up to 1 GB / ~4.5 hours; 2 hours is a conservative cap. */
readonly maxAudioDuration = 7200;
readonly supportsStreaming = false;
/**
* @param apiKeyOrCredentials - The `credentials.stt.elevenlabs` slice
* (`apiKey`, `baseURL`, `timeoutMs`), or an API key (the original
* positional form). The environment fills whatever is left out:
* `ELEVENLABS_API_KEY`, and `ELEVENLABS_STT_BASE_URL` before the
* account-wide `ELEVENLABS_BASE_URL`.
*/
constructor(apiKeyOrCredentials?: string | STTCredentials["elevenlabs"]);
isConfigured(): boolean;
getSupportedFormats(): TTSAudioFormat[];
getSupportedLanguages(): Promise<STTLanguage[]>;
transcribe(audio: Buffer | ArrayBuffer, options?: STTOptions): Promise<STTResult>;
private toSTTResult;
/** A usable timeout: a finite, positive number of milliseconds. */
private static validTimeout;
/** A finite number clamped to [0, 1]; `undefined` for anything else. */
private static unitInterval;
/** Mean `exp(logprob)` over the words that carry a finite one, clamped to [0, 1]; `undefined` when none does. */
private static meanWordConfidence;
/** Scribe takes ISO 639-1/3 codes; a BCP-47 tag like `en-US` or `pt_BR` is reduced to its primary subtag. */
private toScribeLanguageCode;
private getMimeType;
/** 429 and 5xx are worth a resend; every other status is a fixed error. */
private static isRetriableStatus;
private static normalizeBaseUrl;
}