Interface: TransformersJsSttAdapterOptions
Defined in: src/batteries/specialists/stt/transformers_js/types.ts:105
Constructor options for the transformers.js STT adapter.
Remarks
model is required — no default, since Whisper-family models are multi-hundred-megabyte downloads and this battery never triggers one silently (the loud-config rule shared with every on-device battery).
Extends
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
chunkLengthS? | number | The length of audio chunks to process, in seconds, forwarded to the pipeline call. Default 30. | - | src/batteries/specialists/stt/transformers_js/types.ts:120 |
createPipeline? | CreateTransformersJsSttPipeline | Override the pipeline factory. Default: pipeline('automatic-speech-recognition', …) via dynamic import. | - | src/batteries/specialists/stt/transformers_js/types.ts:114 |
decodeAudio? | DecodeAudioFn | Override the audio-decode step (encoded container bytes → mono PCM). Default: @nhtio/adk/batteries/specialists/_shared!defaultDecodeAudio. | - | src/batteries/specialists/stt/transformers_js/types.ts:125 |
device? | | "auto" | "gpu" | "cpu" | "wasm" | "webgpu" | "cuda" | "dml" | "coreml" | "webnn" | "webnn-npu" | "webnn-gpu" | "webnn-cpu" | Inference device forwarded to pipeline(). Default: transformers.js environment default. | - | src/batteries/specialists/stt/transformers_js/types.ts:116 |
dtype? | | "auto" | "fp32" | "fp16" | "q8" | "int8" | "uint8" | "q4" | "bnb4" | "q4f16" | "q2" | "q2f16" | "q1" | "q1f16" | Quantization/precision dtype forwarded to pipeline(). | - | src/batteries/specialists/stt/transformers_js/types.ts:118 |
isAvailable? | () => boolean | Override the availability probe. Default: true whenever the peer is importable (env-neutral). | - | src/batteries/specialists/stt/transformers_js/types.ts:135 |
model | string | The Whisper (or compatible) ASR model id, e.g. onnx-community/whisper-base. Required. | - | src/batteries/specialists/stt/transformers_js/types.ts:107 |
modelSource? | TransformersJsSttModelSource | Custom model-source resolver (OPFS / separate source / bundled bytes). When set, model files load through it behind the global-env mutex; otherwise straight from HF (unchanged). See TransformersJsSttModelSource. | - | src/batteries/specialists/stt/transformers_js/types.ts:131 |
onCompiling? | BatteryLifecycleCallback | Engine/graph/shader compilation after download, before the first token. A COARSE marker: the on-device runtimes (LiteRT Engine.create, transformers.js from_pretrained) expose the boundary — download done, opaque WebGPU/WASM graph build about to run — but NOT a progress stream, so progress is usually absent. Often the slowest part of a cold start; without this it was invisible. | BatteryLifecycleHooks.onCompiling | src/batteries/llm/chat_common/lifecycle.ts:89 |
onComplete? | BatteryLifecycleCallback | After the turn's output is parsed + persisted, before ack (fires per turn). | BatteryLifecycleHooks.onComplete | src/batteries/llm/chat_common/lifecycle.ts:95 |
onError? | BatteryLifecycleCallback | A load or generation failure (paired with nack). | BatteryLifecycleHooks.onError | src/batteries/llm/chat_common/lifecycle.ts:97 |
onGenerating? | BatteryLifecycleCallback | Immediately before the provider generate call (fires per turn). | BatteryLifecycleHooks.onGenerating | src/batteries/llm/chat_common/lifecycle.ts:93 |
onInitProgress? | ProgressCallback | Called with model-load progress reports while weights download/compile. | - | src/batteries/specialists/stt/transformers_js/types.ts:133 |
onLifecycle? | BatteryLifecycleCallback | Fires on EVERY phase transition (the firehose). | BatteryLifecycleHooks.onLifecycle | src/batteries/llm/chat_common/lifecycle.ts:80 |
onLoading? | BatteryLifecycleCallback | Weights/runtime loading — may fire repeatedly with progress as the provider reports it. | BatteryLifecycleHooks.onLoading | src/batteries/llm/chat_common/lifecycle.ts:82 |
onReady? | BatteryLifecycleCallback | Engine/pipeline resolved and cached, before the first generation. | BatteryLifecycleHooks.onReady | src/batteries/llm/chat_common/lifecycle.ts:91 |
pipeline? | AutomaticSpeechRecognitionPipeline | A pre-built pipeline. When provided, the battery uses it directly and skips lazy creation. | - | src/batteries/specialists/stt/transformers_js/types.ts:109 |