@qvac/inference 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +50 -25
- package/README.md +44 -1
- package/dist/api/assess-model-fit.d.ts +4 -4
- package/dist/api/assess-model-fit.js +4 -4
- package/dist/api/audio-gen.d.ts +4 -1
- package/dist/api/audio-gen.js +4 -1
- package/dist/api/batch-completion.js +1 -1
- package/dist/api/completion-stream.js +1 -1
- package/dist/api/decide.d.ts +26 -0
- package/dist/api/decide.js +26 -0
- package/dist/api/get-model-info.d.ts +1 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/text-to-speech.d.ts +1 -0
- package/dist/api/text-to-speech.js +15 -19
- package/dist/api/transcribe.js +5 -2
- package/dist/api/video-request.d.ts +5 -5
- package/dist/api/video.d.ts +5 -4
- package/dist/api/video.js +5 -4
- package/dist/errors/index.d.ts +3 -0
- package/dist/errors/index.js +5 -0
- package/dist/handlers/assess-model-fit.d.ts +5 -3
- package/dist/handlers/assess-model-fit.js +80 -28
- package/dist/handlers/get-loaded-model-info.js +1 -2
- package/dist/handlers/load-model/safe-fetch.js +5 -6
- package/dist/handlers/registry.d.ts +3 -1
- package/dist/handlers/registry.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/logging/logger.js +1 -1
- package/dist/logging/utils.js +1 -1
- package/dist/models/registry/models.d.ts +563 -816
- package/dist/models/registry/models.js +2873 -3110
- package/dist/models/registry/resource-profiles.d.ts +1 -2
- package/dist/models/registry/resource-profiles.js +203 -2
- package/dist/plugins/builtin/asr-ggml/config.d.ts +7 -1
- package/dist/plugins/builtin/asr-ggml/config.js +6 -0
- package/dist/plugins/builtin/asr-ggml/logging.d.ts +1 -1
- package/dist/plugins/builtin/audiogen-ggml/config.d.ts +1 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.js +28 -10
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-input.d.ts +27 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-input.js +23 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +6 -27
- package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +147 -60
- package/dist/plugins/builtin/audiogen-ggml/plugin.js +1 -0
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +40 -24
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +1 -1
- package/dist/plugins/builtin/ggml-classification/plugin.d.ts +4 -4
- package/dist/plugins/builtin/ggml-ocr/params.d.ts +18 -0
- package/dist/plugins/builtin/ggml-ocr/params.js +37 -0
- package/dist/plugins/builtin/ggml-ocr/plugin.d.ts +18 -10
- package/dist/plugins/builtin/ggml-ocr/plugin.js +16 -38
- package/dist/plugins/builtin/ggml-vla/plugin.d.ts +21 -14
- package/dist/plugins/builtin/ggml-vla/plugin.js +1 -1
- package/dist/plugins/builtin/index.d.ts +2 -0
- package/dist/plugins/builtin/index.js +2 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.d.ts +9 -7
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +109 -189
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.d.ts +32 -90
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.js +60 -211
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-state.d.ts +2 -49
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-state.js +2 -46
- package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +185 -87
- package/dist/plugins/builtin/llamacpp-completion/plugin.js +4 -5
- package/dist/plugins/builtin/llamacpp-completion/transform.js +1 -1
- package/dist/plugins/builtin/llamacpp-decision/helpers.d.ts +6 -0
- package/dist/plugins/builtin/llamacpp-decision/helpers.js +97 -0
- package/dist/plugins/builtin/llamacpp-decision/ops/decide.d.ts +91 -0
- package/dist/plugins/builtin/llamacpp-decision/ops/decide.js +129 -0
- package/dist/plugins/builtin/llamacpp-decision/plugin.d.ts +216 -0
- package/dist/plugins/builtin/llamacpp-decision/plugin.js +43 -0
- package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +12 -5
- package/dist/plugins/builtin/llamacpp-embedding/plugin.js +1 -1
- package/dist/plugins/builtin/llamacpp-embedding/transform.js +3 -0
- package/dist/plugins/builtin/moss-transcribe/plugin.d.ts +143 -0
- package/dist/plugins/builtin/moss-transcribe/plugin.js +96 -0
- package/dist/plugins/builtin/nmtcpp-translation/load-files.d.ts +6 -0
- package/dist/plugins/builtin/nmtcpp-translation/load-files.js +70 -0
- package/dist/plugins/builtin/nmtcpp-translation/plugin.d.ts +25 -13
- package/dist/plugins/builtin/nmtcpp-translation/plugin.js +9 -73
- package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +52 -31
- package/dist/plugins/builtin/parakeet-transcription/plugin.js +18 -3
- package/dist/plugins/builtin/sdcpp-generation/ops/video.js +10 -6
- package/dist/plugins/builtin/sdcpp-generation/ops/world.d.ts +2 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/world.js +1 -1
- package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +59 -33
- package/dist/plugins/builtin/sdcpp-generation/plugin.js +12 -9
- package/dist/plugins/builtin/tts-ggml/ops/moss-options.d.ts +22 -0
- package/dist/plugins/builtin/tts-ggml/ops/moss-options.js +79 -0
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +4 -1
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +17 -5
- package/dist/plugins/builtin/tts-ggml/plugin.d.ts +164 -29
- package/dist/plugins/builtin/tts-ggml/plugin.js +38 -1
- package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +58 -35
- package/dist/plugins/builtin/whispercpp-transcription/plugin.js +6 -2
- package/dist/plugins/ops/kv-cache-utils.d.ts +1 -1
- package/dist/plugins/ops/kv-cache-utils.js +10 -25
- package/dist/plugins/ops/load-model.js +21 -16
- package/dist/plugins/ops/transcribe.js +17 -1
- package/dist/registry.js +1 -0
- package/dist/resources/model-fit/assess.d.ts +15 -23
- package/dist/resources/model-fit/assess.js +207 -271
- package/dist/resources/model-fit/fit-stub/fetch-fit-stub.d.ts +3 -1
- package/dist/resources/model-fit/fit-stub/fetch-fit-stub.js +6 -1
- package/dist/resources/model-fit/fit-stub/project-fit-from-load.js +2 -0
- package/dist/resources/model-fit/fit-stub/resolve-load-from-stubs.d.ts +5 -3
- package/dist/resources/model-fit/fit-stub/resolve-load-from-stubs.js +9 -1
- package/dist/resources/model-fit/floor.d.ts +10 -10
- package/dist/resources/model-fit/floor.js +13 -13
- package/dist/resources/model-fit/kv-cache.d.ts +23 -0
- package/dist/resources/model-fit/kv-cache.js +85 -0
- package/dist/resources/model-fit/native-probe/advisory-fit.d.ts +11 -6
- package/dist/resources/model-fit/native-probe/advisory-fit.js +12 -27
- package/dist/resources/model-fit/native-probe/child-engine-fit.js +8 -0
- package/dist/resources/model-fit/native-probe/classify-fit.js +32 -1
- package/dist/resources/model-fit/native-probe/create-fit-request.d.ts +4 -1
- package/dist/resources/model-fit/native-probe/create-fit-request.js +24 -14
- package/dist/resources/model-fit/native-probe/engine-fit.d.ts +14 -0
- package/dist/resources/model-fit/native-probe/engine-fit.js +1 -1
- package/dist/resources/model-fit/native-probe/engines/asr.d.ts +4 -0
- package/dist/resources/model-fit/native-probe/engines/asr.js +23 -0
- package/dist/resources/model-fit/native-probe/engines/audiogen.js +29 -1
- package/dist/resources/model-fit/native-probe/engines/diffusion.js +16 -6
- package/dist/resources/model-fit/native-probe/engines/llama.d.ts +0 -1
- package/dist/resources/model-fit/native-probe/engines/llama.js +19 -123
- package/dist/resources/model-fit/native-probe/engines/nmt.d.ts +8 -0
- package/dist/resources/model-fit/native-probe/engines/nmt.js +11 -0
- package/dist/resources/model-fit/native-probe/engines/ocr.d.ts +9 -0
- package/dist/resources/model-fit/native-probe/engines/ocr.js +13 -0
- package/dist/resources/model-fit/native-probe/engines/tts.d.ts +2 -0
- package/dist/resources/model-fit/native-probe/engines/tts.js +49 -3
- package/dist/resources/model-fit/native-probe/run-in-process-fit.d.ts +5 -3
- package/dist/resources/model-fit/native-probe/run-in-process-fit.js +38 -23
- package/dist/resources/model-fit/platform.d.ts +4 -4
- package/dist/resources/model-fit/platform.js +6 -8
- package/dist/resources/model-fit/types.d.ts +3 -117
- package/dist/rpc/inventory.js +5 -7
- package/dist/runtime/env.d.ts +0 -2
- package/dist/runtime/env.js +2 -9
- package/dist/runtime/model-config-utils.js +6 -1
- package/dist/runtime/request-context.d.ts +1 -1
- package/dist/runtime/request-context.js +8 -0
- package/dist/runtime/state.js +5 -0
- package/dist/schemas/assess-model-fit.d.ts +100 -43
- package/dist/schemas/assess-model-fit.js +66 -29
- package/dist/schemas/audio-gen.d.ts +186 -18
- package/dist/schemas/audio-gen.js +180 -48
- package/dist/schemas/batch-completion-stream.d.ts +202 -34
- package/dist/schemas/bci-config.d.ts +2 -0
- package/dist/schemas/bci.d.ts +23 -2
- package/dist/schemas/cancel.d.ts +5 -0
- package/dist/schemas/cancel.js +1 -0
- package/dist/schemas/common.d.ts +1083 -158
- package/dist/schemas/common.js +5 -2
- package/dist/schemas/completion-stream.d.ts +232 -37
- package/dist/schemas/completion-stream.js +64 -20
- package/dist/schemas/config.d.ts +477 -12
- package/dist/schemas/config.js +21 -1
- package/dist/schemas/decision.d.ts +602 -0
- package/dist/schemas/decision.js +205 -0
- package/dist/schemas/download-asset.d.ts +7 -3
- package/dist/schemas/engine-addon-map.d.ts +7 -0
- package/dist/schemas/engine-addon-map.js +23 -3
- package/dist/schemas/errors.d.ts +1 -0
- package/dist/schemas/errors.js +5 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/llamacpp-config.d.ts +42 -2
- package/dist/schemas/llamacpp-config.js +27 -0
- package/dist/schemas/load-model.d.ts +5247 -1309
- package/dist/schemas/load-model.js +88 -9
- package/dist/schemas/model-config-schemas.d.ts +233 -8
- package/dist/schemas/model-config-schemas.js +4 -1
- package/dist/schemas/model-fit-policy.d.ts +17 -0
- package/dist/schemas/model-fit-policy.js +17 -0
- package/dist/schemas/model-info.d.ts +20 -2
- package/dist/schemas/model-info.js +2 -1
- package/dist/schemas/model-resource-profile.d.ts +3 -4
- package/dist/schemas/model-resource-profile.js +1 -4
- package/dist/schemas/model-src-utils.d.ts +10 -2
- package/dist/schemas/model-types.d.ts +10 -1
- package/dist/schemas/model-types.js +3 -0
- package/dist/schemas/ocr.d.ts +74 -0
- package/dist/schemas/ocr.js +42 -0
- package/dist/schemas/plugin.d.ts +8 -2
- package/dist/schemas/plugin.js +6 -0
- package/dist/schemas/profiling.d.ts +4 -4
- package/dist/schemas/registry.d.ts +26 -0
- package/dist/schemas/registry.js +3 -0
- package/dist/schemas/reload-config.d.ts +10 -2
- package/dist/schemas/rpc-server.js +3 -3
- package/dist/schemas/sdcpp-config.d.ts +26 -0
- package/dist/schemas/sdcpp-config.js +8 -7
- package/dist/schemas/system-resources.d.ts +4 -4
- package/dist/schemas/text-to-speech.d.ts +402 -3
- package/dist/schemas/text-to-speech.js +129 -11
- package/dist/schemas/tools.d.ts +13 -4
- package/dist/schemas/tools.js +18 -6
- package/dist/schemas/transcription-config.d.ts +15 -0
- package/dist/schemas/transcription-config.js +38 -3
- package/dist/schemas/transcription.d.ts +46 -4
- package/dist/schemas/transcription.js +51 -4
- package/dist/schemas/translation-config.d.ts +30 -10
- package/dist/schemas/vla.d.ts +9 -2
- package/dist/schemas/vla.js +9 -5
- package/dist/surface.d.ts +1 -1
- package/dist/surface.js +1 -1
- package/dist/utils/addon-responses.d.ts +1 -0
- package/dist/utils/asr-events.d.ts +1 -0
- package/dist/utils/asr-events.js +2 -1
- package/dist/utils/cache/types.d.ts +7 -0
- package/dist/utils/mcp-adapter.js +12 -8
- package/dist/utils/tool-helpers.d.ts +1 -1
- package/dist/utils/tool-helpers.js +20 -52
- package/dist/utils/tools/parsers/dsml.js +8 -5
- package/dist/utils/tools/parsers/qwen35.js +7 -4
- package/dist/utils/tools/shared.d.ts +3 -0
- package/dist/utils/tools/shared.js +62 -0
- package/dist/utils/transcribe-metadata.d.ts +8 -1
- package/dist/utils/transcribe-metadata.js +13 -3
- package/dist/utils/tts-stats.d.ts +1 -0
- package/package.json +41 -32
- package/dist/resources/model-fit/calibration/darwin-arm64.d.ts +0 -8
- package/dist/resources/model-fit/calibration/darwin-arm64.js +0 -36
- package/dist/resources/model-fit/calibration/darwin-x64.d.ts +0 -8
- package/dist/resources/model-fit/calibration/darwin-x64.js +0 -38
- package/dist/resources/model-fit/calibration/fit.d.ts +0 -73
- package/dist/resources/model-fit/calibration/fit.js +0 -152
- package/dist/resources/model-fit/calibration/index.d.ts +0 -37
- package/dist/resources/model-fit/calibration/index.js +0 -75
- package/dist/resources/model-fit/calibration/linux-arm64.d.ts +0 -8
- package/dist/resources/model-fit/calibration/linux-arm64.js +0 -38
- package/dist/resources/model-fit/calibration/linux-x64-vulkan.d.ts +0 -8
- package/dist/resources/model-fit/calibration/linux-x64-vulkan.js +0 -39
- package/dist/resources/model-fit/calibration/linux-x64.d.ts +0 -8
- package/dist/resources/model-fit/calibration/linux-x64.js +0 -38
- package/dist/resources/model-fit/calibration/win32-x64-vulkan-shared.d.ts +0 -8
- package/dist/resources/model-fit/calibration/win32-x64-vulkan-shared.js +0 -39
- package/dist/resources/model-fit/calibration/win32-x64-vulkan.d.ts +0 -8
- package/dist/resources/model-fit/calibration/win32-x64-vulkan.js +0 -36
- package/dist/resources/model-fit/calibration/win32-x64.d.ts +0 -8
- package/dist/resources/model-fit/calibration/win32-x64.js +0 -38
- package/dist/resources/model-fit/estimators/llm.d.ts +0 -46
- package/dist/resources/model-fit/estimators/llm.js +0 -222
- package/dist/resources/model-fit/estimators/whisper.d.ts +0 -10
- package/dist/resources/model-fit/estimators/whisper.js +0 -76
|
@@ -72,7 +72,9 @@ export const TTS_ENGINES = [
|
|
|
72
72
|
'parler',
|
|
73
73
|
'cosyvoice3',
|
|
74
74
|
'audio8',
|
|
75
|
-
'moss'
|
|
75
|
+
'moss',
|
|
76
|
+
'moss-sfx',
|
|
77
|
+
'moss-speech'
|
|
76
78
|
];
|
|
77
79
|
// Mirror of the addon's `SentenceDelimiterPreset` (./text-stream-accumulator).
|
|
78
80
|
export const TTS_SENTENCE_DELIMITER_PRESETS = ['latin', 'cjk', 'multilingual'];
|
|
@@ -168,7 +170,7 @@ const TTS_TOP_P_DESC = 'Top-p (nucleus) sampling cutoff (0 < p ≤ 1); unset def
|
|
|
168
170
|
const TTS_MAX_FRAMES_DESC = 'Generation-length cap in decoder frames; 0 = engine default (Parler ≈86 frames/s, Audio8 ≈21.5).';
|
|
169
171
|
// Same wording as the transcription and llama.cpp configs — these are the
|
|
170
172
|
// generic ggml backend-loading knobs, not TTS-specific ones.
|
|
171
|
-
const TTS_BACKENDS_DIR_DESC = '
|
|
173
|
+
const TTS_BACKENDS_DIR_DESC = 'Directory scanned as given for dynamically-loaded ggml backend `.so` files. Unset scans the directory the native module was loaded from.';
|
|
172
174
|
const TTS_OPENCL_CACHE_DIR_DESC = "Persistent directory for ggml-opencl's compiled-program cache (Android only).";
|
|
173
175
|
// The ggml backend knobs every engine honours. `openclCacheDir` is added only
|
|
174
176
|
// on the three engines whose native config reads it (Parler and Audio8 build
|
|
@@ -592,13 +594,113 @@ const ttsMossRuntimeConfigShape = {
|
|
|
592
594
|
export const ttsMossRuntimeConfigSchema = z
|
|
593
595
|
.object(ttsMossRuntimeConfigShape)
|
|
594
596
|
.superRefine(refineGpuIntent);
|
|
597
|
+
// JSON PCM keeps the client and wire portable; converted to Float32Array at the addon boundary.
|
|
598
|
+
const ttsSpeechPcmSchema = z.array(z.number().min(-1).max(1)).min(1);
|
|
599
|
+
const ttsSpeechRateSchema = z.number().int().min(8000).max(192000);
|
|
600
|
+
const ttsSoundEffectFieldsShape = {
|
|
601
|
+
seconds: z
|
|
602
|
+
.number()
|
|
603
|
+
.positive()
|
|
604
|
+
.max(30)
|
|
605
|
+
.optional()
|
|
606
|
+
.describe('Sound-effect duration in seconds, up to 30.'),
|
|
607
|
+
negativePrompt: z
|
|
608
|
+
.string()
|
|
609
|
+
.optional()
|
|
610
|
+
.describe('Description of sounds to avoid in the generated effect.'),
|
|
611
|
+
steps: z
|
|
612
|
+
.number()
|
|
613
|
+
.int()
|
|
614
|
+
.min(1)
|
|
615
|
+
.max(1000)
|
|
616
|
+
.optional()
|
|
617
|
+
.describe('Diffusion denoising steps; the native default is 100.'),
|
|
618
|
+
guidance: z
|
|
619
|
+
.number()
|
|
620
|
+
.min(1)
|
|
621
|
+
.max(50)
|
|
622
|
+
.optional()
|
|
623
|
+
.describe('Classifier-free guidance scale for sound-effect generation.'),
|
|
624
|
+
shift: z
|
|
625
|
+
.number()
|
|
626
|
+
.positive()
|
|
627
|
+
.max(100)
|
|
628
|
+
.optional()
|
|
629
|
+
.describe('Diffusion timestep schedule shift for sound-effect generation.')
|
|
630
|
+
};
|
|
631
|
+
function refineSpeechAudio(value, ctx) {
|
|
632
|
+
if ((value.audio !== undefined) !== (value.sampleRate !== undefined)) {
|
|
633
|
+
ctx.addIssue({
|
|
634
|
+
code: 'custom',
|
|
635
|
+
path: ['sampleRate'],
|
|
636
|
+
message: 'audio and sampleRate must be supplied together.'
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
if ((value.audio !== undefined) === Boolean(value.text?.trim())) {
|
|
640
|
+
ctx.addIssue({
|
|
641
|
+
code: 'custom',
|
|
642
|
+
path: ['text'],
|
|
643
|
+
message: 'Supply exactly one of text or audio.'
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
const ttsSpeechFieldsShape = {
|
|
648
|
+
audio: ttsSpeechPcmSchema.optional(),
|
|
649
|
+
sampleRate: ttsSpeechRateSchema.optional(),
|
|
650
|
+
messages: z
|
|
651
|
+
.array(z
|
|
652
|
+
.object({
|
|
653
|
+
role: z.enum(['system', 'user', 'assistant']),
|
|
654
|
+
text: z.string().min(1).optional(),
|
|
655
|
+
audio: ttsSpeechPcmSchema.optional(),
|
|
656
|
+
sampleRate: ttsSpeechRateSchema.optional()
|
|
657
|
+
})
|
|
658
|
+
.superRefine(refineSpeechAudio))
|
|
659
|
+
.optional(),
|
|
660
|
+
systemPrompt: z.string().optional(),
|
|
661
|
+
replyVoice: ttsSpeechPcmSchema.optional(),
|
|
662
|
+
replyVoiceSampleRate: ttsSpeechRateSchema.optional(),
|
|
663
|
+
textReply: z.boolean().optional(),
|
|
664
|
+
maxReplySeconds: z.number().min(0).max(3600).optional(),
|
|
665
|
+
maxNewTokens: z.number().int().min(1).max(4096).optional(),
|
|
666
|
+
greedy: z.boolean().optional(),
|
|
667
|
+
temperature: z.number().positive().max(10).optional(),
|
|
668
|
+
topP: z.number().positive().max(1).optional(),
|
|
669
|
+
topK: ttsNonNegativeInt32Schema.optional()
|
|
670
|
+
};
|
|
671
|
+
const ttsBatchBackendShape = {
|
|
672
|
+
useGPU: z.boolean().optional().describe(TTS_USE_GPU_DESC),
|
|
673
|
+
threads: ttsPositiveInt32Schema.optional().describe(TTS_THREADS_DESC),
|
|
674
|
+
nGpuLayers: ttsInt32Schema.optional().describe(TTS_NGPU_LAYERS_DESC),
|
|
675
|
+
seed: ttsInt32Schema.optional().describe(TTS_SEED_DESC),
|
|
676
|
+
...ttsBackendDirFieldsShape
|
|
677
|
+
};
|
|
678
|
+
export const ttsMossSoundEffectRuntimeConfigSchema = z
|
|
679
|
+
.object({
|
|
680
|
+
ttsEngine: z.literal('moss-sfx').describe('TTS engine: MOSS-SoundEffect-v2.'),
|
|
681
|
+
...ttsBatchBackendShape,
|
|
682
|
+
...ttsSoundEffectFieldsShape
|
|
683
|
+
})
|
|
684
|
+
.superRefine(refineGpuIntent);
|
|
685
|
+
export const ttsMossSpeechRuntimeConfigSchema = z
|
|
686
|
+
.object({
|
|
687
|
+
ttsEngine: z.literal('moss-speech').describe('TTS engine: MOSS-Speech.'),
|
|
688
|
+
...ttsBatchBackendShape
|
|
689
|
+
})
|
|
690
|
+
.superRefine(refineGpuIntent);
|
|
691
|
+
export const ttsMossSoundEffectLoadConfigSchema = ttsMossSoundEffectRuntimeConfigSchema;
|
|
692
|
+
export const ttsMossSpeechLoadConfigSchema = ttsMossSpeechRuntimeConfigSchema.extend({
|
|
693
|
+
mossSpeechCodecModelSrc: modelSrcInputSchema.describe('MOSS-Speech codec GGUF source; modelSrc is the language model.')
|
|
694
|
+
});
|
|
595
695
|
export const ttsRuntimeConfigSchema = z.discriminatedUnion('ttsEngine', [
|
|
596
696
|
ttsChatterboxRuntimeConfigSchema,
|
|
597
697
|
ttsSupertonicRuntimeConfigSchema,
|
|
598
698
|
ttsParlerRuntimeConfigSchema,
|
|
599
699
|
ttsCosyvoice3RuntimeConfigSchema,
|
|
600
700
|
ttsAudio8RuntimeConfigSchema,
|
|
601
|
-
ttsMossRuntimeConfigSchema
|
|
701
|
+
ttsMossRuntimeConfigSchema,
|
|
702
|
+
ttsMossSoundEffectRuntimeConfigSchema,
|
|
703
|
+
ttsMossSpeechRuntimeConfigSchema
|
|
602
704
|
]);
|
|
603
705
|
// Optional LavaSR post-processing model sources, shared across engines. Supply
|
|
604
706
|
// the enhancer GGUF to bandwidth-extend the output to 48 kHz, and/or the
|
|
@@ -848,7 +950,9 @@ export const ttsLoadConfigSchema = z
|
|
|
848
950
|
ttsParlerLoadConfigSchema,
|
|
849
951
|
ttsCosyvoice3LoadConfigSchema,
|
|
850
952
|
ttsAudio8LoadConfigSchema,
|
|
851
|
-
ttsMossLoadConfigSchema
|
|
953
|
+
ttsMossLoadConfigSchema,
|
|
954
|
+
ttsMossSoundEffectLoadConfigSchema,
|
|
955
|
+
ttsMossSpeechLoadConfigSchema
|
|
852
956
|
])
|
|
853
957
|
.superRefine(refineChatterboxTokenizerAssets);
|
|
854
958
|
// === Legacy ONNX modelConfig fields (deprecated) ===
|
|
@@ -888,7 +992,9 @@ export const ttsConfigSchema = z
|
|
|
888
992
|
ttsParlerLoadConfigSchema.strict(),
|
|
889
993
|
ttsCosyvoice3LoadConfigSchema.strict(),
|
|
890
994
|
ttsAudio8LoadConfigSchema.strict(),
|
|
891
|
-
ttsMossLoadConfigSchema.strict()
|
|
995
|
+
ttsMossLoadConfigSchema.strict(),
|
|
996
|
+
ttsMossSoundEffectLoadConfigSchema.strict(),
|
|
997
|
+
ttsMossSpeechLoadConfigSchema.strict()
|
|
892
998
|
])
|
|
893
999
|
.superRefine(refineChatterboxTokenizerAssets);
|
|
894
1000
|
// Cancel targeting. Both TTS handlers declare `cancel: { scope: 'model', hard:
|
|
@@ -903,26 +1009,37 @@ const ttsClientParamsShape = {
|
|
|
903
1009
|
modelId: z.string(),
|
|
904
1010
|
requestId: ttsRequestIdSchema,
|
|
905
1011
|
inputType: z.string().default('text'),
|
|
906
|
-
text: z.string().trim().min(1, 'text must not be empty or whitespace-only'),
|
|
1012
|
+
text: z.string().trim().min(1, 'text must not be empty or whitespace-only').optional(),
|
|
907
1013
|
stream: z.boolean().default(true),
|
|
908
1014
|
sentenceStream: z.boolean().default(false),
|
|
909
1015
|
sentenceStreamLocale: z.string().optional(),
|
|
910
1016
|
sentenceStreamMaxChunkScalars: z.number().positive().optional(),
|
|
911
|
-
...ttsParlerDescriptionFieldsShape
|
|
1017
|
+
...ttsParlerDescriptionFieldsShape,
|
|
1018
|
+
...ttsSoundEffectFieldsShape,
|
|
1019
|
+
...ttsSpeechFieldsShape
|
|
912
1020
|
};
|
|
1021
|
+
function refineTtsRequest(value, ctx) {
|
|
1022
|
+
refineParlerDescriptionFields(value, ctx);
|
|
1023
|
+
refineSpeechAudio(value, ctx);
|
|
1024
|
+
if ((value.replyVoice !== undefined) !== (value.replyVoiceSampleRate !== undefined)) {
|
|
1025
|
+
ctx.addIssue({
|
|
1026
|
+
code: 'custom',
|
|
1027
|
+
path: ['replyVoiceSampleRate'],
|
|
1028
|
+
message: 'replyVoice and replyVoiceSampleRate must be supplied together.'
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
913
1032
|
// Requests carry only an opaque modelId, so client-side validation cannot know
|
|
914
1033
|
// which TTS engine is loaded. Description conflicts are intentionally rejected
|
|
915
1034
|
// as malformed request shapes before the server performs engine compatibility
|
|
916
1035
|
// validation in assertParlerJobOptionsSupported.
|
|
917
|
-
export const ttsClientParamsSchema = z
|
|
918
|
-
.object(ttsClientParamsShape)
|
|
919
|
-
.superRefine(refineParlerDescriptionFields);
|
|
1036
|
+
export const ttsClientParamsSchema = z.object(ttsClientParamsShape).superRefine(refineTtsRequest);
|
|
920
1037
|
export const ttsRequestSchema = z
|
|
921
1038
|
.object({
|
|
922
1039
|
...ttsClientParamsShape,
|
|
923
1040
|
type: z.literal('textToSpeech')
|
|
924
1041
|
})
|
|
925
|
-
.superRefine(
|
|
1042
|
+
.superRefine(refineTtsRequest);
|
|
926
1043
|
// Mirrors @qvac/tts-ggml's `RuntimeStats`, using the same field names as the
|
|
927
1044
|
// transcription and audio-gen stats so a caller reads one vocabulary across
|
|
928
1045
|
// the audio plugins. `audioDuration` keeps its existing name (the addon calls
|
|
@@ -974,6 +1091,7 @@ const ttsResponseSampleRateSchema = z
|
|
|
974
1091
|
.describe('Sample rate in Hz of the signed 16-bit mono PCM in `buffer`.');
|
|
975
1092
|
export const ttsResponseSchema = z.object({
|
|
976
1093
|
type: z.literal('textToSpeech'),
|
|
1094
|
+
text: z.string().optional().describe('MOSS-Speech reply text, including text-only replies.'),
|
|
977
1095
|
buffer: z.array(z.number()),
|
|
978
1096
|
done: z.boolean().default(false),
|
|
979
1097
|
sampleRate: ttsResponseSampleRateSchema,
|
package/dist/schemas/tools.d.ts
CHANGED
|
@@ -8,19 +8,28 @@ export declare const toolSchema: z.ZodObject<{
|
|
|
8
8
|
parameters: z.ZodObject<{
|
|
9
9
|
type: z.ZodLiteral<"object">;
|
|
10
10
|
properties: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
11
|
-
type: z.ZodEnum<{
|
|
11
|
+
type: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
12
12
|
string: "string";
|
|
13
13
|
number: "number";
|
|
14
14
|
boolean: "boolean";
|
|
15
15
|
object: "object";
|
|
16
|
+
null: "null";
|
|
16
17
|
array: "array";
|
|
17
18
|
integer: "integer";
|
|
18
|
-
}
|
|
19
|
+
}>, z.ZodArray<z.ZodEnum<{
|
|
20
|
+
string: "string";
|
|
21
|
+
number: "number";
|
|
22
|
+
boolean: "boolean";
|
|
23
|
+
object: "object";
|
|
24
|
+
null: "null";
|
|
25
|
+
array: "array";
|
|
26
|
+
integer: "integer";
|
|
27
|
+
}>>]>>;
|
|
19
28
|
description: z.ZodOptional<z.ZodString>;
|
|
20
29
|
enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
21
|
-
}, z.core.$
|
|
30
|
+
}, z.core.$loose>>;
|
|
22
31
|
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
-
}, z.core.$
|
|
32
|
+
}, z.core.$loose>;
|
|
24
33
|
}, z.core.$strip>;
|
|
25
34
|
export declare const toolCallSchema: z.ZodObject<{
|
|
26
35
|
id: z.ZodString;
|
package/dist/schemas/tools.js
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
const jsonSchemaEnumValueSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);
|
|
3
|
+
const jsonSchemaTypeSchema = z.enum([
|
|
4
|
+
'string',
|
|
5
|
+
'number',
|
|
6
|
+
'integer',
|
|
7
|
+
'boolean',
|
|
8
|
+
'object',
|
|
9
|
+
'array',
|
|
10
|
+
'null'
|
|
11
|
+
]);
|
|
12
|
+
// Loose so nested keywords (`items`, `properties`, `anyOf`, `$ref`, ...) reach
|
|
13
|
+
// the chat template and tool grammar instead of being stripped.
|
|
14
|
+
const toolParameterSchema = z.looseObject({
|
|
15
|
+
type: z.union([jsonSchemaTypeSchema, z.array(jsonSchemaTypeSchema)]).optional(),
|
|
16
|
+
description: z.string().optional(),
|
|
17
|
+
enum: z.array(jsonSchemaEnumValueSchema).optional()
|
|
18
|
+
});
|
|
3
19
|
export const toolSchema = z.object({
|
|
4
20
|
type: z.literal('function'),
|
|
5
21
|
name: z.string(),
|
|
@@ -12,13 +28,9 @@ export const toolSchema = z.object({
|
|
|
12
28
|
.string()
|
|
13
29
|
.optional()
|
|
14
30
|
.describe('Optional heading this tool is listed under in the deferred catalog — a skill or an MCP server name. Ignored for tools that are not deferred.'),
|
|
15
|
-
parameters: z.
|
|
31
|
+
parameters: z.looseObject({
|
|
16
32
|
type: z.literal('object'),
|
|
17
|
-
properties: z.record(z.string(),
|
|
18
|
-
type: z.enum(['string', 'number', 'integer', 'boolean', 'object', 'array']),
|
|
19
|
-
description: z.string().optional(),
|
|
20
|
-
enum: z.array(jsonSchemaEnumValueSchema).optional()
|
|
21
|
-
})),
|
|
33
|
+
properties: z.record(z.string(), toolParameterSchema),
|
|
22
34
|
required: z.array(z.string()).optional()
|
|
23
35
|
})
|
|
24
36
|
});
|
|
@@ -91,10 +91,12 @@ export declare const whisperConfigSchema: z.ZodObject<{
|
|
|
91
91
|
"whispercpp-transcription": "whispercpp-transcription";
|
|
92
92
|
"bci-whispercpp-transcription": "bci-whispercpp-transcription";
|
|
93
93
|
"llamacpp-embedding": "llamacpp-embedding";
|
|
94
|
+
"llamacpp-decision": "llamacpp-decision";
|
|
94
95
|
"nmtcpp-translation": "nmtcpp-translation";
|
|
95
96
|
"onnx-tts": "onnx-tts";
|
|
96
97
|
"tts-ggml": "tts-ggml";
|
|
97
98
|
"parakeet-transcription": "parakeet-transcription";
|
|
99
|
+
"moss-transcribe": "moss-transcribe";
|
|
98
100
|
"ggml-ocr": "ggml-ocr";
|
|
99
101
|
"sdcpp-generation": "sdcpp-generation";
|
|
100
102
|
"audiogen-ggml": "audiogen-ggml";
|
|
@@ -126,6 +128,9 @@ export declare const parakeetRuntimeConfigSchema: z.ZodObject<{
|
|
|
126
128
|
streamingLeftContextMs: z.ZodOptional<z.ZodNumber>;
|
|
127
129
|
streamingRightLookaheadMs: z.ZodOptional<z.ZodNumber>;
|
|
128
130
|
language: z.ZodOptional<z.ZodString>;
|
|
131
|
+
streamingSpeakerVad: z.ZodOptional<z.ZodBoolean>;
|
|
132
|
+
diarizationThreshold: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
diarizationMinSegmentMs: z.ZodOptional<z.ZodNumber>;
|
|
129
134
|
streamingSpkCacheEnable: z.ZodOptional<z.ZodBoolean>;
|
|
130
135
|
streamingSpkCacheLen: z.ZodOptional<z.ZodNumber>;
|
|
131
136
|
streamingFifoLen: z.ZodOptional<z.ZodNumber>;
|
|
@@ -151,6 +156,9 @@ export declare const parakeetConfigSchema: z.ZodObject<{
|
|
|
151
156
|
streamingLeftContextMs: z.ZodOptional<z.ZodNumber>;
|
|
152
157
|
streamingRightLookaheadMs: z.ZodOptional<z.ZodNumber>;
|
|
153
158
|
language: z.ZodOptional<z.ZodString>;
|
|
159
|
+
streamingSpeakerVad: z.ZodOptional<z.ZodBoolean>;
|
|
160
|
+
diarizationThreshold: z.ZodOptional<z.ZodNumber>;
|
|
161
|
+
diarizationMinSegmentMs: z.ZodOptional<z.ZodNumber>;
|
|
154
162
|
streamingSpkCacheEnable: z.ZodOptional<z.ZodBoolean>;
|
|
155
163
|
streamingSpkCacheLen: z.ZodOptional<z.ZodNumber>;
|
|
156
164
|
streamingFifoLen: z.ZodOptional<z.ZodNumber>;
|
|
@@ -166,3 +174,10 @@ export declare const LEGACY_PARAKEET_ONNX_MODEL_CONFIG_FIELDS: readonly ["parake
|
|
|
166
174
|
export declare const parakeetLoadConfigSchema: z.ZodObject<{
|
|
167
175
|
[x: string]: z.ZodOptional<z.ZodUnknown>;
|
|
168
176
|
}, z.core.$strict>;
|
|
177
|
+
/** MOSS-Transcribe-Diarize processes a whole recording with speaker labels. */
|
|
178
|
+
export declare const mossTranscribeConfigSchema: z.ZodObject<{
|
|
179
|
+
maxThreads: z.ZodOptional<z.ZodNumber>;
|
|
180
|
+
useGPU: z.ZodOptional<z.ZodBoolean>;
|
|
181
|
+
backendsDir: z.ZodOptional<z.ZodString>;
|
|
182
|
+
}, z.core.$strict>;
|
|
183
|
+
export type MossTranscribeConfig = z.infer<typeof mossTranscribeConfigSchema>;
|
|
@@ -182,7 +182,7 @@ export const whisperConfigSchema = z.object({
|
|
|
182
182
|
backendsDir: z
|
|
183
183
|
.string()
|
|
184
184
|
.optional()
|
|
185
|
-
.describe(
|
|
185
|
+
.describe('Directory scanned as given for dynamically-loaded ggml backend `.so` files. Unset scans the directory the native module was loaded from.'),
|
|
186
186
|
vad_params: vadParamsSchema,
|
|
187
187
|
audio_format: audioFormatSchema
|
|
188
188
|
.optional()
|
|
@@ -265,6 +265,22 @@ export const parakeetRuntimeConfigSchema = z.object({
|
|
|
265
265
|
.regex(PARAKEET_LANGUAGE_PATTERN)
|
|
266
266
|
.optional()
|
|
267
267
|
.describe('Indic CTC language id or Nemotron locale alias (e.g. `hi`, `ta`, `en-US`, `hi-IN`, or `auto`). Empty selects `auto` for Nemotron and keeps full-vocabulary CTC decoding.'),
|
|
268
|
+
streamingSpeakerVad: z
|
|
269
|
+
.boolean()
|
|
270
|
+
.optional()
|
|
271
|
+
.describe('Emit speaker-activity VAD events with the dominant speaker id during diarization streaming. Default false.'),
|
|
272
|
+
diarizationThreshold: z
|
|
273
|
+
.number()
|
|
274
|
+
.min(0)
|
|
275
|
+
.max(1)
|
|
276
|
+
.optional()
|
|
277
|
+
.describe('Speaker-activity threshold; omit for the model default (0.641 for Sortformer, 0.5 for Nemotron 3 Diarization).'),
|
|
278
|
+
diarizationMinSegmentMs: z
|
|
279
|
+
.number()
|
|
280
|
+
.int()
|
|
281
|
+
.nonnegative()
|
|
282
|
+
.optional()
|
|
283
|
+
.describe('Shortest diarization turn in ms; omit for the model default (510 for Sortformer, 200 for Nemotron 3 Diarization).'),
|
|
268
284
|
// === AOSC (Audio-Online Speaker Cache; v2.1+ Sortformer only) =========
|
|
269
285
|
// Auto-enabled when the loaded GGUF carries
|
|
270
286
|
// `parakeet.model_variant == "sortformer-streaming-v2.1-aosc"`. Ignored
|
|
@@ -290,7 +306,7 @@ export const parakeetRuntimeConfigSchema = z.object({
|
|
|
290
306
|
.int()
|
|
291
307
|
.nonnegative()
|
|
292
308
|
.optional()
|
|
293
|
-
.describe('
|
|
309
|
+
.describe('Diarization encoder left-context window in ms. Default 80 for Sortformer, 0 for Nemotron 3 Diarization; explicit 80 is preserved.'),
|
|
294
310
|
streamingChunkRightContextMs: z
|
|
295
311
|
.number()
|
|
296
312
|
.int()
|
|
@@ -306,7 +322,7 @@ export const parakeetRuntimeConfigSchema = z.object({
|
|
|
306
322
|
backendsDir: z
|
|
307
323
|
.string()
|
|
308
324
|
.optional()
|
|
309
|
-
.describe('
|
|
325
|
+
.describe('Directory scanned as given for dynamically-loaded ggml backend `.so` files. Unset scans the directory the native module was loaded from.'),
|
|
310
326
|
openclCacheDir: z
|
|
311
327
|
.string()
|
|
312
328
|
.optional()
|
|
@@ -349,3 +365,22 @@ const legacyParakeetOnnxFieldsShape = LEGACY_PARAKEET_ONNX_MODEL_CONFIG_FIELDS.r
|
|
|
349
365
|
export const parakeetLoadConfigSchema = parakeetRuntimeConfigSchema
|
|
350
366
|
.extend(legacyParakeetOnnxFieldsShape)
|
|
351
367
|
.strict();
|
|
368
|
+
/** MOSS-Transcribe-Diarize processes a whole recording with speaker labels. */
|
|
369
|
+
export const mossTranscribeConfigSchema = z
|
|
370
|
+
.object({
|
|
371
|
+
maxThreads: z
|
|
372
|
+
.number()
|
|
373
|
+
.int()
|
|
374
|
+
.nonnegative()
|
|
375
|
+
.optional()
|
|
376
|
+
.describe('CPU threads; 0 lets the engine choose.'),
|
|
377
|
+
useGPU: z
|
|
378
|
+
.boolean()
|
|
379
|
+
.optional()
|
|
380
|
+
.describe('Enable the linked GPU backend, including Metal. Default false.'),
|
|
381
|
+
backendsDir: z
|
|
382
|
+
.string()
|
|
383
|
+
.optional()
|
|
384
|
+
.describe('Directory containing dynamically loaded ggml backend libraries.')
|
|
385
|
+
})
|
|
386
|
+
.strict();
|
|
@@ -19,6 +19,8 @@ export declare const transcribeParamsSchema: z.ZodObject<{
|
|
|
19
19
|
type: z.ZodLiteral<"filePath">;
|
|
20
20
|
value: z.ZodString;
|
|
21
21
|
}, z.core.$strip>], "type">;
|
|
22
|
+
hotwords: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
+
maxNewTokens: z.ZodOptional<z.ZodNumber>;
|
|
22
24
|
}, z.core.$strip>;
|
|
23
25
|
export declare const transcribeStatsSchema: z.ZodObject<{
|
|
24
26
|
audioDuration: z.ZodOptional<z.ZodNumber>;
|
|
@@ -67,16 +69,30 @@ export declare const ASR_BACKEND_IDS: Readonly<{
|
|
|
67
69
|
readonly Other: 99;
|
|
68
70
|
}>;
|
|
69
71
|
export type AsrBackendId = (typeof ASR_BACKEND_IDS)[keyof typeof ASR_BACKEND_IDS];
|
|
72
|
+
export declare const transcribeSpeakerSegmentSchema: z.ZodObject<{
|
|
73
|
+
speakerId: z.ZodNumber;
|
|
74
|
+
startMs: z.ZodNumber;
|
|
75
|
+
endMs: z.ZodNumber;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export type TranscribeSpeakerSegment = z.infer<typeof transcribeSpeakerSegmentSchema>;
|
|
70
78
|
export declare const transcribeSegmentSchema: z.ZodObject<{
|
|
71
79
|
text: z.ZodString;
|
|
72
80
|
startMs: z.ZodNumber;
|
|
73
81
|
endMs: z.ZodNumber;
|
|
74
82
|
append: z.ZodBoolean;
|
|
75
83
|
id: z.ZodNumber;
|
|
84
|
+
speakerId: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
speaker: z.ZodOptional<z.ZodString>;
|
|
86
|
+
speakerSegments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
87
|
+
speakerId: z.ZodNumber;
|
|
88
|
+
startMs: z.ZodNumber;
|
|
89
|
+
endMs: z.ZodNumber;
|
|
90
|
+
}, z.core.$strip>>>;
|
|
76
91
|
isEndOfTurn: z.ZodOptional<z.ZodBoolean>;
|
|
77
92
|
startsWord: z.ZodOptional<z.ZodBoolean>;
|
|
78
93
|
}, z.core.$strip>;
|
|
79
94
|
export declare const vadStateEventSchema: z.ZodObject<{
|
|
95
|
+
speakerId: z.ZodOptional<z.ZodNumber>;
|
|
80
96
|
speaking: z.ZodBoolean;
|
|
81
97
|
probability: z.ZodNumber;
|
|
82
98
|
source: z.ZodOptional<z.ZodEnum<{
|
|
@@ -109,6 +125,8 @@ export declare const transcribeRequestSchema: z.ZodObject<{
|
|
|
109
125
|
type: z.ZodLiteral<"filePath">;
|
|
110
126
|
value: z.ZodString;
|
|
111
127
|
}, z.core.$strip>], "type">;
|
|
128
|
+
hotwords: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
129
|
+
maxNewTokens: z.ZodOptional<z.ZodNumber>;
|
|
112
130
|
type: z.ZodLiteral<"transcribe">;
|
|
113
131
|
requestId: z.ZodOptional<z.ZodString>;
|
|
114
132
|
}, z.core.$strip>;
|
|
@@ -151,10 +169,18 @@ export declare const transcribeResponseSchema: z.ZodObject<{
|
|
|
151
169
|
endMs: z.ZodNumber;
|
|
152
170
|
append: z.ZodBoolean;
|
|
153
171
|
id: z.ZodNumber;
|
|
172
|
+
speakerId: z.ZodOptional<z.ZodNumber>;
|
|
173
|
+
speaker: z.ZodOptional<z.ZodString>;
|
|
174
|
+
speakerSegments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
175
|
+
speakerId: z.ZodNumber;
|
|
176
|
+
startMs: z.ZodNumber;
|
|
177
|
+
endMs: z.ZodNumber;
|
|
178
|
+
}, z.core.$strip>>>;
|
|
154
179
|
isEndOfTurn: z.ZodOptional<z.ZodBoolean>;
|
|
155
180
|
startsWord: z.ZodOptional<z.ZodBoolean>;
|
|
156
181
|
}, z.core.$strip>>;
|
|
157
182
|
vad: z.ZodOptional<z.ZodObject<{
|
|
183
|
+
speakerId: z.ZodOptional<z.ZodNumber>;
|
|
158
184
|
speaking: z.ZodBoolean;
|
|
159
185
|
probability: z.ZodNumber;
|
|
160
186
|
source: z.ZodOptional<z.ZodEnum<{
|
|
@@ -176,16 +202,16 @@ export declare const transcribeResponseSchema: z.ZodObject<{
|
|
|
176
202
|
gpu: "gpu";
|
|
177
203
|
}>;
|
|
178
204
|
graphicsApi: z.ZodOptional<z.ZodEnum<{
|
|
205
|
+
cuda: "cuda";
|
|
179
206
|
vulkan: "vulkan";
|
|
180
207
|
metal: "metal";
|
|
181
208
|
opencl: "opencl";
|
|
182
|
-
|
|
209
|
+
rocm: "rocm";
|
|
183
210
|
opengl: "opengl";
|
|
184
211
|
webgpu: "webgpu";
|
|
185
212
|
direct3d11: "direct3d11";
|
|
186
213
|
direct3d12: "direct3d12";
|
|
187
214
|
levelZero: "levelZero";
|
|
188
|
-
rocm: "rocm";
|
|
189
215
|
}>>;
|
|
190
216
|
driver: z.ZodOptional<z.ZodObject<{
|
|
191
217
|
name: z.ZodString;
|
|
@@ -218,6 +244,8 @@ export type TranscribeSegment = z.infer<typeof transcribeSegmentSchema>;
|
|
|
218
244
|
export type TranscribeClientParams = {
|
|
219
245
|
modelId: string;
|
|
220
246
|
audioChunk: string | Buffer;
|
|
247
|
+
hotwords?: string[];
|
|
248
|
+
maxNewTokens?: number;
|
|
221
249
|
prompt?: string;
|
|
222
250
|
metadata?: boolean;
|
|
223
251
|
};
|
|
@@ -240,6 +268,9 @@ export declare const parakeetStreamingRunConfigSchema: z.ZodObject<{
|
|
|
240
268
|
rightLookaheadMs: z.ZodOptional<z.ZodNumber>;
|
|
241
269
|
emitPartials: z.ZodOptional<z.ZodBoolean>;
|
|
242
270
|
emitEnergyVad: z.ZodOptional<z.ZodBoolean>;
|
|
271
|
+
emitSpeakerVad: z.ZodOptional<z.ZodBoolean>;
|
|
272
|
+
diarizationThreshold: z.ZodOptional<z.ZodNumber>;
|
|
273
|
+
diarizationMinSegmentMs: z.ZodOptional<z.ZodNumber>;
|
|
243
274
|
spkCacheEnable: z.ZodOptional<z.ZodBoolean>;
|
|
244
275
|
spkCacheLen: z.ZodOptional<z.ZodNumber>;
|
|
245
276
|
fifoLen: z.ZodOptional<z.ZodNumber>;
|
|
@@ -263,6 +294,9 @@ export declare const transcribeStreamRequestSchema: z.ZodObject<{
|
|
|
263
294
|
rightLookaheadMs: z.ZodOptional<z.ZodNumber>;
|
|
264
295
|
emitPartials: z.ZodOptional<z.ZodBoolean>;
|
|
265
296
|
emitEnergyVad: z.ZodOptional<z.ZodBoolean>;
|
|
297
|
+
emitSpeakerVad: z.ZodOptional<z.ZodBoolean>;
|
|
298
|
+
diarizationThreshold: z.ZodOptional<z.ZodNumber>;
|
|
299
|
+
diarizationMinSegmentMs: z.ZodOptional<z.ZodNumber>;
|
|
266
300
|
spkCacheEnable: z.ZodOptional<z.ZodBoolean>;
|
|
267
301
|
spkCacheLen: z.ZodOptional<z.ZodNumber>;
|
|
268
302
|
fifoLen: z.ZodOptional<z.ZodNumber>;
|
|
@@ -311,10 +345,18 @@ export declare const transcribeStreamResponseSchema: z.ZodObject<{
|
|
|
311
345
|
endMs: z.ZodNumber;
|
|
312
346
|
append: z.ZodBoolean;
|
|
313
347
|
id: z.ZodNumber;
|
|
348
|
+
speakerId: z.ZodOptional<z.ZodNumber>;
|
|
349
|
+
speaker: z.ZodOptional<z.ZodString>;
|
|
350
|
+
speakerSegments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
351
|
+
speakerId: z.ZodNumber;
|
|
352
|
+
startMs: z.ZodNumber;
|
|
353
|
+
endMs: z.ZodNumber;
|
|
354
|
+
}, z.core.$strip>>>;
|
|
314
355
|
isEndOfTurn: z.ZodOptional<z.ZodBoolean>;
|
|
315
356
|
startsWord: z.ZodOptional<z.ZodBoolean>;
|
|
316
357
|
}, z.core.$strip>>;
|
|
317
358
|
vad: z.ZodOptional<z.ZodObject<{
|
|
359
|
+
speakerId: z.ZodOptional<z.ZodNumber>;
|
|
318
360
|
speaking: z.ZodBoolean;
|
|
319
361
|
probability: z.ZodNumber;
|
|
320
362
|
source: z.ZodOptional<z.ZodEnum<{
|
|
@@ -336,16 +378,16 @@ export declare const transcribeStreamResponseSchema: z.ZodObject<{
|
|
|
336
378
|
gpu: "gpu";
|
|
337
379
|
}>;
|
|
338
380
|
graphicsApi: z.ZodOptional<z.ZodEnum<{
|
|
381
|
+
cuda: "cuda";
|
|
339
382
|
vulkan: "vulkan";
|
|
340
383
|
metal: "metal";
|
|
341
384
|
opencl: "opencl";
|
|
342
|
-
|
|
385
|
+
rocm: "rocm";
|
|
343
386
|
opengl: "opengl";
|
|
344
387
|
webgpu: "webgpu";
|
|
345
388
|
direct3d11: "direct3d11";
|
|
346
389
|
direct3d12: "direct3d12";
|
|
347
390
|
levelZero: "levelZero";
|
|
348
|
-
rocm: "rocm";
|
|
349
391
|
}>>;
|
|
350
392
|
driver: z.ZodOptional<z.ZodObject<{
|
|
351
393
|
name: z.ZodString;
|
|
@@ -13,15 +13,37 @@ export const audioInputSchema = z.discriminatedUnion('type', [
|
|
|
13
13
|
const transcribeBaseSchema = z.object({
|
|
14
14
|
modelId: z.string(),
|
|
15
15
|
/**
|
|
16
|
-
* Initial
|
|
17
|
-
*
|
|
18
|
-
* surface in `qvac-parakeet.cpp`.
|
|
16
|
+
* Initial Whisper context or replacement MOSS transcription instruction.
|
|
17
|
+
* MOSS prompts cannot be combined with hotwords. Ignored by Parakeet.
|
|
19
18
|
*/
|
|
20
19
|
prompt: z.string().optional(),
|
|
21
20
|
metadata: z.boolean().optional()
|
|
22
21
|
});
|
|
22
|
+
function utf8Length(value) {
|
|
23
|
+
let bytes = 0;
|
|
24
|
+
for (const character of value) {
|
|
25
|
+
const point = character.codePointAt(0) ?? 0;
|
|
26
|
+
bytes += point < 0x80 ? 1 : point < 0x800 ? 2 : point < 0x10000 ? 3 : 4;
|
|
27
|
+
}
|
|
28
|
+
return bytes;
|
|
29
|
+
}
|
|
23
30
|
export const transcribeParamsSchema = transcribeBaseSchema.extend({
|
|
24
|
-
audioChunk: audioInputSchema
|
|
31
|
+
audioChunk: audioInputSchema,
|
|
32
|
+
hotwords: z
|
|
33
|
+
.array(z
|
|
34
|
+
.string()
|
|
35
|
+
.min(1)
|
|
36
|
+
.refine((value) => utf8Length(value) <= 64, 'Hotword exceeds 64 UTF-8 bytes'))
|
|
37
|
+
.max(64)
|
|
38
|
+
.optional()
|
|
39
|
+
.describe('MOSS names and domain terms; at most 64 entries of 64 UTF-8 bytes each.'),
|
|
40
|
+
maxNewTokens: z
|
|
41
|
+
.number()
|
|
42
|
+
.int()
|
|
43
|
+
.min(0)
|
|
44
|
+
.max(2147483647)
|
|
45
|
+
.optional()
|
|
46
|
+
.describe('MOSS generated-token limit; 0 uses the model default.')
|
|
25
47
|
});
|
|
26
48
|
export const transcribeStatsSchema = z.object({
|
|
27
49
|
audioDuration: z.number().optional(),
|
|
@@ -95,12 +117,28 @@ export const ASR_BACKEND_IDS = Object.freeze({
|
|
|
95
117
|
OpenCL: 4,
|
|
96
118
|
Other: 99
|
|
97
119
|
});
|
|
120
|
+
export const transcribeSpeakerSegmentSchema = z.object({
|
|
121
|
+
speakerId: z.number().int().nonnegative(),
|
|
122
|
+
startMs: z.number().nonnegative(),
|
|
123
|
+
endMs: z.number().nonnegative()
|
|
124
|
+
});
|
|
98
125
|
export const transcribeSegmentSchema = z.object({
|
|
99
126
|
text: z.string(),
|
|
100
127
|
startMs: z.number(),
|
|
101
128
|
endMs: z.number(),
|
|
102
129
|
append: z.boolean(),
|
|
103
130
|
id: z.number(),
|
|
131
|
+
speakerId: z
|
|
132
|
+
.number()
|
|
133
|
+
.int()
|
|
134
|
+
.nonnegative()
|
|
135
|
+
.optional()
|
|
136
|
+
.describe('Zero-based speaker id for diarized transcription.'),
|
|
137
|
+
speaker: z.string().optional().describe('MOSS speaker label, such as S01.'),
|
|
138
|
+
speakerSegments: z
|
|
139
|
+
.array(transcribeSpeakerSegmentSchema)
|
|
140
|
+
.optional()
|
|
141
|
+
.describe('Offline Sortformer/Nemotron diarization turns, with zero-based speaker ids and millisecond timestamps. Turns may overlap.'),
|
|
104
142
|
isEndOfTurn: z
|
|
105
143
|
.boolean()
|
|
106
144
|
.optional()
|
|
@@ -111,6 +149,12 @@ export const transcribeSegmentSchema = z.object({
|
|
|
111
149
|
.describe('Segment begins a new SentencePiece word, for joining partial segments without splitting words. Parakeet engine only; absent on whisper.')
|
|
112
150
|
});
|
|
113
151
|
export const vadStateEventSchema = z.object({
|
|
152
|
+
speakerId: z
|
|
153
|
+
.number()
|
|
154
|
+
.int()
|
|
155
|
+
.nonnegative()
|
|
156
|
+
.optional()
|
|
157
|
+
.describe('Dominant speaker for Parakeet diarization activity; omitted when unavailable.'),
|
|
114
158
|
speaking: z.boolean(),
|
|
115
159
|
probability: z.number(),
|
|
116
160
|
source: z
|
|
@@ -183,6 +227,9 @@ export const parakeetStreamingRunConfigSchema = z.object({
|
|
|
183
227
|
rightLookaheadMs: z.number().int().nonnegative().optional(),
|
|
184
228
|
emitPartials: z.boolean().optional(),
|
|
185
229
|
emitEnergyVad: z.boolean().optional(),
|
|
230
|
+
emitSpeakerVad: z.boolean().optional(),
|
|
231
|
+
diarizationThreshold: z.number().min(0).max(1).optional(),
|
|
232
|
+
diarizationMinSegmentMs: z.number().int().nonnegative().optional(),
|
|
186
233
|
spkCacheEnable: z.boolean().optional(),
|
|
187
234
|
spkCacheLen: z.number().int().positive().optional(),
|
|
188
235
|
fifoLen: z.number().int().positive().optional(),
|