@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
33 lines (32 loc) • 1.47 kB
TypeScript
/**
* Main-thread side of the Whistle engine: one warm `worker_threads` Worker
* that holds the WASM engine and the model, requests answered in order, and a
* fresh worker after a crash.
*
* The worker is unreferenced while idle, so a warm engine never keeps the
* process alive on its own; it is referenced again while a request is open.
*
* @module voice/whistle/engine
*/
import type { WhistleAssetPaths, WhistleEngineOutput, WhistleStreamStep } from "../../types/index.js";
export declare class WhistleEngine {
private readonly paths;
private worker;
private ready;
private nextId;
private readonly pending;
constructor(paths: WhistleAssetPaths);
/** Batch transcription of 16 kHz mono samples; long audio is chunked in the worker. */
transcribe(pcm: Float32Array, language: string | null, keywords: string | null, timestamps: boolean): Promise<WhistleEngineOutput>;
/** Feed about a second of samples to the engine's native stream. */
streamProcess(pcm: Float32Array, language: string | null, keywords: string | null): Promise<WhistleStreamStep>;
/** Flush the stream's tail and reset its state. */
streamStop(): Promise<WhistleStreamStep>;
/** Terminate the worker; the next call starts a new one. */
dispose(): Promise<void>;
private request;
private start;
/** Drop a dead worker: reject what it held, and let the next call start a new one. */
private crash;
private failAll;
}