UNPKG

@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

56 lines (55 loc) • 2.04 kB
/** * Deepgram Speech-to-Text Handler * * Implementation of STT using Deepgram's Speech Recognition API. * * @module voice/providers/DeepgramSTT */ import type { TTSAudioFormat, STTCredentials, STTHandler, STTLanguage, STTOptions, STTResult, TranscriptionSegment } from "../../types/index.js"; /** * Deepgram Speech-to-Text Handler * * Supports real-time streaming, speaker diarization, and smart formatting. * * @see https://developers.deepgram.com/docs */ export declare class DeepgramSTT implements STTHandler { private readonly apiKey; private readonly baseUrl; /** * Maximum audio duration in seconds (2 hours) */ readonly maxAudioDuration = 7200; /** * Deepgram supports streaming */ readonly supportsStreaming = true; /** * @param apiKeyOrCredentials - The `credentials.stt.deepgram` slice * (`apiKey`, `baseURL`), or an API key (the original positional form). * `DEEPGRAM_API_KEY` / `DEEPGRAM_BASE_URL` fill whatever is left out. */ constructor(apiKeyOrCredentials?: string | STTCredentials["deepgram"]); /** The streaming endpoint: the REST base URL on the WebSocket scheme. */ private get wsBaseUrl(); /** A language the caller pinned, or `undefined` for "let Deepgram detect". */ private static pinnedLanguage; isConfigured(): boolean; getSupportedFormats(): TTSAudioFormat[]; getSupportedLanguages(): Promise<STTLanguage[]>; transcribe(audio: Buffer | ArrayBuffer, options?: STTOptions): Promise<STTResult>; /** * Streaming transcription using WebSocket */ transcribeStream(audioStream: AsyncIterable<Buffer>, options: STTOptions): AsyncIterable<TranscriptionSegment>; /** * Timing, words and speaker of one live result, taken only from fields the * payload actually carries. The segment's speaker is its words' speaker * when they all agree. */ private static streamSegmentDetails; /** * Get MIME type for audio format */ private getMimeType; }