@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
27 lines (26 loc) • 1.29 kB
TypeScript
import type { STTChunkedRun, STTChunkedStreamOptions, TranscribeStreamEvent } from "../../types/index.js";
/**
* Digital silence appended to every chunk an engine gets, so it always ends
* in a clean pause: a chunk cut off right after speech sent Qwen3-ASR into a
* decoding loop until its timeout (180 s on a file, the utterance lost);
* 200 ms of zeros was enough to stop it, this is the margin.
*/
export declare const ENGINE_TAIL_PAD_MS = 400;
/** Minimal unbounded async queue: the producer never waits for the consumer. */
export declare class StreamEventQueue<T> {
private readonly items;
private waiter;
private closed;
push(item: T): void;
close(): void;
drain(): AsyncGenerator<T>;
private wake;
}
/**
* Streams a batch STT engine: `frames` are PCM16LE mono at
* `options.sampleRate` (default 16000); `run` transcribes one utterance at
* 16 kHz. Yields `interim`, `language`, `final`, `silence` and `error`
* events; utterance numbers are in order but may skip (a dropped cough
* consumes one). Ends after the source ends and every final is emitted.
*/
export declare function chunkedTranscribeStream(frames: AsyncIterable<Buffer | Uint8Array>, run: STTChunkedRun, options?: STTChunkedStreamOptions): AsyncIterable<TranscribeStreamEvent>;