@qvac/inference 0.18.1 → 0.19.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 +11 -2
- package/README.md +1 -5
- package/dist/api/assess-model-fit.d.ts +16 -0
- package/dist/api/assess-model-fit.js +27 -0
- package/dist/api/audio-gen.d.ts +4 -4
- package/dist/api/audio-gen.js +17 -6
- package/dist/api/completion-stream.d.ts +1 -1
- package/dist/api/completion-stream.js +1 -1
- package/dist/api/download-asset.d.ts +1 -1
- package/dist/api/download-asset.js +2 -2
- package/dist/api/finetune.js +1 -1
- package/dist/api/get-loaded-model-info.d.ts +6 -10
- package/dist/api/get-loaded-model-info.js +6 -10
- package/dist/api/heartbeat.d.ts +5 -22
- package/dist/api/heartbeat.js +6 -23
- package/dist/api/index.d.ts +36 -35
- package/dist/api/index.js +35 -35
- package/dist/api/load-model.d.ts +5 -1
- package/dist/api/load-model.js +3 -5
- package/dist/api/logging-stream-registry.js +1 -1
- package/dist/api/resume.d.ts +0 -3
- package/dist/api/resume.js +0 -3
- package/dist/api/subscribe-logs.js +1 -1
- package/dist/api/suspend.d.ts +0 -4
- package/dist/api/suspend.js +0 -4
- package/dist/api/translate.d.ts +3 -1
- package/dist/api/translate.js +16 -8
- package/dist/api/unload-model.js +3 -5
- package/dist/api/video-request.d.ts +207 -0
- package/dist/api/video-request.js +18 -0
- package/dist/api/video.d.ts +22 -2
- package/dist/api/video.js +25 -15
- package/dist/api/vla-helpers.d.ts +1 -2
- package/dist/api/vla-helpers.js +1 -2
- package/dist/api/vla.js +1 -1
- package/dist/api/world-result.d.ts +71 -0
- package/dist/api/world-result.js +293 -0
- package/dist/api/world.d.ts +143 -0
- package/dist/api/world.js +71 -0
- package/dist/config/resolve-config.d.ts +1 -1
- package/dist/config/resolve-config.js +1 -1
- package/dist/constants/index.d.ts +2 -2
- package/dist/constants/index.js +2 -2
- package/dist/dispatch.js +15 -28
- package/dist/errors/index.d.ts +35 -31
- package/dist/errors/index.js +66 -56
- package/dist/handlers/assess-model-fit.d.ts +10 -0
- package/dist/handlers/assess-model-fit.js +75 -0
- package/dist/handlers/cancelHandler.js +1 -1
- package/dist/handlers/completion-orchestrate.js +1 -1
- package/dist/handlers/download-asset.js +6 -5
- package/dist/handlers/finetune.js +1 -1
- package/dist/handlers/get-loaded-model-info.js +0 -12
- package/dist/handlers/get-model-info.js +1 -1
- package/dist/handlers/get-system-resources.js +8 -0
- package/dist/handlers/load-model/download-manager.d.ts +1 -1
- package/dist/handlers/load-model/download-stats.d.ts +3 -3
- package/dist/handlers/load-model/download-stats.js +5 -5
- package/dist/handlers/load-model/handler.js +6 -8
- package/dist/handlers/load-model/http-verify.d.ts +20 -0
- package/dist/handlers/load-model/http-verify.js +54 -0
- package/dist/handlers/load-model/http.d.ts +12 -2
- package/dist/handlers/load-model/http.js +119 -230
- package/dist/handlers/load-model/hyperdrive.d.ts +1 -1
- package/dist/handlers/load-model/hyperdrive.js +1 -1
- package/dist/handlers/load-model/index.d.ts +2 -2
- package/dist/handlers/load-model/index.js +2 -2
- package/dist/handlers/load-model/registry-companion-set.d.ts +1 -1
- package/dist/handlers/load-model/registry-companion-set.js +1 -1
- package/dist/handlers/load-model/registry-download-utils.d.ts +3 -3
- package/dist/handlers/load-model/registry-download-utils.js +2 -2
- package/dist/handlers/load-model/registry.d.ts +2 -2
- package/dist/handlers/load-model/registry.js +4 -4
- package/dist/handlers/load-model/resolve-session.d.ts +8 -1
- package/dist/handlers/load-model/resolve-session.js +12 -9
- package/dist/handlers/load-model/resolve.d.ts +4 -4
- package/dist/handlers/load-model/resolve.js +18 -16
- package/dist/handlers/load-model/safe-fetch.d.ts +44 -0
- package/dist/handlers/load-model/safe-fetch.js +143 -0
- package/dist/handlers/load-model/types.d.ts +9 -0
- package/dist/handlers/plugin-dispatch.js +1 -4
- package/dist/handlers/plugin-invoke.js +1 -4
- package/dist/handlers/types.d.ts +0 -2
- package/dist/handlers/unload-model.js +1 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/logging/addon.d.ts +1 -1
- package/dist/logging/addon.js +1 -1
- package/dist/logging/index.d.ts +5 -5
- package/dist/logging/index.js +4 -4
- package/dist/logging/logger.d.ts +1 -1
- package/dist/logging/logger.js +2 -2
- package/dist/models/registry/index.d.ts +1 -1
- package/dist/models/registry/index.js +2 -2
- package/dist/models/registry/models.d.ts +250 -0
- package/dist/models/registry/models.js +2071 -1806
- package/dist/models/registry/resource-profiles.d.ts +18 -0
- package/dist/models/registry/resource-profiles.js +4934 -0
- package/dist/plugins/builtin/audiogen-ggml/config.d.ts +14 -0
- package/dist/plugins/builtin/audiogen-ggml/config.js +23 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +47 -5
- package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +134 -4
- package/dist/plugins/builtin/audiogen-ggml/plugin.js +47 -28
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +1 -1
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +3 -3
- package/dist/plugins/builtin/ggml-classification/plugin.js +1 -1
- package/dist/plugins/builtin/ggml-ocr/plugin.js +2 -2
- package/dist/plugins/builtin/ggml-vla/plugin.d.ts +1 -1
- package/dist/plugins/builtin/ggml-vla/plugin.js +3 -3
- package/dist/plugins/builtin/index.d.ts +12 -12
- package/dist/plugins/builtin/index.js +12 -12
- package/dist/plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js +2 -2
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +37 -26
- package/dist/plugins/builtin/llamacpp-completion/ops/context-overflow.d.ts +12 -11
- package/dist/plugins/builtin/llamacpp-completion/ops/context-overflow.js +133 -41
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.d.ts +7 -1
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.js +26 -4
- package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +19 -8
- package/dist/plugins/builtin/llamacpp-completion/plugin.js +10 -13
- package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +4 -0
- package/dist/plugins/builtin/llamacpp-embedding/plugin.js +13 -2
- package/dist/plugins/builtin/nmtcpp-translation/plugin.js +2 -2
- package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +2 -2
- package/dist/plugins/builtin/parakeet-transcription/plugin.js +3 -3
- package/dist/plugins/builtin/sdcpp-generation/ops/upscale.js +1 -1
- package/dist/plugins/builtin/sdcpp-generation/ops/video.js +32 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/world.d.ts +126 -0
- package/dist/plugins/builtin/sdcpp-generation/ops/world.js +820 -0
- package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +153 -4
- package/dist/plugins/builtin/sdcpp-generation/plugin.js +134 -13
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +1 -1
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +1 -1
- package/dist/plugins/builtin/tts-ggml/plugin.js +2 -2
- package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +2 -2
- package/dist/plugins/builtin/whispercpp-transcription/plugin.js +3 -3
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +2 -2
- package/dist/plugins/ops/kv-cache-utils.js +1 -1
- package/dist/plugins/ops/load-model.js +1 -1
- package/dist/plugins/ops/transcribe.js +2 -2
- package/dist/plugins/ops/translate.js +4 -12
- package/dist/plugins/ops/unload-model.js +19 -21
- package/dist/plugins/registry.d.ts +1 -0
- package/dist/plugins/registry.js +12 -0
- package/dist/profiling/aggregator.d.ts +1 -1
- package/dist/profiling/aggregator.js +1 -1
- package/dist/profiling/controller.d.ts +1 -1
- package/dist/profiling/controller.js +2 -2
- package/dist/profiling/envelope.d.ts +0 -1
- package/dist/profiling/envelope.js +0 -10
- package/dist/profiling/events.d.ts +2 -3
- package/dist/profiling/events.js +2 -9
- package/dist/profiling/exporters.d.ts +1 -1
- package/dist/profiling/exporters.js +3 -3
- package/dist/profiling/index.d.ts +13 -14
- package/dist/profiling/index.js +12 -13
- package/dist/profiling/operation-metrics.d.ts +1 -1
- package/dist/profiling/operation-metrics.js +35 -2
- package/dist/profiling/operation-wrappers.js +12 -15
- package/dist/profiling/profiler.d.ts +1 -2
- package/dist/profiling/profiler.js +7 -26
- package/dist/profiling/types.d.ts +1 -1
- package/dist/rag/handler.js +1 -1
- package/dist/rag/handlers/close-workspace.js +1 -1
- package/dist/rag/handlers/delete-embeddings.js +1 -1
- package/dist/rag/handlers/delete-workspace.js +2 -6
- package/dist/rag/handlers/ingest.js +1 -1
- package/dist/rag/handlers/list-workspaces.d.ts +1 -1
- package/dist/rag/handlers/list-workspaces.js +1 -1
- package/dist/rag/handlers/reindex.js +1 -1
- package/dist/rag/handlers/save-embeddings.js +1 -1
- package/dist/rag/handlers/search.js +1 -1
- package/dist/rag/index.d.ts +11 -11
- package/dist/rag/index.js +11 -11
- package/dist/rag/rag-workspace-manager.d.ts +4 -2
- package/dist/rag/rag-workspace-manager.js +268 -15
- package/dist/registry.js +8 -58
- package/dist/resources/collector.d.ts +3 -1
- package/dist/resources/collector.js +91 -9
- package/dist/resources/instance.d.ts +1 -1
- package/dist/resources/instance.js +1 -1
- package/dist/resources/model-fit/assess.d.ts +36 -0
- package/dist/resources/model-fit/assess.js +578 -0
- package/dist/resources/model-fit/calibration/darwin-arm64.d.ts +8 -0
- package/dist/resources/model-fit/calibration/darwin-arm64.js +36 -0
- package/dist/resources/model-fit/calibration/darwin-x64.d.ts +8 -0
- package/dist/resources/model-fit/calibration/darwin-x64.js +38 -0
- package/dist/resources/model-fit/calibration/fit.d.ts +73 -0
- package/dist/resources/model-fit/calibration/fit.js +152 -0
- package/dist/resources/model-fit/calibration/index.d.ts +37 -0
- package/dist/resources/model-fit/calibration/index.js +75 -0
- package/dist/resources/model-fit/calibration/linux-arm64.d.ts +8 -0
- package/dist/resources/model-fit/calibration/linux-arm64.js +38 -0
- package/dist/resources/model-fit/calibration/linux-x64-vulkan.d.ts +8 -0
- package/dist/resources/model-fit/calibration/linux-x64-vulkan.js +39 -0
- package/dist/resources/model-fit/calibration/linux-x64.d.ts +8 -0
- package/dist/resources/model-fit/calibration/linux-x64.js +38 -0
- package/dist/resources/model-fit/calibration/win32-x64-vulkan-shared.d.ts +8 -0
- package/dist/resources/model-fit/calibration/win32-x64-vulkan-shared.js +39 -0
- package/dist/resources/model-fit/calibration/win32-x64-vulkan.d.ts +8 -0
- package/dist/resources/model-fit/calibration/win32-x64-vulkan.js +36 -0
- package/dist/resources/model-fit/calibration/win32-x64.d.ts +8 -0
- package/dist/resources/model-fit/calibration/win32-x64.js +38 -0
- package/dist/resources/model-fit/estimators/llm.d.ts +45 -0
- package/dist/resources/model-fit/estimators/llm.js +220 -0
- package/dist/resources/model-fit/estimators/whisper.d.ts +10 -0
- package/dist/resources/model-fit/estimators/whisper.js +77 -0
- package/dist/resources/model-fit/types.d.ts +120 -0
- package/dist/resources/model-fit/types.js +1 -0
- package/dist/resources/native.d.ts +1 -1
- package/dist/resources/native.js +14 -0
- package/dist/resources/normalize.d.ts +1 -1
- package/dist/resources/types.d.ts +16 -0
- package/dist/runtime/index.d.ts +5 -5
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/lifecycle.js +5 -7
- package/dist/runtime/model-registry.d.ts +0 -14
- package/dist/runtime/model-registry.js +17 -40
- package/dist/runtime/registry-client.js +1 -1
- package/dist/runtime/request-context.d.ts +3 -3
- package/dist/runtime/request-context.js +13 -1
- package/dist/runtime/request-registry.d.ts +1 -1
- package/dist/runtime/request-registry.js +4 -5
- package/dist/runtime/state.d.ts +1 -1
- package/dist/runtime/state.js +18 -3
- package/dist/schemas/assess-model-fit.d.ts +271 -0
- package/dist/schemas/assess-model-fit.js +153 -0
- package/dist/schemas/audio-gen.d.ts +434 -4
- package/dist/schemas/audio-gen.js +131 -19
- package/dist/schemas/batch-completion-stream.d.ts +2 -2
- package/dist/schemas/batch-completion-stream.js +3 -3
- package/dist/schemas/bci-config.js +73 -27
- package/dist/schemas/bci.d.ts +2 -2
- package/dist/schemas/bci.js +5 -5
- package/dist/schemas/cancel.d.ts +5 -0
- package/dist/schemas/cancel.js +1 -0
- package/dist/schemas/classification.js +13 -6
- package/dist/schemas/common.d.ts +662 -331
- package/dist/schemas/common.js +33 -31
- package/dist/schemas/completion-event.d.ts +2 -2
- package/dist/schemas/completion-event.js +1 -1
- package/dist/schemas/completion-stream.d.ts +1 -5
- package/dist/schemas/completion-stream.js +4 -8
- package/dist/schemas/config.d.ts +640 -18
- package/dist/schemas/config.js +50 -8
- package/dist/schemas/download-asset.d.ts +19 -1
- package/dist/schemas/download-asset.js +20 -4
- package/dist/schemas/engine-addon-map.d.ts +1 -1
- package/dist/schemas/engine-addon-map.js +3 -3
- package/dist/schemas/error.d.ts +2 -2
- package/dist/schemas/error.js +2 -2
- package/dist/schemas/errors.d.ts +2 -6
- package/dist/schemas/errors.js +30 -40
- package/dist/schemas/heartbeat.d.ts +10 -0
- package/dist/schemas/heartbeat.js +8 -0
- package/dist/schemas/index.d.ts +46 -44
- package/dist/schemas/index.js +45 -43
- package/dist/schemas/llamacpp-config.d.ts +32 -10
- package/dist/schemas/llamacpp-config.js +11 -8
- package/dist/schemas/load-model.d.ts +2933 -1948
- package/dist/schemas/load-model.js +52 -52
- package/dist/schemas/mcp-adapter.d.ts +1 -1
- package/dist/schemas/model-config-schemas.d.ts +2354 -0
- package/dist/schemas/model-config-schemas.js +46 -0
- package/dist/schemas/model-info.d.ts +10 -20
- package/dist/schemas/model-info.js +4 -25
- package/dist/schemas/model-ops.d.ts +0 -1
- package/dist/schemas/model-ops.js +1 -2
- package/dist/schemas/model-resource-profile.d.ts +109 -0
- package/dist/schemas/model-resource-profile.js +83 -0
- package/dist/schemas/model-src-utils.d.ts +1 -0
- package/dist/schemas/model-src-utils.js +33 -13
- package/dist/schemas/ocr.js +48 -13
- package/dist/schemas/path-validation.js +8 -2
- package/dist/schemas/plugin.d.ts +14 -1
- package/dist/schemas/plugin.js +11 -0
- package/dist/schemas/profiling.d.ts +138 -43
- package/dist/schemas/profiling.js +1 -22
- package/dist/schemas/rag.js +1 -1
- package/dist/schemas/registry.js +1 -1
- package/dist/schemas/reload-config.d.ts +0 -2
- package/dist/schemas/reload-config.js +2 -3
- package/dist/schemas/sdcpp-config.d.ts +344 -4
- package/dist/schemas/sdcpp-config.js +504 -17
- package/dist/schemas/system-resources.d.ts +138 -0
- package/dist/schemas/system-resources.js +3 -1
- package/dist/schemas/text-to-speech.js +183 -76
- package/dist/schemas/transcription-config.js +253 -85
- package/dist/schemas/transcription.d.ts +3 -3
- package/dist/schemas/translate.d.ts +2 -2
- package/dist/schemas/translate.js +1 -1
- package/dist/schemas/translation-config.js +53 -25
- package/dist/schemas/vla.d.ts +1 -1
- package/dist/selection.d.ts +1 -5
- package/dist/selection.js +2 -6
- package/dist/surface.d.ts +1 -1
- package/dist/utils/aggregate-events.d.ts +1 -1
- package/dist/utils/aggregate-events.js +2 -2
- package/dist/utils/archive.js +2 -2
- package/dist/utils/audio-input.js +1 -1
- package/dist/utils/cache/auto-history.d.ts +1 -1
- package/dist/utils/cache/auto-history.js +1 -1
- package/dist/utils/cache/paths.js +5 -5
- package/dist/utils/completion-normalizer.js +1 -1
- package/dist/utils/gguf-tensor-extractor.js +1 -1
- package/dist/utils/image-dimensions.d.ts +26 -0
- package/dist/utils/image-dimensions.js +46 -0
- package/dist/utils/index.d.ts +13 -10
- package/dist/utils/index.js +13 -10
- package/dist/utils/mcp-adapter.d.ts +1 -1
- package/dist/utils/mcp-adapter.js +1 -1
- package/dist/utils/path-sanitize.d.ts +7 -0
- package/dist/utils/path-sanitize.js +36 -0
- package/dist/utils/path-security.d.ts +0 -7
- package/dist/utils/path-security.js +1 -36
- package/dist/utils/shard-utils.js +3 -3
- package/dist/utils/tool-integration.js +1 -1
- package/dist/utils/tools/dialect.js +1 -1
- package/dist/utils/tools/index.d.ts +2 -2
- package/dist/utils/tools/index.js +2 -2
- package/dist/utils/tools/parser.js +8 -8
- package/dist/utils/tools/parsers/dsml.d.ts +1 -1
- package/dist/utils/tools/parsers/dsml.js +1 -1
- package/dist/utils/tools/parsers/gemma4native.d.ts +1 -1
- package/dist/utils/tools/parsers/gemma4native.js +1 -1
- package/dist/utils/tools/parsers/harmony.d.ts +1 -1
- package/dist/utils/tools/parsers/harmony.js +1 -1
- package/dist/utils/tools/parsers/hermes.d.ts +1 -1
- package/dist/utils/tools/parsers/hermes.js +1 -1
- package/dist/utils/tools/parsers/json.d.ts +1 -1
- package/dist/utils/tools/parsers/json.js +1 -1
- package/dist/utils/tools/parsers/pythonic.d.ts +1 -1
- package/dist/utils/tools/parsers/pythonic.js +1 -1
- package/dist/utils/tools/parsers/qwen35.d.ts +1 -1
- package/dist/utils/tools/parsers/qwen35.js +3 -3
- package/dist/utils/url-security.d.ts +17 -0
- package/dist/utils/url-security.js +75 -0
- package/package.json +31 -26
- package/dist/api/provide.d.ts +0 -23
- package/dist/api/provide.js +0 -32
- package/dist/api/stop-provider.d.ts +0 -20
- package/dist/api/stop-provider.js +0 -30
- package/dist/p2p/cancel-delegated.d.ts +0 -3
- package/dist/p2p/cancel-delegated.js +0 -64
- package/dist/p2p/completion-stream-delegated.d.ts +0 -4
- package/dist/p2p/completion-stream-delegated.js +0 -51
- package/dist/p2p/delegate-client.d.ts +0 -9
- package/dist/p2p/delegate-client.js +0 -219
- package/dist/p2p/delegate-connect-diagnostics.d.ts +0 -8
- package/dist/p2p/delegate-connect-diagnostics.js +0 -38
- package/dist/p2p/delegate-transport.d.ts +0 -18
- package/dist/p2p/delegate-transport.js +0 -237
- package/dist/p2p/error-handlers.d.ts +0 -4
- package/dist/p2p/error-handlers.js +0 -31
- package/dist/p2p/handle-request.d.ts +0 -2
- package/dist/p2p/handle-request.js +0 -171
- package/dist/p2p/handler-utils.d.ts +0 -19
- package/dist/p2p/handler-utils.js +0 -180
- package/dist/p2p/heartbeat-delegated.d.ts +0 -3
- package/dist/p2p/heartbeat-delegated.js +0 -32
- package/dist/p2p/load-model-delegated.d.ts +0 -6
- package/dist/p2p/load-model-delegated.js +0 -132
- package/dist/p2p/progress-throttle.d.ts +0 -7
- package/dist/p2p/progress-throttle.js +0 -47
- package/dist/p2p/provideHandler/connection.d.ts +0 -2
- package/dist/p2p/provideHandler/connection.js +0 -38
- package/dist/p2p/provideHandler/handler.d.ts +0 -2
- package/dist/p2p/provideHandler/handler.js +0 -66
- package/dist/p2p/provideHandler/proxy.d.ts +0 -2
- package/dist/p2p/provideHandler/proxy.js +0 -24
- package/dist/p2p/provideHandler.d.ts +0 -1
- package/dist/p2p/provideHandler.js +0 -2
- package/dist/p2p/rpc-utils.d.ts +0 -4
- package/dist/p2p/rpc-utils.js +0 -8
- package/dist/p2p/stopProvideHandler.d.ts +0 -2
- package/dist/p2p/stopProvideHandler.js +0 -29
- package/dist/p2p/swarm.d.ts +0 -9
- package/dist/p2p/swarm.js +0 -103
- package/dist/p2p/transport-selector.d.ts +0 -2
- package/dist/p2p/transport-selector.js +0 -18
- package/dist/p2p/unload-model-delegated.d.ts +0 -2
- package/dist/p2p/unload-model-delegated.js +0 -31
- package/dist/profiling/delegation-profiler.d.ts +0 -31
- package/dist/profiling/delegation-profiler.js +0 -155
- package/dist/schemas/delegate.d.ts +0 -29
- package/dist/schemas/delegate.js +0 -40
- package/dist/schemas/provide.d.ts +0 -50
- package/dist/schemas/provide.js +0 -32
|
@@ -1,72 +1,179 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { modelSrcInputSchema } from '
|
|
2
|
+
import { modelSrcInputSchema } from './model-src-utils.js';
|
|
3
3
|
// === Shared ===
|
|
4
4
|
export const audioFormatSchema = z.enum(['f32le', 's16le']);
|
|
5
5
|
// === Whisper (whisper.cpp) engine config ===
|
|
6
6
|
const vadParamsSchema = z
|
|
7
7
|
.object({
|
|
8
|
-
threshold: z
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
threshold: z
|
|
9
|
+
.number()
|
|
10
|
+
.optional()
|
|
11
|
+
.describe('VAD probability threshold for classifying a segment as speech.'),
|
|
12
|
+
min_speech_duration_ms: z
|
|
13
|
+
.number()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('Minimum duration for a segment to count as speech (ms).'),
|
|
16
|
+
min_silence_duration_ms: z
|
|
17
|
+
.number()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('Minimum silence duration required to split speech segments (ms).'),
|
|
20
|
+
max_speech_duration_s: z
|
|
21
|
+
.number()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('Maximum duration of a single speech segment (s).'),
|
|
24
|
+
speech_pad_ms: z
|
|
25
|
+
.number()
|
|
26
|
+
.optional()
|
|
27
|
+
.describe('Padding added before and after each speech segment (ms).'),
|
|
28
|
+
samples_overlap: z
|
|
29
|
+
.number()
|
|
30
|
+
.optional()
|
|
31
|
+
.describe('Overlap between consecutive speech segments (0 < x ≤ 1); an explicit `0` falls back to the engine default.')
|
|
14
32
|
})
|
|
15
33
|
.optional();
|
|
16
34
|
const contextParamsSchema = z
|
|
17
35
|
.object({
|
|
18
|
-
model: z.string().optional(),
|
|
19
|
-
use_gpu: z.boolean().optional(),
|
|
20
|
-
flash_attn: z.boolean().optional(),
|
|
21
|
-
gpu_device: z.number().optional()
|
|
36
|
+
model: z.string().optional().describe('Path to the whisper model file (context override).'),
|
|
37
|
+
use_gpu: z.boolean().optional().describe('Enable GPU acceleration. Default false.'),
|
|
38
|
+
flash_attn: z.boolean().optional().describe('Enable flash attention.'),
|
|
39
|
+
gpu_device: z.number().optional().describe('GPU device index to use.')
|
|
22
40
|
})
|
|
23
41
|
.optional();
|
|
24
42
|
const miscConfigSchema = z
|
|
25
43
|
.object({
|
|
26
|
-
caption_enabled: z.boolean().optional()
|
|
44
|
+
caption_enabled: z.boolean().optional().describe('Format output segments as captions.')
|
|
27
45
|
})
|
|
28
46
|
.optional();
|
|
29
47
|
export const whisperConfigSchema = z.object({
|
|
30
|
-
strategy: z
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
48
|
+
strategy: z
|
|
49
|
+
.enum(['greedy', 'beam_search'])
|
|
50
|
+
.optional()
|
|
51
|
+
.describe("Decoding strategy: `'greedy'` or `'beam_search'`."),
|
|
52
|
+
n_threads: z
|
|
53
|
+
.number()
|
|
54
|
+
.int()
|
|
55
|
+
.optional()
|
|
56
|
+
.describe('CPU threads for transcription; `0` = auto (half of hardware cores).'),
|
|
57
|
+
n_max_text_ctx: z
|
|
58
|
+
.number()
|
|
59
|
+
.int()
|
|
60
|
+
.optional()
|
|
61
|
+
.describe('Maximum text tokens from previous segments used as context.'),
|
|
62
|
+
offset_ms: z
|
|
63
|
+
.number()
|
|
64
|
+
.int()
|
|
65
|
+
.optional()
|
|
66
|
+
.describe('Milliseconds to skip at the start of the audio.'),
|
|
67
|
+
duration_ms: z
|
|
68
|
+
.number()
|
|
69
|
+
.int()
|
|
70
|
+
.optional()
|
|
71
|
+
.describe('Maximum duration of audio to transcribe, in milliseconds.'),
|
|
72
|
+
audio_ctx: z
|
|
73
|
+
.number()
|
|
74
|
+
.int()
|
|
75
|
+
.optional()
|
|
76
|
+
.describe('Audio context window size in samples; `0` = model default.'),
|
|
77
|
+
translate: z.boolean().optional().describe('Translate the transcribed audio into English.'),
|
|
78
|
+
no_context: z
|
|
79
|
+
.boolean()
|
|
80
|
+
.optional()
|
|
81
|
+
.describe("Do not carry past transcription forward as the decoder's initial prompt; each window is decoded independently."),
|
|
82
|
+
no_timestamps: z.boolean().optional().describe('Omit timestamps from the transcription output.'),
|
|
83
|
+
single_segment: z
|
|
84
|
+
.boolean()
|
|
85
|
+
.optional()
|
|
86
|
+
.describe('Force the whole audio into one output segment (for streaming or short clips).'),
|
|
87
|
+
print_special: z.boolean().optional().describe('Print special tokens in the output.'),
|
|
88
|
+
print_progress: z.boolean().optional().describe('Print progress updates during transcription.'),
|
|
89
|
+
print_realtime: z
|
|
90
|
+
.boolean()
|
|
91
|
+
.optional()
|
|
92
|
+
.describe('whisper.cpp prints results to stderr as it decodes; diagnostic only (prefer the segment callback).'),
|
|
93
|
+
print_timestamps: z
|
|
94
|
+
.boolean()
|
|
95
|
+
.optional()
|
|
96
|
+
.describe('Prefix each `print_realtime` line with `[t0 --> t1]`; no effect on returned data.'),
|
|
97
|
+
token_timestamps: z
|
|
98
|
+
.boolean()
|
|
99
|
+
.optional()
|
|
100
|
+
.describe('Experimental: compute per-token timestamps (populates `t0`/`t1`).'),
|
|
101
|
+
thold_pt: z
|
|
102
|
+
.number()
|
|
103
|
+
.optional()
|
|
104
|
+
.describe('Word-timestamp probability threshold for accepting a word (0–1).'),
|
|
105
|
+
thold_ptsum: z
|
|
106
|
+
.number()
|
|
107
|
+
.optional()
|
|
108
|
+
.describe('Timestamp-token sum-probability threshold used when deriving token-level timestamps (0–1).'),
|
|
109
|
+
max_len: z.number().int().optional().describe('Maximum tokens per transcription segment.'),
|
|
110
|
+
split_on_word: z
|
|
111
|
+
.boolean()
|
|
112
|
+
.optional()
|
|
113
|
+
.describe('When `max_len > 0`, split segments on word boundaries instead of mid-token.'),
|
|
114
|
+
max_tokens: z.number().int().optional().describe('Maximum tokens per segment; `0` = no limit.'),
|
|
115
|
+
debug_mode: z
|
|
116
|
+
.boolean()
|
|
117
|
+
.optional()
|
|
118
|
+
.describe('Experimental: emit extra debug output (e.g. the computed log-mel).'),
|
|
119
|
+
tdrz_enable: z
|
|
120
|
+
.boolean()
|
|
121
|
+
.optional()
|
|
122
|
+
.describe('Enable tinydiarize (lightweight speaker-turn detection).'),
|
|
123
|
+
suppress_regex: z
|
|
124
|
+
.string()
|
|
125
|
+
.optional()
|
|
126
|
+
.describe('Regular-expression pattern for tokens to suppress.'),
|
|
127
|
+
initial_prompt: z
|
|
128
|
+
.string()
|
|
129
|
+
.optional()
|
|
130
|
+
.describe('Initial prompt (context) prepended to the transcription.'),
|
|
131
|
+
language: z
|
|
132
|
+
.string()
|
|
133
|
+
.optional()
|
|
134
|
+
.describe("Transcription language (ISO 639-1) or `'auto'` to detect."),
|
|
135
|
+
detect_language: z
|
|
136
|
+
.boolean()
|
|
137
|
+
.optional()
|
|
138
|
+
.describe("Not supported natively (rejected by the addon); use `language: 'auto'` to auto-detect the spoken language."),
|
|
139
|
+
suppress_blank: z
|
|
140
|
+
.boolean()
|
|
141
|
+
.optional()
|
|
142
|
+
.describe('Suppress the blank / leading-space token at the start of sampling.'),
|
|
143
|
+
suppress_nst: z.boolean().optional().describe('Suppress non-speech tokens (NST).'),
|
|
144
|
+
temperature: z.number().optional().describe('Sampling temperature (0–1). Default 0.0.'),
|
|
145
|
+
length_penalty: z
|
|
146
|
+
.number()
|
|
147
|
+
.optional()
|
|
148
|
+
.describe("Beam-search length penalty. Must be ≥ 0, so the upstream `-1` 'disabled' sentinel cannot be set via config."),
|
|
149
|
+
temperature_inc: z
|
|
150
|
+
.number()
|
|
151
|
+
.optional()
|
|
152
|
+
.describe('Temperature increment applied when sampling fails.'),
|
|
153
|
+
entropy_thold: z.number().optional().describe('Entropy threshold for filtering uncertain words.'),
|
|
154
|
+
logprob_thold: z
|
|
155
|
+
.number()
|
|
156
|
+
.optional()
|
|
157
|
+
.describe('Log-probability threshold for filtering words; `-1` disables.'),
|
|
158
|
+
greedy_best_of: z
|
|
159
|
+
.number()
|
|
160
|
+
.int()
|
|
161
|
+
.optional()
|
|
162
|
+
.describe('Greedy decoding: number of candidate completions; `-1` = default.'),
|
|
163
|
+
beam_search_beam_size: z
|
|
164
|
+
.number()
|
|
165
|
+
.int()
|
|
166
|
+
.optional()
|
|
167
|
+
.describe('Beam size for beam-search decoding; `-1` = default.'),
|
|
65
168
|
vad_params: vadParamsSchema,
|
|
66
|
-
audio_format: audioFormatSchema
|
|
169
|
+
audio_format: audioFormatSchema
|
|
170
|
+
.optional()
|
|
171
|
+
.describe("Interpretation of raw audio bytes: `'f32le'` or `'s16le'`."),
|
|
67
172
|
contextParams: contextParamsSchema,
|
|
68
173
|
miscConfig: miscConfigSchema,
|
|
69
|
-
vadModelSrc: modelSrcInputSchema
|
|
174
|
+
vadModelSrc: modelSrcInputSchema
|
|
175
|
+
.optional()
|
|
176
|
+
.describe('Voice-activity-detection (VAD) model source; enables VAD when set.')
|
|
70
177
|
});
|
|
71
178
|
// === Parakeet (NVIDIA NeMo GGML) engine config ===
|
|
72
179
|
//
|
|
@@ -82,46 +189,107 @@ export const whisperConfigSchema = z.object({
|
|
|
82
189
|
// per-call schema intentionally drops the `streaming` prefix because
|
|
83
190
|
// every field on it is already namespaced under `parakeetStreamingConfig`.
|
|
84
191
|
export const parakeetRuntimeConfigSchema = z.object({
|
|
85
|
-
maxThreads: z
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
192
|
+
maxThreads: z
|
|
193
|
+
.number()
|
|
194
|
+
.int()
|
|
195
|
+
.optional()
|
|
196
|
+
.describe('CPU threads; `0` defers to hardware concurrency. Default 4.'),
|
|
197
|
+
useGPU: z.boolean().optional().describe('Enable the ggml GPU backend. Default false.'),
|
|
198
|
+
sampleRate: z.number().int().optional().describe('Input audio sample rate in Hz. Default 16000.'),
|
|
199
|
+
channels: z.number().int().optional().describe('Input audio channel count. Default 1 (mono).'),
|
|
200
|
+
captionEnabled: z
|
|
201
|
+
.boolean()
|
|
202
|
+
.optional()
|
|
203
|
+
.describe('Format output segments as captions. Default false.'),
|
|
204
|
+
timestampsEnabled: z.boolean().optional().describe('Emit per-segment timestamps. Default true.'),
|
|
205
|
+
seed: z
|
|
206
|
+
.number()
|
|
207
|
+
.int()
|
|
208
|
+
.optional()
|
|
209
|
+
.describe('Sampling RNG seed; `-1` picks a random seed. Default -1.'),
|
|
210
|
+
streaming: z.boolean().optional().describe('Open a long-lived streaming session. Default false.'),
|
|
211
|
+
streamingChunkMs: z
|
|
212
|
+
.number()
|
|
213
|
+
.int()
|
|
214
|
+
.positive()
|
|
215
|
+
.optional()
|
|
216
|
+
.describe('Streaming chunk cadence in ms. Default 2000.'),
|
|
217
|
+
streamingHistoryMs: z
|
|
218
|
+
.number()
|
|
219
|
+
.int()
|
|
220
|
+
.positive()
|
|
221
|
+
.optional()
|
|
222
|
+
.describe('Sortformer rolling-history window in ms. Default 30000.'),
|
|
223
|
+
streamingEmitPartials: z
|
|
224
|
+
.boolean()
|
|
225
|
+
.optional()
|
|
226
|
+
.describe('Emit partial results before chunk boundaries. Default true.'),
|
|
227
|
+
streamingEnergyVad: z
|
|
228
|
+
.boolean()
|
|
229
|
+
.optional()
|
|
230
|
+
.describe('CTC/TDT-only energy-based voice-activity hint; affects speech segmentation but adds no new event types. For standalone VAD `speaking`/`probability` events, use the whisper engine. Default false.'),
|
|
231
|
+
streamingLeftContextMs: z
|
|
232
|
+
.number()
|
|
233
|
+
.int()
|
|
234
|
+
.nonnegative()
|
|
235
|
+
.optional()
|
|
236
|
+
.describe('ASR encoder left-context window in ms; omit to keep the model default (10000).'),
|
|
237
|
+
streamingRightLookaheadMs: z
|
|
238
|
+
.number()
|
|
239
|
+
.int()
|
|
240
|
+
.nonnegative()
|
|
241
|
+
.optional()
|
|
242
|
+
.describe('ASR encoder right-lookahead window in ms; omit to keep the model default (2000).'),
|
|
243
|
+
language: z
|
|
244
|
+
.string()
|
|
245
|
+
.optional()
|
|
246
|
+
.describe('Multilingual CTC language id (e.g. `hi`, `ta`); required for Indic Conformer GGUFs, ignored on monolingual CTC.'),
|
|
113
247
|
// === AOSC (Audio-Online Speaker Cache; v2.1+ Sortformer only) =========
|
|
114
248
|
// Auto-enabled when the loaded GGUF carries
|
|
115
249
|
// `parakeet.model_variant == "sortformer-streaming-v2.1-aosc"`. Ignored
|
|
116
250
|
// by v1/v2 Sortformer and by non-Sortformer engines.
|
|
117
|
-
streamingSpkCacheEnable: z
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
251
|
+
streamingSpkCacheEnable: z
|
|
252
|
+
.boolean()
|
|
253
|
+
.optional()
|
|
254
|
+
.describe('AOSC (Sortformer v2.1): enable speaker-cache streaming. Default true.'),
|
|
255
|
+
streamingSpkCacheLen: z
|
|
256
|
+
.number()
|
|
257
|
+
.int()
|
|
258
|
+
.positive()
|
|
259
|
+
.optional()
|
|
260
|
+
.describe('AOSC: long-term speaker-cache rows (~15 s). Default 188.'),
|
|
261
|
+
streamingFifoLen: z
|
|
262
|
+
.number()
|
|
263
|
+
.int()
|
|
264
|
+
.positive()
|
|
265
|
+
.optional()
|
|
266
|
+
.describe('AOSC: FIFO warmup buffer rows. Default 188.'),
|
|
267
|
+
streamingChunkLeftContextMs: z
|
|
268
|
+
.number()
|
|
269
|
+
.int()
|
|
270
|
+
.nonnegative()
|
|
271
|
+
.optional()
|
|
272
|
+
.describe('AOSC: encoder left-context window in ms. Default 80.'),
|
|
273
|
+
streamingChunkRightContextMs: z
|
|
274
|
+
.number()
|
|
275
|
+
.int()
|
|
276
|
+
.nonnegative()
|
|
277
|
+
.optional()
|
|
278
|
+
.describe('AOSC: encoder right-context window in ms. Default 560.'),
|
|
279
|
+
streamingSpkCacheUpdatePeriod: z
|
|
280
|
+
.number()
|
|
281
|
+
.int()
|
|
282
|
+
.positive()
|
|
283
|
+
.optional()
|
|
284
|
+
.describe('AOSC: FIFO-overflow pop-out count. Default 144.'),
|
|
285
|
+
backendsDir: z
|
|
286
|
+
.string()
|
|
287
|
+
.optional()
|
|
288
|
+
.describe('Root directory for dynamically-loaded ggml backend `.so` files. Defaults to `prebuilds/`.'),
|
|
289
|
+
openclCacheDir: z
|
|
290
|
+
.string()
|
|
291
|
+
.optional()
|
|
292
|
+
.describe("Persistent directory for ggml-opencl's compiled-program cache (Android only).")
|
|
125
293
|
});
|
|
126
294
|
// Parakeet's load-time config currently has no fields beyond the
|
|
127
295
|
// runtime knobs (single GGUF model is supplied via the top-level
|
|
@@ -59,7 +59,7 @@ export declare const endOfTurnEventSchema: z.ZodPreprocess<z.ZodDiscriminatedUni
|
|
|
59
59
|
silenceDurationMs: z.ZodNumber;
|
|
60
60
|
}, z.core.$strip>, z.ZodObject<{
|
|
61
61
|
source: z.ZodLiteral<"parakeet">;
|
|
62
|
-
}, z.core.$strip>], "source"
|
|
62
|
+
}, z.core.$strip>], "source">, unknown>;
|
|
63
63
|
export declare const transcribeRequestSchema: z.ZodObject<{
|
|
64
64
|
modelId: z.ZodString;
|
|
65
65
|
prompt: z.ZodOptional<z.ZodString>;
|
|
@@ -111,7 +111,7 @@ export declare const transcribeResponseSchema: z.ZodObject<{
|
|
|
111
111
|
silenceDurationMs: z.ZodNumber;
|
|
112
112
|
}, z.core.$strip>, z.ZodObject<{
|
|
113
113
|
source: z.ZodLiteral<"parakeet">;
|
|
114
|
-
}, z.core.$strip>], "source"
|
|
114
|
+
}, z.core.$strip>], "source">, unknown>>;
|
|
115
115
|
type: z.ZodLiteral<"transcribe">;
|
|
116
116
|
}, z.core.$strip>;
|
|
117
117
|
export type AudioInput = z.infer<typeof audioInputSchema>;
|
|
@@ -211,7 +211,7 @@ export declare const transcribeStreamResponseSchema: z.ZodObject<{
|
|
|
211
211
|
silenceDurationMs: z.ZodNumber;
|
|
212
212
|
}, z.core.$strip>, z.ZodObject<{
|
|
213
213
|
source: z.ZodLiteral<"parakeet">;
|
|
214
|
-
}, z.core.$strip>], "source"
|
|
214
|
+
}, z.core.$strip>], "source">, unknown>>;
|
|
215
215
|
type: z.ZodLiteral<"transcribeStream">;
|
|
216
216
|
}, z.core.$strip>;
|
|
217
217
|
export type TranscribeStreamRequest = z.infer<typeof transcribeStreamRequestSchema>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type { NmtLanguage } from '
|
|
3
|
-
import { type NmtModelTypeInput, type LlmModelTypeInput } from '
|
|
2
|
+
import type { NmtLanguage } from './translation-config.js';
|
|
3
|
+
import { type NmtModelTypeInput, type LlmModelTypeInput } from './model-types.js';
|
|
4
4
|
declare const translateParamsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5
5
|
modelId: z.ZodString;
|
|
6
6
|
text: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { nmtModelTypeSchema, llmModelTypeSchema, normalizeModelType } from '
|
|
2
|
+
import { nmtModelTypeSchema, llmModelTypeSchema, normalizeModelType } from './model-types.js';
|
|
3
3
|
const translateParamsNmtSchema = z.object({
|
|
4
4
|
modelId: z.string().describe('The identifier of the NMT translation model to use.'),
|
|
5
5
|
text: z
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { modelSrcInputSchema } from '
|
|
2
|
+
import { modelSrcInputSchema } from './model-src-utils.js';
|
|
3
3
|
// Bergamot supports many more language pairs
|
|
4
4
|
export const BERGAMOT_LANGUAGES = [
|
|
5
5
|
'en',
|
|
@@ -113,42 +113,70 @@ export const AFRICAN_LANGUAGES_MAP = new Map([
|
|
|
113
113
|
// Union of all NMT languages (for general type usage)
|
|
114
114
|
export const NMT_LANGUAGES = [...BERGAMOT_LANGUAGES, ...INDICTRANS_LANGUAGES];
|
|
115
115
|
export const NMT_ENGINES = ['Bergamot', 'IndicTrans'];
|
|
116
|
-
// Common generation parameters (without language fields)
|
|
116
|
+
// Common generation parameters (without language fields). Full effect on
|
|
117
|
+
// IndicTrans2; Bergamot has limited generation-parameter support.
|
|
117
118
|
const nmtGenerationParamsSchema = z.object({
|
|
118
|
-
mode: z
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
119
|
+
mode: z
|
|
120
|
+
.enum(['full'])
|
|
121
|
+
.optional()
|
|
122
|
+
.describe("Generation mode; currently only `'full'` is supported. Default `'full'`."),
|
|
123
|
+
beamsize: z
|
|
124
|
+
.number()
|
|
125
|
+
.optional()
|
|
126
|
+
.describe('Beam search width (≥1); 1 disables beam search. Default 4.'),
|
|
127
|
+
lengthpenalty: z.number().optional().describe('Length-normalization strength (≥0). Default 1.0.'),
|
|
128
|
+
maxlength: z.number().optional().describe('Maximum generated tokens (>0). Default 512.'),
|
|
129
|
+
repetitionpenalty: z
|
|
130
|
+
.number()
|
|
131
|
+
.optional()
|
|
132
|
+
.describe('Penalty on previously generated tokens (0–2). Default 1.0.'),
|
|
133
|
+
norepeatngramsize: z
|
|
134
|
+
.number()
|
|
135
|
+
.optional()
|
|
136
|
+
.describe('Disallow repeating n-grams of this size (0–10); 0 disables. Default 0.'),
|
|
137
|
+
temperature: z.number().optional().describe('Sampling temperature (0–2). Default 0.3.'),
|
|
138
|
+
topk: z.number().optional().describe('Keep top-K logits (0–vocab_size); 0 disables. Default 0.'),
|
|
139
|
+
topp: z.number().optional().describe('Nucleus-sampling threshold (0 < p ≤ 1). Default 1.0.')
|
|
127
140
|
});
|
|
128
141
|
// Pivot model configuration for Bergamot (for translation via intermediate language)
|
|
129
142
|
const bergamotPivotModelSchema = nmtGenerationParamsSchema
|
|
130
143
|
.extend({
|
|
131
|
-
modelSrc: modelSrcInputSchema,
|
|
132
|
-
srcVocabSrc: modelSrcInputSchema
|
|
133
|
-
|
|
134
|
-
|
|
144
|
+
modelSrc: modelSrcInputSchema.describe('Second-stage (pivot) translation model source.'),
|
|
145
|
+
srcVocabSrc: modelSrcInputSchema
|
|
146
|
+
.optional()
|
|
147
|
+
.describe('Pivot model source-language vocabulary file source.'),
|
|
148
|
+
dstVocabSrc: modelSrcInputSchema
|
|
149
|
+
.optional()
|
|
150
|
+
.describe('Pivot model target-language vocabulary file source.'),
|
|
151
|
+
normalize: z
|
|
152
|
+
.number()
|
|
153
|
+
.optional()
|
|
154
|
+
.describe('Pivot model input normalization: 1 = on (default), 0 = off.')
|
|
135
155
|
})
|
|
136
156
|
.optional();
|
|
137
157
|
// Bergamot engine config - supports BERGAMOT_LANGUAGES
|
|
138
158
|
const bergamotConfigSchema = nmtGenerationParamsSchema.extend({
|
|
139
|
-
engine: z
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
159
|
+
engine: z
|
|
160
|
+
.literal('Bergamot')
|
|
161
|
+
.describe('Translation backend: Bergamot — fast bilingual models keyed by ISO 639-1 codes.'),
|
|
162
|
+
from: z.enum(BERGAMOT_LANGUAGES).describe('Source language (ISO 639-1, e.g. `en`).'),
|
|
163
|
+
to: z.enum(BERGAMOT_LANGUAGES).describe('Target language (ISO 639-1, e.g. `de`).'),
|
|
164
|
+
srcVocabSrc: modelSrcInputSchema
|
|
165
|
+
.optional()
|
|
166
|
+
.describe('Source-language vocabulary file source (required for Bergamot).'),
|
|
167
|
+
dstVocabSrc: modelSrcInputSchema
|
|
168
|
+
.optional()
|
|
169
|
+
.describe('Target-language vocabulary file source (required for Bergamot).'),
|
|
170
|
+
normalize: z.number().optional().describe('Input normalization: 1 = on (default), 0 = off.'),
|
|
171
|
+
pivotModel: bergamotPivotModelSchema.describe('Optional second-stage model for pivot translation (translate via an intermediate language).')
|
|
146
172
|
});
|
|
147
173
|
// IndicTrans engine config - supports INDICTRANS_LANGUAGES
|
|
148
174
|
const indicTransConfigSchema = nmtGenerationParamsSchema.extend({
|
|
149
|
-
engine: z
|
|
150
|
-
|
|
151
|
-
|
|
175
|
+
engine: z
|
|
176
|
+
.literal('IndicTrans')
|
|
177
|
+
.describe('Translation backend: IndicTrans2 — keyed by ISO 15924 codes; full generation-parameter support.'),
|
|
178
|
+
from: z.enum(INDICTRANS_LANGUAGES).describe('Source language (ISO 15924, e.g. `hin_Deva`).'),
|
|
179
|
+
to: z.enum(INDICTRANS_LANGUAGES).describe('Target language (ISO 15924, e.g. `eng_Latn`).')
|
|
152
180
|
});
|
|
153
181
|
// Discriminated union of all engine configs
|
|
154
182
|
export const nmtConfigBaseSchema = z.discriminatedUnion('engine', [
|
package/dist/schemas/vla.d.ts
CHANGED
|
@@ -42,8 +42,8 @@ export type VlaEmbodimentSelection = string | number | {
|
|
|
42
42
|
};
|
|
43
43
|
export declare const vlaConfigSchema: z.ZodObject<{
|
|
44
44
|
backend: z.ZodOptional<z.ZodEnum<{
|
|
45
|
-
cpu: "cpu";
|
|
46
45
|
auto: "auto";
|
|
46
|
+
cpu: "cpu";
|
|
47
47
|
}>>;
|
|
48
48
|
verbosity: z.ZodOptional<z.ZodNumber>;
|
|
49
49
|
embodiment: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodObject<{
|
package/dist/selection.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import type { Request } from './schemas/index.js';
|
|
2
2
|
import type { HandlerEntry } from './handlers/types.js';
|
|
3
|
-
export
|
|
4
|
-
handler: HandlerEntry['handler'];
|
|
5
|
-
isDelegated: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare function selectHandler(entry: HandlerEntry, request: Request): HandlerSelection;
|
|
3
|
+
export declare function selectHandler(entry: HandlerEntry): HandlerEntry['handler'];
|
|
8
4
|
export declare function handlerSupportsProgress(entry: HandlerEntry, request: Request): boolean;
|
package/dist/selection.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
export function selectHandler(entry
|
|
2
|
-
|
|
3
|
-
return {
|
|
4
|
-
handler: isDelegated ? entry.delegatedHandler : entry.handler,
|
|
5
|
-
isDelegated
|
|
6
|
-
};
|
|
1
|
+
export function selectHandler(entry) {
|
|
2
|
+
return entry.handler;
|
|
7
3
|
}
|
|
8
4
|
export function handlerSupportsProgress(entry, request) {
|
|
9
5
|
return !!('withProgress' in request &&
|
package/dist/surface.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { readBackendDiagnostics } from './profiling/backend-diagnostics.js';
|
|
|
10
10
|
export { PUBLIC_MODEL_TYPES, ModelTypeAliases, modelTypeInputSchema, modelTypeSchema } from './schemas/model-types.js';
|
|
11
11
|
export * from './models/registry/index.js';
|
|
12
12
|
export { SUPPORTED_AUDIO_FORMATS } from './constants/audio.js';
|
|
13
|
-
export { InferenceCancelledError, ContextOverflowError, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, RequestValidationFailedError, ModelNotLoadedError, TranslationFailedError, PluginDefinitionInvalidError, PluginModelTypeReservedError, PluginAlreadyRegisteredError, PluginLoggingInvalidError } from './errors/index.js';
|
|
13
|
+
export { InferenceCancelledError, ContextOverflowError, type ContextOverflowErrorSizes, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, RequestValidationFailedError, ModelNotLoadedError, TranslationFailedError, PluginDefinitionInvalidError, PluginModelTypeReservedError, PluginAlreadyRegisteredError, PluginLoggingInvalidError } from './errors/index.js';
|
|
14
14
|
export type { InferenceCancelledPartial } from './errors/index.js';
|
|
15
15
|
export { getLogger, LOG_ID, ALL_LOG_ID } from './logging/index.js';
|
|
16
16
|
export type { Logger, LogTransport, LoggerOptions } from './logging/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CompletionError, CompletionEvent, CompletionFinal, CompletionStats, StopReason, ToolCall } from '../schemas/index.js';
|
|
2
|
-
import { type ToolHandlerMap } from '
|
|
2
|
+
import { type ToolHandlerMap } from './tool-helpers.js';
|
|
3
3
|
export type AggregatedEvents = {
|
|
4
4
|
contentText: string;
|
|
5
5
|
thinkingText: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { normalizeAssistantCacheContent } from '
|
|
2
|
-
import { attachHandlersToToolCalls } from '
|
|
1
|
+
import { normalizeAssistantCacheContent } from './cache-normalize.js';
|
|
2
|
+
import { attachHandlersToToolCalls } from './tool-helpers.js';
|
|
3
3
|
export function aggregateEvents(events) {
|
|
4
4
|
let contentText = '';
|
|
5
5
|
let thinkingText = '';
|
package/dist/utils/archive.js
CHANGED
|
@@ -3,9 +3,9 @@ import path from 'bare-path';
|
|
|
3
3
|
import { createGunzip } from 'bare-zlib';
|
|
4
4
|
import tarStream from 'tar-stream';
|
|
5
5
|
import Buffer from 'bare-buffer';
|
|
6
|
-
import { detectShardedModel, generateShardFilenames, extractTensorsFromShards, validateShardedModelCache } from '
|
|
6
|
+
import { detectShardedModel, generateShardFilenames, extractTensorsFromShards, validateShardedModelCache } from './shard-utils.js';
|
|
7
7
|
import { ModelLoadFailedError, ArchiveExtractionFailedError, ArchiveUnsupportedTypeError, ArchiveMissingShardsError, DownloadCancelledError } from '../errors/index.js';
|
|
8
|
-
import { isPathWithinBase } from '
|
|
8
|
+
import { isPathWithinBase } from './path-security.js';
|
|
9
9
|
import { getEngineLogger } from '../logging/index.js';
|
|
10
10
|
import { SUPPORTED_ARCHIVE_EXTENSIONS, filenameToArchiveTypeSchema } from '../schemas/model-file.js';
|
|
11
11
|
const logger = getEngineLogger();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Readable } from 'bare-stream';
|
|
2
2
|
import fs from 'bare-fs';
|
|
3
3
|
import Buffer from 'bare-buffer';
|
|
4
|
-
import { needsDecoding, decodeAudioToStream } from '
|
|
4
|
+
import { needsDecoding, decodeAudioToStream } from './audio/decoder.js';
|
|
5
5
|
import { AudioFileNotFoundError, InvalidAudioChunkError } from '../errors/index.js';
|
|
6
6
|
/**
|
|
7
7
|
* Converts an AudioInput (base64 or filePath) into a Readable stream,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { CacheMessage } from '
|
|
1
|
+
import type { CacheMessage } from './types.js';
|
|
2
2
|
export declare function getAutoCacheLookupHistory(currentHistory: CacheMessage[]): CacheMessage[];
|
|
3
3
|
export declare function buildAutoCacheSaveHistory(currentHistory: CacheMessage[], assistantResponse: string): CacheMessage[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeAssistantCacheContent } from '
|
|
1
|
+
import { normalizeAssistantCacheContent } from '../cache-normalize.js';
|
|
2
2
|
function normalizeCacheMessage(message) {
|
|
3
3
|
const { attachments, ...normalized } = message;
|
|
4
4
|
if (message.role === 'assistant') {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import fs, { promises as fsPromises } from 'bare-fs';
|
|
2
2
|
import path from 'bare-path';
|
|
3
3
|
import { getConfiguredCacheDir } from '../../runtime/state.js';
|
|
4
|
-
import { getQvacPath } from '
|
|
5
|
-
import { calculateFileChecksum } from '
|
|
6
|
-
import { validateAndJoinPath } from '
|
|
7
|
-
import { generateShortHash } from '
|
|
4
|
+
import { getQvacPath } from '../qvac-paths.js';
|
|
5
|
+
import { calculateFileChecksum } from '../checksum.js';
|
|
6
|
+
import { validateAndJoinPath } from '../path-security.js';
|
|
7
|
+
import { generateShortHash } from '../formatting.js';
|
|
8
8
|
import { getEngineLogger } from '../../logging/index.js';
|
|
9
9
|
import { nowMs } from '../../profiling/index.js';
|
|
10
|
-
import { resolveClearStorageTarget } from '
|
|
10
|
+
import { resolveClearStorageTarget } from '../clear-storage.js';
|
|
11
11
|
const logger = getEngineLogger();
|
|
12
12
|
export function getCacheDir(subDir) {
|
|
13
13
|
const cacheDir = getQvacPath(subDir);
|