@qvac/inference 0.23.0 → 0.24.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 +60 -28
- package/README.md +3 -1
- package/dist/api/assess-model-fit.d.ts +14 -14
- package/dist/api/assess-model-fit.js +14 -14
- package/dist/api/audio-gen.d.ts +2 -2
- package/dist/api/audio-gen.js +135 -44
- package/dist/api/batch-completion.js +2 -1
- package/dist/api/calc-tokens.d.ts +30 -0
- package/dist/api/calc-tokens.js +41 -0
- package/dist/api/classify.d.ts +5 -2
- package/dist/api/classify.js +5 -2
- package/dist/api/completion-stream.d.ts +1 -1
- package/dist/api/completion-stream.js +2 -1
- package/dist/api/delete-cache.d.ts +7 -1
- package/dist/api/delete-cache.js +11 -1
- package/dist/api/diffusion.d.ts +14 -1
- package/dist/api/diffusion.js +14 -1
- package/dist/api/embed.d.ts +82 -29
- package/dist/api/embed.js +64 -18
- package/dist/api/get-model-info.d.ts +1 -1
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.js +2 -1
- package/dist/api/rag.d.ts +1 -1
- package/dist/api/rag.js +1 -1
- package/dist/api/registry.d.ts +16 -6
- package/dist/api/registry.js +32 -9
- package/dist/api/text-to-speech.d.ts +14 -5
- package/dist/api/text-to-speech.js +83 -29
- package/dist/api/transcribe.d.ts +6 -2
- package/dist/api/transcribe.js +7 -1
- package/dist/api/vector-index.d.ts +25 -3
- package/dist/api/vector-index.js +17 -2
- package/dist/api/video-request.d.ts +15 -15
- package/dist/dispatch.d.ts +10 -4
- package/dist/dispatch.js +65 -15
- package/dist/engine.d.ts +1 -1
- package/dist/errors/index.d.ts +70 -0
- package/dist/errors/index.js +128 -0
- package/dist/handlers/assess-model-fit.d.ts +3 -21
- package/dist/handlers/assess-model-fit.js +4 -303
- package/dist/handlers/cancelHandler.d.ts +10 -9
- package/dist/handlers/cancelHandler.js +17 -13
- package/dist/handlers/completion-orchestrate.d.ts +14 -2
- package/dist/handlers/completion-orchestrate.js +164 -22
- package/dist/handlers/delete-cache.d.ts +2 -1
- package/dist/handlers/delete-cache.js +6 -1
- package/dist/handlers/download-asset.js +11 -4
- package/dist/handlers/get-loaded-model-info.js +1 -0
- package/dist/handlers/get-model-info.js +71 -2
- package/dist/handlers/load-model/coreml-sidecars.d.ts +2 -13
- package/dist/handlers/load-model/coreml-sidecars.js +16 -119
- package/dist/handlers/load-model/download-lock.d.ts +20 -0
- package/dist/handlers/load-model/download-lock.js +213 -0
- package/dist/handlers/load-model/download-manager.d.ts +10 -2
- package/dist/handlers/load-model/download-manager.js +62 -11
- package/dist/handlers/load-model/handler.js +88 -35
- package/dist/handlers/load-model/http.js +327 -205
- package/dist/handlers/load-model/hyperdrive.d.ts +15 -0
- package/dist/handlers/load-model/hyperdrive.js +123 -50
- package/dist/handlers/load-model/registry-client-options.d.ts +2 -0
- package/dist/handlers/load-model/registry-client-options.js +4 -2
- package/dist/handlers/load-model/registry-companion-set.d.ts +5 -0
- package/dist/handlers/load-model/registry-companion-set.js +19 -1
- package/dist/handlers/load-model/registry-delete.d.ts +5 -0
- package/dist/handlers/load-model/registry-delete.js +269 -0
- package/dist/handlers/load-model/registry-download-utils.d.ts +4 -2
- package/dist/handlers/load-model/registry-download-utils.js +93 -22
- package/dist/handlers/load-model/registry.d.ts +20 -0
- package/dist/handlers/load-model/registry.js +308 -175
- package/dist/handlers/load-model/resolve.js +4 -1
- package/dist/handlers/load-model/types.d.ts +2 -0
- package/dist/handlers/logging-stream.js +17 -5
- package/dist/handlers/plugin-invoke.js +152 -39
- package/dist/handlers/registry.d.ts +2 -2
- package/dist/handlers/registry.js +105 -28
- package/dist/handlers/rpc-server.js +7 -7
- package/dist/handlers/session.d.ts +11 -0
- package/dist/handlers/session.js +40 -0
- package/dist/handlers/unload-model.js +8 -3
- package/dist/handlers/vector-index.js +118 -19
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/logging/utils.js +10 -2
- package/dist/model-cache-layout.d.ts +1 -0
- package/dist/model-cache-layout.js +2 -0
- package/dist/model-fit/assess.d.ts +18 -67
- package/dist/model-fit/assess.js +96 -665
- package/dist/model-fit/describe.d.ts +12 -0
- package/dist/model-fit/describe.js +29 -0
- package/dist/model-fit/description/fetch.d.ts +1 -1
- package/dist/model-fit/description/fetch.js +95 -16
- package/dist/model-fit/description/resolve-load.d.ts +5 -3
- package/dist/model-fit/description/resolve-load.js +14 -14
- package/dist/model-fit/fit-load.d.ts +23 -0
- package/dist/model-fit/fit-load.js +29 -0
- package/dist/model-fit/load-check.d.ts +15 -33
- package/dist/model-fit/load-check.js +50 -195
- package/dist/model-fit/run/engine.d.ts +12 -72
- package/dist/model-fit/run/engine.js +4 -8
- package/dist/model-fit/run/run.d.ts +10 -7
- package/dist/model-fit/run/run.js +22 -18
- package/dist/model-fit/sum.d.ts +32 -0
- package/dist/model-fit/sum.js +60 -0
- package/dist/models/registry/models.d.ts +865 -128
- package/dist/models/registry/models.js +3737 -2963
- package/dist/plugins/builtin/asr-ggml/config.d.ts +19 -4
- package/dist/plugins/builtin/asr-ggml/config.js +39 -3
- package/dist/plugins/builtin/asr-ggml/fit.d.ts +18 -0
- package/dist/{model-fit/request/engines/asr.js → plugins/builtin/asr-ggml/fit.js} +55 -71
- package/dist/plugins/builtin/audiogen-ggml/config.d.ts +6 -0
- package/dist/plugins/builtin/audiogen-ggml/config.js +9 -0
- package/dist/plugins/builtin/audiogen-ggml/fit.d.ts +3 -0
- package/dist/{model-fit/request/engines/audiogen.js → plugins/builtin/audiogen-ggml/fit.js} +28 -18
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.d.ts +3 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.js +2 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-encode.d.ts +17 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-encode.js +68 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-run.d.ts +11 -3
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-run.js +47 -11
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.d.ts +3 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +2 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.d.ts +3 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.js +2 -1
- package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +143 -18
- package/dist/plugins/builtin/audiogen-ggml/plugin.js +13 -1
- package/dist/plugins/builtin/bci-whispercpp-transcription/fit.d.ts +3 -0
- package/dist/plugins/builtin/bci-whispercpp-transcription/fit.js +22 -0
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +45 -4
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +8 -6
- package/dist/plugins/builtin/ggml-classification/plugin.d.ts +4 -1
- package/dist/plugins/builtin/ggml-classification/plugin.js +88 -8
- package/dist/plugins/builtin/ggml-image-embedding/ops/embed.d.ts +24 -0
- package/dist/plugins/builtin/ggml-image-embedding/ops/embed.js +184 -0
- package/dist/plugins/builtin/ggml-image-embedding/plugin.d.ts +120 -0
- package/dist/plugins/builtin/ggml-image-embedding/plugin.js +39 -0
- package/dist/plugins/builtin/ggml-ocr/fit.d.ts +6 -0
- package/dist/plugins/builtin/ggml-ocr/fit.js +19 -0
- package/dist/plugins/builtin/ggml-ocr/params.d.ts +1 -1
- package/dist/plugins/builtin/ggml-ocr/plugin.d.ts +9 -3
- package/dist/plugins/builtin/ggml-ocr/plugin.js +107 -21
- package/dist/plugins/builtin/ggml-vla/ops/vla-run.d.ts +2 -2
- package/dist/plugins/builtin/ggml-vla/ops/vla-run.js +18 -2
- package/dist/plugins/builtin/ggml-vla/plugin.d.ts +3 -3
- package/dist/plugins/builtin/index.d.ts +1 -0
- package/dist/plugins/builtin/index.js +1 -0
- package/dist/plugins/builtin/llamacpp-completion/fit.d.ts +3 -0
- package/dist/plugins/builtin/llamacpp-completion/fit.js +28 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js +1 -1
- package/dist/plugins/builtin/llamacpp-completion/ops/cache-logger.js +15 -4
- package/dist/plugins/builtin/llamacpp-completion/ops/calc-tokens.d.ts +2 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/calc-tokens.js +32 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.d.ts +1 -1
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.d.ts +17 -3
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +61 -5
- package/dist/plugins/builtin/llamacpp-completion/ops/finetune.d.ts +5 -4
- package/dist/plugins/builtin/llamacpp-completion/ops/finetune.js +54 -19
- package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +148 -19
- package/dist/plugins/builtin/llamacpp-completion/plugin.js +26 -9
- package/dist/plugins/builtin/llamacpp-decision/ops/decide.d.ts +3 -1
- package/dist/plugins/builtin/llamacpp-decision/ops/decide.js +5 -2
- package/dist/plugins/builtin/llamacpp-decision/plugin.d.ts +4 -2
- package/dist/plugins/builtin/llamacpp-decision/plugin.js +2 -2
- package/dist/plugins/builtin/llamacpp-embedding/fit.d.ts +3 -0
- package/dist/plugins/builtin/llamacpp-embedding/fit.js +23 -0
- package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +194 -4
- package/dist/plugins/builtin/llamacpp-embedding/plugin.js +37 -11
- package/dist/plugins/builtin/llamacpp-embedding/transform.d.ts +2 -2
- package/dist/plugins/builtin/llamacpp-embedding/transform.js +23 -2
- package/dist/plugins/builtin/llamacpp-rerank/ops/rerank.d.ts +3 -1
- package/dist/plugins/builtin/llamacpp-rerank/ops/rerank.js +5 -2
- package/dist/plugins/builtin/llamacpp-rerank/plugin.d.ts +6 -5
- package/dist/plugins/builtin/llamacpp-rerank/plugin.js +2 -3
- package/dist/plugins/builtin/moss-transcribe/plugin.d.ts +30 -3
- package/dist/plugins/builtin/moss-transcribe/plugin.js +5 -3
- package/dist/plugins/builtin/nmtcpp-translation/fit.d.ts +3 -0
- package/dist/plugins/builtin/nmtcpp-translation/fit.js +11 -0
- package/dist/plugins/builtin/nmtcpp-translation/plugin.d.ts +14 -5
- package/dist/plugins/builtin/nmtcpp-translation/plugin.js +4 -2
- package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +205 -9
- package/dist/plugins/builtin/parakeet-transcription/plugin.js +39 -13
- package/dist/plugins/builtin/sdcpp-generation/fit.d.ts +3 -0
- package/dist/plugins/builtin/sdcpp-generation/fit.js +68 -0
- package/dist/plugins/builtin/sdcpp-generation/load-files.d.ts +30 -0
- package/dist/plugins/builtin/sdcpp-generation/load-files.js +121 -0
- package/dist/plugins/builtin/sdcpp-generation/ops/diffusion.d.ts +4 -1
- package/dist/plugins/builtin/sdcpp-generation/ops/diffusion.js +8 -3
- package/dist/plugins/builtin/sdcpp-generation/ops/upscale.d.ts +4 -1
- package/dist/plugins/builtin/sdcpp-generation/ops/upscale.js +107 -22
- package/dist/plugins/builtin/sdcpp-generation/ops/video.d.ts +3 -1
- package/dist/plugins/builtin/sdcpp-generation/ops/video.js +4 -1
- package/dist/plugins/builtin/sdcpp-generation/ops/world.d.ts +4 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/world.js +7 -2
- package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +79 -16
- package/dist/plugins/builtin/sdcpp-generation/plugin.js +29 -117
- package/dist/plugins/builtin/tts-ggml/fit.d.ts +3 -0
- package/dist/plugins/builtin/tts-ggml/fit.js +162 -0
- package/dist/plugins/builtin/tts-ggml/ops/cancel-binding.d.ts +2 -1
- package/dist/plugins/builtin/tts-ggml/ops/cancel-binding.js +4 -1
- package/dist/plugins/builtin/tts-ggml/ops/moss-options.d.ts +1 -1
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.d.ts +2 -1
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +22 -9
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.d.ts +2 -1
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +51 -16
- package/dist/plugins/builtin/tts-ggml/ops/voice-options.d.ts +50 -0
- package/dist/plugins/builtin/tts-ggml/ops/voice-options.js +74 -0
- package/dist/plugins/builtin/tts-ggml/plugin.d.ts +368 -25
- package/dist/plugins/builtin/tts-ggml/plugin.js +180 -31
- package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +70 -7
- package/dist/plugins/builtin/whispercpp-transcription/plugin.js +8 -6
- package/dist/plugins/ops/bci-transcribe.d.ts +5 -4
- package/dist/plugins/ops/bci-transcribe.js +18 -4
- package/dist/plugins/ops/cancel.d.ts +1 -0
- package/dist/plugins/ops/cancel.js +11 -2
- package/dist/plugins/ops/embed.d.ts +5 -3
- package/dist/plugins/ops/embed.js +89 -34
- package/dist/plugins/ops/kv-cache-utils.d.ts +1 -0
- package/dist/plugins/ops/kv-cache-utils.js +6 -2
- package/dist/plugins/ops/load-model.d.ts +2 -0
- package/dist/plugins/ops/load-model.js +33 -16
- package/dist/plugins/ops/transcribe.d.ts +5 -4
- package/dist/plugins/ops/transcribe.js +62 -27
- package/dist/plugins/ops/translate.d.ts +2 -1
- package/dist/plugins/ops/translate.js +4 -1
- package/dist/plugins/ops/unload-model.d.ts +17 -1
- package/dist/plugins/ops/unload-model.js +31 -2
- package/dist/plugins/turbovec-backend.d.ts +1 -1
- package/dist/plugins/turbovec-backend.js +16 -1
- package/dist/profiling/operation-metrics.js +22 -19
- package/dist/rag/embedding-scope.d.ts +16 -0
- package/dist/rag/embedding-scope.js +81 -0
- package/dist/rag/handler.d.ts +25 -0
- package/dist/rag/handler.js +50 -16
- package/dist/rag/handlers/ingest.js +2 -6
- package/dist/rag/handlers/search.d.ts +10 -1
- package/dist/rag/handlers/search.js +16 -7
- package/dist/rag/rag-operation-manager.d.ts +27 -3
- package/dist/rag/rag-operation-manager.js +10 -27
- package/dist/registry.js +5 -0
- package/dist/resources/collector.d.ts +70 -36
- package/dist/resources/collector.js +8 -1
- package/dist/resources/types.d.ts +2 -0
- package/dist/rpc/inventory.js +1 -12
- package/dist/runtime/env.d.ts +5 -1
- package/dist/runtime/env.js +6 -21
- package/dist/runtime/index.d.ts +4 -1
- package/dist/runtime/index.js +2 -0
- package/dist/runtime/lifecycle.d.ts +6 -4
- package/dist/runtime/lifecycle.js +9 -5
- package/dist/runtime/model-config-utils.js +5 -1
- package/dist/runtime/model-registry.d.ts +28 -4
- package/dist/runtime/model-registry.js +46 -1
- package/dist/runtime/model-work-lock.d.ts +13 -0
- package/dist/runtime/model-work-lock.js +48 -0
- package/dist/runtime/registry-client.d.ts +47 -1
- package/dist/runtime/registry-client.js +446 -88
- package/dist/runtime/request-context.d.ts +9 -1
- package/dist/runtime/request-context.js +25 -1
- package/dist/runtime/request-registry.d.ts +55 -7
- package/dist/runtime/request-registry.js +189 -71
- package/dist/runtime/runtime-lifecycle.js +10 -1
- package/dist/runtime/session-id.d.ts +18 -0
- package/dist/runtime/session-id.js +20 -0
- package/dist/runtime/session-registry.d.ts +39 -0
- package/dist/runtime/session-registry.js +114 -0
- package/dist/runtime/vector-index-backend.d.ts +4 -0
- package/dist/runtime/vector-index-registry.d.ts +21 -0
- package/dist/runtime/vector-index-registry.js +56 -18
- package/dist/schemas/abort-signal.d.ts +8 -0
- package/dist/schemas/abort-signal.js +1 -0
- package/dist/schemas/assess-model-fit.d.ts +132 -282
- package/dist/schemas/assess-model-fit.js +82 -216
- package/dist/schemas/audio-gen.d.ts +278 -24
- package/dist/schemas/audio-gen.js +127 -23
- package/dist/schemas/batch-completion-stream.d.ts +105 -13
- package/dist/schemas/batch-completion-stream.js +8 -4
- package/dist/schemas/bci-config.d.ts +2 -1
- package/dist/schemas/bci.d.ts +54 -3
- package/dist/schemas/bci.js +11 -16
- package/dist/schemas/calc-tokens.d.ts +141 -0
- package/dist/schemas/calc-tokens.js +53 -0
- package/dist/schemas/cancel.d.ts +26 -0
- package/dist/schemas/cancel.js +10 -2
- package/dist/schemas/classification.d.ts +3 -0
- package/dist/schemas/classification.js +6 -2
- package/dist/schemas/common.d.ts +1831 -348
- package/dist/schemas/common.js +18 -2
- package/dist/schemas/completion-event.d.ts +3 -0
- package/dist/schemas/completion-event.js +1 -1
- package/dist/schemas/completion-stream.d.ts +162 -17
- package/dist/schemas/completion-stream.js +83 -13
- package/dist/schemas/config.d.ts +1212 -169
- package/dist/schemas/config.js +9 -13
- package/dist/schemas/decision.d.ts +4 -2
- package/dist/schemas/decision.js +2 -1
- package/dist/schemas/download-asset.d.ts +10 -5
- package/dist/schemas/download-asset.js +3 -6
- package/dist/schemas/embed.d.ts +286 -3
- package/dist/schemas/embed.js +162 -16
- package/dist/schemas/engine-addon-map.d.ts +1 -0
- package/dist/schemas/engine-addon-map.js +1 -0
- package/dist/schemas/errors.d.ts +12 -0
- package/dist/schemas/errors.js +66 -1
- package/dist/schemas/finetune.d.ts +14 -4
- package/dist/schemas/finetune.js +5 -6
- package/dist/schemas/heartbeat.d.ts +1 -0
- package/dist/schemas/heartbeat.js +5 -2
- package/dist/schemas/image-embedding.d.ts +27 -0
- package/dist/schemas/image-embedding.js +107 -0
- package/dist/schemas/index.d.ts +7 -3
- package/dist/schemas/index.js +7 -3
- package/dist/schemas/lifecycle.d.ts +3 -0
- package/dist/schemas/lifecycle.js +13 -6
- package/dist/schemas/llamacpp-config.d.ts +269 -22
- package/dist/schemas/llamacpp-config.js +86 -7
- package/dist/schemas/load-model.d.ts +6418 -1960
- package/dist/schemas/load-model.js +39 -8
- package/dist/schemas/logging-stream.d.ts +1 -0
- package/dist/schemas/logging-stream.js +5 -2
- package/dist/schemas/model-config-schemas.d.ts +542 -116
- package/dist/schemas/model-config-schemas.js +2 -0
- package/dist/schemas/model-fit-policy.d.ts +2 -2
- package/dist/schemas/model-info.d.ts +54 -56
- package/dist/schemas/model-info.js +17 -6
- package/dist/schemas/model-ops.d.ts +12 -0
- package/dist/schemas/model-ops.js +33 -5
- package/dist/schemas/model-src-utils.d.ts +10 -6
- package/dist/schemas/model-types.d.ts +8 -4
- package/dist/schemas/model-types.js +1 -0
- package/dist/schemas/ocr.d.ts +9 -4
- package/dist/schemas/ocr.js +6 -2
- package/dist/schemas/plugin.d.ts +62 -6
- package/dist/schemas/plugin.js +26 -4
- package/dist/schemas/profiling.d.ts +32 -32
- package/dist/schemas/rag.d.ts +9 -0
- package/dist/schemas/rag.js +10 -16
- package/dist/schemas/registry.d.ts +30 -10
- package/dist/schemas/registry.js +14 -6
- package/dist/schemas/reload-config.d.ts +41 -6
- package/dist/schemas/reload-config.js +11 -4
- package/dist/schemas/request-base.d.ts +39 -0
- package/dist/schemas/request-base.js +64 -0
- package/dist/schemas/rerank.d.ts +8 -7
- package/dist/schemas/rerank.js +6 -4
- package/dist/schemas/rpc-server.d.ts +3 -0
- package/dist/schemas/rpc-server.js +15 -15
- package/dist/schemas/sdcpp-config.d.ts +90 -20
- package/dist/schemas/sdcpp-config.js +96 -19
- package/dist/schemas/session.d.ts +37 -0
- package/dist/schemas/session.js +53 -0
- package/dist/schemas/system-resources.d.ts +364 -179
- package/dist/schemas/system-resources.js +8 -3
- package/dist/schemas/text-to-speech.d.ts +1343 -271
- package/dist/schemas/text-to-speech.js +547 -33
- package/dist/schemas/tools.d.ts +7 -0
- package/dist/schemas/tools.js +29 -0
- package/dist/schemas/transcription-config.d.ts +262 -2
- package/dist/schemas/transcription-config.js +122 -6
- package/dist/schemas/transcription.d.ts +93 -6
- package/dist/schemas/transcription.js +98 -21
- package/dist/schemas/translate.d.ts +2 -0
- package/dist/schemas/translate.js +5 -9
- package/dist/schemas/translation-config.d.ts +30 -20
- package/dist/schemas/tts-pcm.d.ts +35 -0
- package/dist/schemas/tts-pcm.js +69 -0
- package/dist/schemas/vector-index.d.ts +47 -1
- package/dist/schemas/vector-index.js +37 -10
- package/dist/schemas/vla.d.ts +3 -3
- package/dist/surface.d.ts +3 -3
- package/dist/surface.js +3 -3
- package/dist/utils/addon-responses.d.ts +69 -2
- package/dist/utils/archive.d.ts +7 -0
- package/dist/utils/archive.js +88 -29
- package/dist/utils/asr-events.d.ts +5 -0
- package/dist/utils/asr-events.js +10 -1
- package/dist/utils/cache/auto-history.js +3 -1
- package/dist/utils/cache/layout.d.ts +48 -0
- package/dist/utils/cache/layout.js +190 -0
- package/dist/utils/cache/paths.js +2 -4
- package/dist/utils/cache/types.d.ts +2 -1
- package/dist/utils/checksum.d.ts +5 -0
- package/dist/utils/checksum.js +18 -0
- package/dist/utils/completion-normalizer.js +286 -87
- package/dist/utils/gguf-tensor-extractor.d.ts +0 -6
- package/dist/utils/gguf-tensor-extractor.js +1 -50
- package/dist/utils/shard-utils.d.ts +0 -21
- package/dist/utils/shard-utils.js +12 -62
- package/dist/utils/tool-integration.d.ts +2 -2
- package/dist/utils/tools/defer.d.ts +39 -10
- package/dist/utils/tools/defer.js +72 -17
- package/dist/utils/tools/index.d.ts +1 -1
- package/dist/utils/tools/index.js +1 -1
- package/dist/utils/transcribe-metadata.d.ts +28 -2
- package/dist/utils/transcribe-metadata.js +16 -0
- package/dist/utils/tts-stats.d.ts +42 -0
- package/dist/utils/tts-stats.js +120 -22
- package/package.json +43 -39
- package/dist/model-fit/classify.d.ts +0 -6
- package/dist/model-fit/classify.js +0 -166
- package/dist/model-fit/description/project.d.ts +0 -27
- package/dist/model-fit/description/project.js +0 -33
- package/dist/model-fit/floor.d.ts +0 -31
- package/dist/model-fit/floor.js +0 -65
- package/dist/model-fit/kv-cache.d.ts +0 -23
- package/dist/model-fit/kv-cache.js +0 -85
- package/dist/model-fit/platform.d.ts +0 -14
- package/dist/model-fit/platform.js +0 -26
- package/dist/model-fit/request/create.d.ts +0 -31
- package/dist/model-fit/request/create.js +0 -61
- package/dist/model-fit/request/engines/asr.d.ts +0 -14
- package/dist/model-fit/request/engines/audiogen.d.ts +0 -8
- package/dist/model-fit/request/engines/diffusion.d.ts +0 -7
- package/dist/model-fit/request/engines/diffusion.js +0 -93
- package/dist/model-fit/request/engines/llama.d.ts +0 -12
- package/dist/model-fit/request/engines/llama.js +0 -44
- package/dist/model-fit/request/engines/nmt.d.ts +0 -8
- package/dist/model-fit/request/engines/nmt.js +0 -11
- package/dist/model-fit/request/engines/ocr.d.ts +0 -9
- package/dist/model-fit/request/engines/ocr.js +0 -13
- package/dist/model-fit/request/engines/tts.d.ts +0 -10
- package/dist/model-fit/request/engines/tts.js +0 -152
- package/dist/models/registry/resource-profiles.d.ts +0 -17
- package/dist/models/registry/resource-profiles.js +0 -5859
- package/dist/schemas/model-resource-profile.d.ts +0 -109
- package/dist/schemas/model-resource-profile.js +0 -80
- /package/dist/model-fit/{request/gpu.d.ts → gpu.d.ts} +0 -0
- /package/dist/model-fit/{request/gpu.js → gpu.js} +0 -0
package/dist/schemas/common.js
CHANGED
|
@@ -2,6 +2,7 @@ import { startRpcServerRequestSchema, startRpcServerResponseSchema, stopRpcServe
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { perCallProfilingSchema } from '../schemas/profiling.js';
|
|
4
4
|
import { heartbeatRequestSchema, heartbeatResponseSchema } from '../schemas/heartbeat.js';
|
|
5
|
+
import { openSessionRequestSchema, openSessionResponseSchema, closeSessionRequestSchema, closeSessionResponseSchema } from '../schemas/session.js';
|
|
5
6
|
import { completionOrchestrateRequestSchema, completionOrchestrateResponseSchema, completionStreamRequestSchema, completionStreamResponseSchema } from '../schemas/completion-stream.js';
|
|
6
7
|
import { batchCompletionStreamRequestSchema, batchCompletionStreamResponseSchema } from '../schemas/batch-completion-stream.js';
|
|
7
8
|
import { loadModelRequestSchema, loadModelResponseSchema, modelProgressUpdateSchema } from '../schemas/load-model.js';
|
|
@@ -9,7 +10,7 @@ import { downloadAssetRequestSchema, downloadAssetResponseSchema } from '../sche
|
|
|
9
10
|
import { unloadModelRequestSchema, unloadModelResponseSchema, deleteCacheRequestSchema, deleteCacheResponseSchema } from '../schemas/model-ops.js';
|
|
10
11
|
import { transcribeRequestSchema, transcribeResponseSchema, transcribeStreamRequestSchema, transcribeStreamResponseSchema } from '../schemas/transcription.js';
|
|
11
12
|
import { bciTranscribeRequestSchema, bciTranscribeResponseSchema, bciTranscribeStreamRequestSchema, bciTranscribeStreamResponseSchema } from '../schemas/bci.js';
|
|
12
|
-
import { embedRequestSchema, embedResponseSchema } from '../schemas/embed.js';
|
|
13
|
+
import { embedRequestSchema, embedResponseSchema, embedBatchRequestSchema, embedBatchResponseSchema } from '../schemas/embed.js';
|
|
13
14
|
import { cancelRequestSchema, cancelResponseSchema } from '../schemas/cancel.js';
|
|
14
15
|
import { translateRequestSchema, translateResponseSchema } from '../schemas/translate.js';
|
|
15
16
|
import { loggingStreamRequestSchema, loggingStreamResponseSchema } from '../schemas/logging-stream.js';
|
|
@@ -29,6 +30,7 @@ import { suspendRequestSchema, suspendResponseSchema, resumeRequestSchema, resum
|
|
|
29
30
|
import { decideRequestSchema, decideResponseSchema } from '../schemas/decision.js';
|
|
30
31
|
import { rerankRequestSchema, rerankResponseSchema } from '../schemas/rerank.js';
|
|
31
32
|
import { classifyRequestSchema, classifyResponseSchema } from '../schemas/classification.js';
|
|
33
|
+
import { calcTokensRequestSchema, calcTokensResponseSchema } from '../schemas/calc-tokens.js';
|
|
32
34
|
import { audioEditStreamRequestSchema, audioEditStreamResponseSchema, audioGenStreamRequestSchema, audioGenStreamResponseSchema, audioUnderstandRequestSchema, audioUnderstandResponseSchema } from '../schemas/audio-gen.js';
|
|
33
35
|
export const requestSchema = z.union([
|
|
34
36
|
audioGenStreamRequestSchema,
|
|
@@ -38,6 +40,9 @@ export const requestSchema = z.union([
|
|
|
38
40
|
stopRpcServerRequestSchema,
|
|
39
41
|
discoverRpcServersRequestSchema,
|
|
40
42
|
heartbeatRequestSchema,
|
|
43
|
+
calcTokensRequestSchema,
|
|
44
|
+
openSessionRequestSchema,
|
|
45
|
+
closeSessionRequestSchema,
|
|
41
46
|
loadModelRequestSchema,
|
|
42
47
|
downloadAssetRequestSchema,
|
|
43
48
|
completionStreamRequestSchema,
|
|
@@ -50,6 +55,7 @@ export const requestSchema = z.union([
|
|
|
50
55
|
bciTranscribeStreamRequestSchema,
|
|
51
56
|
loggingStreamRequestSchema,
|
|
52
57
|
embedRequestSchema,
|
|
58
|
+
embedBatchRequestSchema,
|
|
53
59
|
translateRequestSchema,
|
|
54
60
|
ttsRequestSchema,
|
|
55
61
|
textToSpeechStreamRequestSchema,
|
|
@@ -88,6 +94,9 @@ export const responseSchema = z.discriminatedUnion('type', [
|
|
|
88
94
|
stopRpcServerResponseSchema,
|
|
89
95
|
discoverRpcServersResponseSchema,
|
|
90
96
|
heartbeatResponseSchema,
|
|
97
|
+
calcTokensResponseSchema,
|
|
98
|
+
openSessionResponseSchema,
|
|
99
|
+
closeSessionResponseSchema,
|
|
91
100
|
loadModelResponseSchema,
|
|
92
101
|
downloadAssetResponseSchema,
|
|
93
102
|
completionStreamResponseSchema,
|
|
@@ -101,6 +110,7 @@ export const responseSchema = z.discriminatedUnion('type', [
|
|
|
101
110
|
bciTranscribeStreamResponseSchema,
|
|
102
111
|
loggingStreamResponseSchema,
|
|
103
112
|
embedResponseSchema,
|
|
113
|
+
embedBatchResponseSchema,
|
|
104
114
|
translateResponseSchema,
|
|
105
115
|
ttsResponseSchema,
|
|
106
116
|
textToSpeechStreamResponseSchema,
|
|
@@ -151,5 +161,11 @@ export const rpcOptionsSchema = z.object({
|
|
|
151
161
|
.describe('When `true`, skip any cached RPC connection and open a fresh one for this call.'),
|
|
152
162
|
profiling: perCallProfilingSchema
|
|
153
163
|
.optional()
|
|
154
|
-
.describe('Per-call profiler configuration; when present, overrides the global profiler settings for this request.')
|
|
164
|
+
.describe('Per-call profiler configuration; when present, overrides the global profiler settings for this request.'),
|
|
165
|
+
sessionId: z
|
|
166
|
+
.string()
|
|
167
|
+
.min(1)
|
|
168
|
+
.optional()
|
|
169
|
+
.describe('Caller session to run this request as. Set by a session handle; the ' +
|
|
170
|
+
'transport copies it onto the request body.')
|
|
155
171
|
});
|
|
@@ -16,6 +16,7 @@ export declare const completionStatsSchema: z.ZodObject<{
|
|
|
16
16
|
backendDevice: z.ZodOptional<z.ZodEnum<{
|
|
17
17
|
cpu: "cpu";
|
|
18
18
|
gpu: "gpu";
|
|
19
|
+
npu: "npu";
|
|
19
20
|
}>>;
|
|
20
21
|
}, z.core.$strip>;
|
|
21
22
|
export type CompletionStats = z.infer<typeof completionStatsSchema>;
|
|
@@ -76,6 +77,7 @@ export declare const statsEventSchema: z.ZodObject<{
|
|
|
76
77
|
backendDevice: z.ZodOptional<z.ZodEnum<{
|
|
77
78
|
cpu: "cpu";
|
|
78
79
|
gpu: "gpu";
|
|
80
|
+
npu: "npu";
|
|
79
81
|
}>>;
|
|
80
82
|
}, z.core.$strip>;
|
|
81
83
|
}, z.core.$strip>;
|
|
@@ -162,6 +164,7 @@ export declare const completionEventSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
162
164
|
backendDevice: z.ZodOptional<z.ZodEnum<{
|
|
163
165
|
cpu: "cpu";
|
|
164
166
|
gpu: "gpu";
|
|
167
|
+
npu: "npu";
|
|
165
168
|
}>>;
|
|
166
169
|
}, z.core.$strip>;
|
|
167
170
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -17,7 +17,7 @@ export const completionStatsSchema = z.object({
|
|
|
17
17
|
// Speculative decoding (`spec_type`): draft tokens proposed, and accepted.
|
|
18
18
|
draftTokens: z.number().optional(),
|
|
19
19
|
draftAcceptedTokens: z.number().optional(),
|
|
20
|
-
backendDevice: z.enum(['cpu', 'gpu']).optional()
|
|
20
|
+
backendDevice: z.enum(['cpu', 'gpu', 'npu']).optional()
|
|
21
21
|
});
|
|
22
22
|
export const seqSchema = z.number().int().nonnegative();
|
|
23
23
|
export const contentDeltaEventSchema = z.object({
|
|
@@ -27,6 +27,21 @@ export declare const toolDialectSchema: z.ZodEnum<{
|
|
|
27
27
|
export declare const attachmentSchema: z.ZodObject<{
|
|
28
28
|
path: z.ZodString;
|
|
29
29
|
}, z.core.$strip>;
|
|
30
|
+
/**
|
|
31
|
+
* One ordered piece of a message's `content`. A media part keeps its place in
|
|
32
|
+
* the turn, so text that refers to "this image" sits next to it; `attachments`
|
|
33
|
+
* cannot express that because every attachment is sent before the text.
|
|
34
|
+
*/
|
|
35
|
+
export declare const historyContentPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
36
|
+
type: z.ZodLiteral<"text">;
|
|
37
|
+
text: z.ZodString;
|
|
38
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
39
|
+
type: z.ZodLiteral<"media">;
|
|
40
|
+
path: z.ZodString;
|
|
41
|
+
}, z.core.$strict>], "type">;
|
|
42
|
+
export type HistoryContentPart = z.infer<typeof historyContentPartSchema>;
|
|
43
|
+
/** A message's content: plain text, or ordered text/media parts. */
|
|
44
|
+
export type HistoryContent = string | HistoryContentPart[];
|
|
30
45
|
export declare const generationParamsSchema: z.ZodObject<{
|
|
31
46
|
temp: z.ZodOptional<z.ZodNumber>;
|
|
32
47
|
top_p: z.ZodOptional<z.ZodNumber>;
|
|
@@ -77,7 +92,13 @@ export declare const responseFormatSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
77
92
|
}, z.core.$strict>], "type">;
|
|
78
93
|
export declare const historyMessageSchema: z.ZodPipe<z.ZodObject<{
|
|
79
94
|
role: z.ZodString;
|
|
80
|
-
content: z.ZodOptional<z.ZodNullable<z.ZodString
|
|
95
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
96
|
+
type: z.ZodLiteral<"text">;
|
|
97
|
+
text: z.ZodString;
|
|
98
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
99
|
+
type: z.ZodLiteral<"media">;
|
|
100
|
+
path: z.ZodString;
|
|
101
|
+
}, z.core.$strict>], "type">>]>>>;
|
|
81
102
|
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
82
103
|
path: z.ZodString;
|
|
83
104
|
}, z.core.$strip>>>;
|
|
@@ -89,7 +110,13 @@ export declare const historyMessageSchema: z.ZodPipe<z.ZodObject<{
|
|
|
89
110
|
toolCallId: z.ZodOptional<z.ZodString>;
|
|
90
111
|
toolName: z.ZodOptional<z.ZodString>;
|
|
91
112
|
}, z.core.$strip>, z.ZodTransform<{
|
|
92
|
-
content: string
|
|
113
|
+
content: string | ({
|
|
114
|
+
type: "text";
|
|
115
|
+
text: string;
|
|
116
|
+
} | {
|
|
117
|
+
type: "media";
|
|
118
|
+
path: string;
|
|
119
|
+
})[];
|
|
93
120
|
role: string;
|
|
94
121
|
attachments?: {
|
|
95
122
|
path: string;
|
|
@@ -103,7 +130,13 @@ export declare const historyMessageSchema: z.ZodPipe<z.ZodObject<{
|
|
|
103
130
|
toolName?: string | undefined;
|
|
104
131
|
}, {
|
|
105
132
|
role: string;
|
|
106
|
-
content?: string |
|
|
133
|
+
content?: string | ({
|
|
134
|
+
type: "text";
|
|
135
|
+
text: string;
|
|
136
|
+
} | {
|
|
137
|
+
type: "media";
|
|
138
|
+
path: string;
|
|
139
|
+
})[] | null | undefined;
|
|
107
140
|
attachments?: {
|
|
108
141
|
path: string;
|
|
109
142
|
}[] | undefined;
|
|
@@ -115,11 +148,37 @@ export declare const historyMessageSchema: z.ZodPipe<z.ZodObject<{
|
|
|
115
148
|
toolCallId?: string | undefined;
|
|
116
149
|
toolName?: string | undefined;
|
|
117
150
|
}>>;
|
|
151
|
+
export declare const historyMessageWithoutAttachmentsSchema: z.ZodObject<{
|
|
152
|
+
role: z.ZodString;
|
|
153
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
154
|
+
id: z.ZodOptional<z.ZodString>;
|
|
155
|
+
name: z.ZodString;
|
|
156
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
157
|
+
}, z.core.$strip>>>;
|
|
158
|
+
toolCallId: z.ZodOptional<z.ZodString>;
|
|
159
|
+
toolName: z.ZodOptional<z.ZodString>;
|
|
160
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
161
|
+
type: z.ZodLiteral<"text">;
|
|
162
|
+
text: z.ZodString;
|
|
163
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
164
|
+
type: z.ZodLiteral<"media">;
|
|
165
|
+
path: z.ZodString;
|
|
166
|
+
}, z.core.$strict>], "type">>]>>>;
|
|
167
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
168
|
+
path: z.ZodString;
|
|
169
|
+
}, z.core.$strip>>>;
|
|
170
|
+
}, z.core.$strip>;
|
|
118
171
|
export type HistoryMessage = z.infer<typeof historyMessageSchema>;
|
|
119
172
|
export declare const completionParamsSchema: z.ZodObject<{
|
|
120
173
|
history: z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
121
174
|
role: z.ZodString;
|
|
122
|
-
content: z.ZodOptional<z.ZodNullable<z.ZodString
|
|
175
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
176
|
+
type: z.ZodLiteral<"text">;
|
|
177
|
+
text: z.ZodString;
|
|
178
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
179
|
+
type: z.ZodLiteral<"media">;
|
|
180
|
+
path: z.ZodString;
|
|
181
|
+
}, z.core.$strict>], "type">>]>>>;
|
|
123
182
|
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
124
183
|
path: z.ZodString;
|
|
125
184
|
}, z.core.$strip>>>;
|
|
@@ -131,7 +190,13 @@ export declare const completionParamsSchema: z.ZodObject<{
|
|
|
131
190
|
toolCallId: z.ZodOptional<z.ZodString>;
|
|
132
191
|
toolName: z.ZodOptional<z.ZodString>;
|
|
133
192
|
}, z.core.$strip>, z.ZodTransform<{
|
|
134
|
-
content: string
|
|
193
|
+
content: string | ({
|
|
194
|
+
type: "text";
|
|
195
|
+
text: string;
|
|
196
|
+
} | {
|
|
197
|
+
type: "media";
|
|
198
|
+
path: string;
|
|
199
|
+
})[];
|
|
135
200
|
role: string;
|
|
136
201
|
attachments?: {
|
|
137
202
|
path: string;
|
|
@@ -145,7 +210,13 @@ export declare const completionParamsSchema: z.ZodObject<{
|
|
|
145
210
|
toolName?: string | undefined;
|
|
146
211
|
}, {
|
|
147
212
|
role: string;
|
|
148
|
-
content?: string |
|
|
213
|
+
content?: string | ({
|
|
214
|
+
type: "text";
|
|
215
|
+
text: string;
|
|
216
|
+
} | {
|
|
217
|
+
type: "media";
|
|
218
|
+
path: string;
|
|
219
|
+
})[] | null | undefined;
|
|
149
220
|
attachments?: {
|
|
150
221
|
path: string;
|
|
151
222
|
}[] | undefined;
|
|
@@ -160,11 +231,18 @@ export declare const completionParamsSchema: z.ZodObject<{
|
|
|
160
231
|
modelId: z.ZodString;
|
|
161
232
|
kvCache: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
162
233
|
prefill: z.ZodOptional<z.ZodBoolean>;
|
|
234
|
+
seedFrom: z.ZodOptional<z.ZodString>;
|
|
163
235
|
}, z.core.$strip>;
|
|
164
236
|
export declare const completionClientParamsSchema: z.ZodObject<{
|
|
165
237
|
history: z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
166
238
|
role: z.ZodString;
|
|
167
|
-
content: z.ZodOptional<z.ZodNullable<z.ZodString
|
|
239
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
240
|
+
type: z.ZodLiteral<"text">;
|
|
241
|
+
text: z.ZodString;
|
|
242
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
243
|
+
type: z.ZodLiteral<"media">;
|
|
244
|
+
path: z.ZodString;
|
|
245
|
+
}, z.core.$strict>], "type">>]>>>;
|
|
168
246
|
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
169
247
|
path: z.ZodString;
|
|
170
248
|
}, z.core.$strip>>>;
|
|
@@ -176,7 +254,13 @@ export declare const completionClientParamsSchema: z.ZodObject<{
|
|
|
176
254
|
toolCallId: z.ZodOptional<z.ZodString>;
|
|
177
255
|
toolName: z.ZodOptional<z.ZodString>;
|
|
178
256
|
}, z.core.$strip>, z.ZodTransform<{
|
|
179
|
-
content: string
|
|
257
|
+
content: string | ({
|
|
258
|
+
type: "text";
|
|
259
|
+
text: string;
|
|
260
|
+
} | {
|
|
261
|
+
type: "media";
|
|
262
|
+
path: string;
|
|
263
|
+
})[];
|
|
180
264
|
role: string;
|
|
181
265
|
attachments?: {
|
|
182
266
|
path: string;
|
|
@@ -190,7 +274,13 @@ export declare const completionClientParamsSchema: z.ZodObject<{
|
|
|
190
274
|
toolName?: string | undefined;
|
|
191
275
|
}, {
|
|
192
276
|
role: string;
|
|
193
|
-
content?: string |
|
|
277
|
+
content?: string | ({
|
|
278
|
+
type: "text";
|
|
279
|
+
text: string;
|
|
280
|
+
} | {
|
|
281
|
+
type: "media";
|
|
282
|
+
path: string;
|
|
283
|
+
})[] | null | undefined;
|
|
194
284
|
attachments?: {
|
|
195
285
|
path: string;
|
|
196
286
|
}[] | undefined;
|
|
@@ -204,6 +294,7 @@ export declare const completionClientParamsSchema: z.ZodObject<{
|
|
|
204
294
|
}>>>;
|
|
205
295
|
modelId: z.ZodString;
|
|
206
296
|
prefill: z.ZodOptional<z.ZodBoolean>;
|
|
297
|
+
seedFrom: z.ZodOptional<z.ZodString>;
|
|
207
298
|
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
208
299
|
type: z.ZodLiteral<"function">;
|
|
209
300
|
name: z.ZodString;
|
|
@@ -236,6 +327,10 @@ export declare const completionClientParamsSchema: z.ZodObject<{
|
|
|
236
327
|
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
237
328
|
}, z.core.$loose>;
|
|
238
329
|
}, z.core.$strip>>>;
|
|
330
|
+
toolSearch: z.ZodOptional<z.ZodObject<{
|
|
331
|
+
defaultLimit: z.ZodOptional<z.ZodNumber>;
|
|
332
|
+
maxLimit: z.ZodOptional<z.ZodNumber>;
|
|
333
|
+
}, z.core.$strict>>;
|
|
239
334
|
stream: z.ZodBoolean;
|
|
240
335
|
kvCache: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
241
336
|
generationParams: z.ZodOptional<z.ZodObject<{
|
|
@@ -280,7 +375,13 @@ export declare const completionClientParamsSchema: z.ZodObject<{
|
|
|
280
375
|
export declare const completionStreamRequestSchema: z.ZodObject<{
|
|
281
376
|
history: z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
282
377
|
role: z.ZodString;
|
|
283
|
-
content: z.ZodOptional<z.ZodNullable<z.ZodString
|
|
378
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
379
|
+
type: z.ZodLiteral<"text">;
|
|
380
|
+
text: z.ZodString;
|
|
381
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
382
|
+
type: z.ZodLiteral<"media">;
|
|
383
|
+
path: z.ZodString;
|
|
384
|
+
}, z.core.$strict>], "type">>]>>>;
|
|
284
385
|
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
285
386
|
path: z.ZodString;
|
|
286
387
|
}, z.core.$strip>>>;
|
|
@@ -292,7 +393,13 @@ export declare const completionStreamRequestSchema: z.ZodObject<{
|
|
|
292
393
|
toolCallId: z.ZodOptional<z.ZodString>;
|
|
293
394
|
toolName: z.ZodOptional<z.ZodString>;
|
|
294
395
|
}, z.core.$strip>, z.ZodTransform<{
|
|
295
|
-
content: string
|
|
396
|
+
content: string | ({
|
|
397
|
+
type: "text";
|
|
398
|
+
text: string;
|
|
399
|
+
} | {
|
|
400
|
+
type: "media";
|
|
401
|
+
path: string;
|
|
402
|
+
})[];
|
|
296
403
|
role: string;
|
|
297
404
|
attachments?: {
|
|
298
405
|
path: string;
|
|
@@ -306,7 +413,13 @@ export declare const completionStreamRequestSchema: z.ZodObject<{
|
|
|
306
413
|
toolName?: string | undefined;
|
|
307
414
|
}, {
|
|
308
415
|
role: string;
|
|
309
|
-
content?: string |
|
|
416
|
+
content?: string | ({
|
|
417
|
+
type: "text";
|
|
418
|
+
text: string;
|
|
419
|
+
} | {
|
|
420
|
+
type: "media";
|
|
421
|
+
path: string;
|
|
422
|
+
})[] | null | undefined;
|
|
310
423
|
attachments?: {
|
|
311
424
|
path: string;
|
|
312
425
|
}[] | undefined;
|
|
@@ -320,6 +433,7 @@ export declare const completionStreamRequestSchema: z.ZodObject<{
|
|
|
320
433
|
}>>>;
|
|
321
434
|
modelId: z.ZodString;
|
|
322
435
|
prefill: z.ZodOptional<z.ZodBoolean>;
|
|
436
|
+
seedFrom: z.ZodOptional<z.ZodString>;
|
|
323
437
|
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
324
438
|
type: z.ZodLiteral<"function">;
|
|
325
439
|
name: z.ZodString;
|
|
@@ -352,6 +466,10 @@ export declare const completionStreamRequestSchema: z.ZodObject<{
|
|
|
352
466
|
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
353
467
|
}, z.core.$loose>;
|
|
354
468
|
}, z.core.$strip>>>;
|
|
469
|
+
toolSearch: z.ZodOptional<z.ZodObject<{
|
|
470
|
+
defaultLimit: z.ZodOptional<z.ZodNumber>;
|
|
471
|
+
maxLimit: z.ZodOptional<z.ZodNumber>;
|
|
472
|
+
}, z.core.$strict>>;
|
|
355
473
|
stream: z.ZodBoolean;
|
|
356
474
|
kvCache: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
357
475
|
generationParams: z.ZodOptional<z.ZodObject<{
|
|
@@ -391,8 +509,9 @@ export declare const completionStreamRequestSchema: z.ZodObject<{
|
|
|
391
509
|
strict: z.ZodOptional<z.ZodBoolean>;
|
|
392
510
|
}, z.core.$strict>;
|
|
393
511
|
}, z.core.$strict>], "type">>;
|
|
394
|
-
requestId: z.ZodOptional<z.ZodString>;
|
|
395
512
|
type: z.ZodLiteral<"completionStream">;
|
|
513
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
514
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
396
515
|
}, z.core.$strip>;
|
|
397
516
|
export declare const completionStreamResponseSchema: z.ZodObject<{
|
|
398
517
|
type: z.ZodLiteral<"completionStream">;
|
|
@@ -448,6 +567,7 @@ export declare const completionStreamResponseSchema: z.ZodObject<{
|
|
|
448
567
|
backendDevice: z.ZodOptional<z.ZodEnum<{
|
|
449
568
|
cpu: "cpu";
|
|
450
569
|
gpu: "gpu";
|
|
570
|
+
npu: "npu";
|
|
451
571
|
}>>;
|
|
452
572
|
}, z.core.$strip>;
|
|
453
573
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -477,7 +597,13 @@ export declare const completionStreamResponseSchema: z.ZodObject<{
|
|
|
477
597
|
export declare const completionOrchestrateRequestSchema: z.ZodObject<{
|
|
478
598
|
history: z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
479
599
|
role: z.ZodString;
|
|
480
|
-
content: z.ZodOptional<z.ZodNullable<z.ZodString
|
|
600
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
601
|
+
type: z.ZodLiteral<"text">;
|
|
602
|
+
text: z.ZodString;
|
|
603
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
604
|
+
type: z.ZodLiteral<"media">;
|
|
605
|
+
path: z.ZodString;
|
|
606
|
+
}, z.core.$strict>], "type">>]>>>;
|
|
481
607
|
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
482
608
|
path: z.ZodString;
|
|
483
609
|
}, z.core.$strip>>>;
|
|
@@ -489,7 +615,13 @@ export declare const completionOrchestrateRequestSchema: z.ZodObject<{
|
|
|
489
615
|
toolCallId: z.ZodOptional<z.ZodString>;
|
|
490
616
|
toolName: z.ZodOptional<z.ZodString>;
|
|
491
617
|
}, z.core.$strip>, z.ZodTransform<{
|
|
492
|
-
content: string
|
|
618
|
+
content: string | ({
|
|
619
|
+
type: "text";
|
|
620
|
+
text: string;
|
|
621
|
+
} | {
|
|
622
|
+
type: "media";
|
|
623
|
+
path: string;
|
|
624
|
+
})[];
|
|
493
625
|
role: string;
|
|
494
626
|
attachments?: {
|
|
495
627
|
path: string;
|
|
@@ -503,7 +635,13 @@ export declare const completionOrchestrateRequestSchema: z.ZodObject<{
|
|
|
503
635
|
toolName?: string | undefined;
|
|
504
636
|
}, {
|
|
505
637
|
role: string;
|
|
506
|
-
content?: string |
|
|
638
|
+
content?: string | ({
|
|
639
|
+
type: "text";
|
|
640
|
+
text: string;
|
|
641
|
+
} | {
|
|
642
|
+
type: "media";
|
|
643
|
+
path: string;
|
|
644
|
+
})[] | null | undefined;
|
|
507
645
|
attachments?: {
|
|
508
646
|
path: string;
|
|
509
647
|
}[] | undefined;
|
|
@@ -517,6 +655,7 @@ export declare const completionOrchestrateRequestSchema: z.ZodObject<{
|
|
|
517
655
|
}>>>;
|
|
518
656
|
modelId: z.ZodString;
|
|
519
657
|
prefill: z.ZodOptional<z.ZodBoolean>;
|
|
658
|
+
seedFrom: z.ZodOptional<z.ZodString>;
|
|
520
659
|
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
521
660
|
type: z.ZodLiteral<"function">;
|
|
522
661
|
name: z.ZodString;
|
|
@@ -549,6 +688,10 @@ export declare const completionOrchestrateRequestSchema: z.ZodObject<{
|
|
|
549
688
|
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
550
689
|
}, z.core.$loose>;
|
|
551
690
|
}, z.core.$strip>>>;
|
|
691
|
+
toolSearch: z.ZodOptional<z.ZodObject<{
|
|
692
|
+
defaultLimit: z.ZodOptional<z.ZodNumber>;
|
|
693
|
+
maxLimit: z.ZodOptional<z.ZodNumber>;
|
|
694
|
+
}, z.core.$strict>>;
|
|
552
695
|
stream: z.ZodBoolean;
|
|
553
696
|
kvCache: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
554
697
|
generationParams: z.ZodOptional<z.ZodObject<{
|
|
@@ -588,9 +731,10 @@ export declare const completionOrchestrateRequestSchema: z.ZodObject<{
|
|
|
588
731
|
strict: z.ZodOptional<z.ZodBoolean>;
|
|
589
732
|
}, z.core.$strict>;
|
|
590
733
|
}, z.core.$strict>], "type">>;
|
|
591
|
-
requestId: z.ZodOptional<z.ZodString>;
|
|
592
734
|
type: z.ZodLiteral<"completionOrchestrate">;
|
|
593
735
|
maxToolTurns: z.ZodOptional<z.ZodNumber>;
|
|
736
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
737
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
594
738
|
}, z.core.$strip>;
|
|
595
739
|
/**
|
|
596
740
|
* Downstream frame of the orchestrated completion duplex stream. Exactly one
|
|
@@ -659,6 +803,7 @@ export declare const completionOrchestrateResponseSchema: z.ZodObject<{
|
|
|
659
803
|
backendDevice: z.ZodOptional<z.ZodEnum<{
|
|
660
804
|
cpu: "cpu";
|
|
661
805
|
gpu: "gpu";
|
|
806
|
+
npu: "npu";
|
|
662
807
|
}>>;
|
|
663
808
|
}, z.core.$strip>;
|
|
664
809
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { toolSchema } from '../schemas/tools.js';
|
|
2
|
+
import { toolSchema, toolSearchOptionsSchema } from '../schemas/tools.js';
|
|
3
3
|
import { TOOL_SEARCH_NAME } from '../utils/tools/defer.js';
|
|
4
4
|
import { completionEventSchema } from '../schemas/completion-event.js';
|
|
5
5
|
import { REASONING_BUDGET_MAX } from '../schemas/llamacpp-config.js';
|
|
6
|
+
import { trackedRequestSchema } from '../schemas/request-base.js';
|
|
6
7
|
export { completionStatsSchema } from '../schemas/completion-event.js';
|
|
7
8
|
/**
|
|
8
9
|
* Tool-call output dialect. Detected at load from the model name, then from the
|
|
@@ -33,6 +34,28 @@ export const attachmentSchema = z.object({
|
|
|
33
34
|
.string()
|
|
34
35
|
.describe('Absolute or resolvable path to the attachment file (e.g., image for multimodal models).')
|
|
35
36
|
});
|
|
37
|
+
/**
|
|
38
|
+
* One ordered piece of a message's `content`. A media part keeps its place in
|
|
39
|
+
* the turn, so text that refers to "this image" sits next to it; `attachments`
|
|
40
|
+
* cannot express that because every attachment is sent before the text.
|
|
41
|
+
*/
|
|
42
|
+
export const historyContentPartSchema = z.discriminatedUnion('type', [
|
|
43
|
+
z
|
|
44
|
+
.object({
|
|
45
|
+
type: z.literal('text'),
|
|
46
|
+
text: z.string().describe('Text rendered at this position in the turn.')
|
|
47
|
+
})
|
|
48
|
+
.strict(),
|
|
49
|
+
z
|
|
50
|
+
.object({
|
|
51
|
+
type: z.literal('media'),
|
|
52
|
+
path: z
|
|
53
|
+
.string()
|
|
54
|
+
.min(1)
|
|
55
|
+
.describe('Absolute or resolvable path to the media file (e.g., image for multimodal models).')
|
|
56
|
+
})
|
|
57
|
+
.strict()
|
|
58
|
+
]);
|
|
36
59
|
const kvCacheSchema = z.union([
|
|
37
60
|
z.boolean(),
|
|
38
61
|
z.string().min(1, 'KV cache key cannot be empty string')
|
|
@@ -160,15 +183,12 @@ const historyToolCallSchema = z.object({
|
|
|
160
183
|
name: z.string().min(1).describe('Name of the tool that was called.'),
|
|
161
184
|
arguments: z.record(z.string(), z.unknown()).describe('Arguments the tool was called with.')
|
|
162
185
|
});
|
|
163
|
-
|
|
164
|
-
.
|
|
165
|
-
role: z
|
|
166
|
-
.string()
|
|
167
|
-
.describe('Message role (e.g., `"user"`, `"assistant"`, `"system"`, `"tool"`).'),
|
|
186
|
+
const historyMessageObjectSchema = z.object({
|
|
187
|
+
role: z.string().describe('Message role (e.g., `"user"`, `"assistant"`, `"system"`, `"tool"`).'),
|
|
168
188
|
content: z
|
|
169
|
-
.string()
|
|
189
|
+
.union([z.string(), z.array(historyContentPartSchema)])
|
|
170
190
|
.nullish()
|
|
171
|
-
.describe('Message content. May be `null` or omitted only on an `assistant` turn that carries `toolCalls`, as OpenAI histories send it; it then reads as an empty string.'),
|
|
191
|
+
.describe('Message content. May be `null` or omitted only on an `assistant` turn that carries `toolCalls`, as OpenAI histories send it; it then reads as an empty string. A user turn may instead pass an ordered array of text/media parts, so each image keeps its position in the turn.'),
|
|
172
192
|
attachments: z
|
|
173
193
|
.array(attachmentSchema)
|
|
174
194
|
.optional()
|
|
@@ -185,8 +205,8 @@ export const historyMessageSchema = z
|
|
|
185
205
|
.string()
|
|
186
206
|
.optional()
|
|
187
207
|
.describe('On a `tool` turn: the name of the tool that produced the result.')
|
|
188
|
-
})
|
|
189
|
-
|
|
208
|
+
});
|
|
209
|
+
function refineHistoryMessage(message, ctx) {
|
|
190
210
|
const callsOnly = message.role === 'assistant' && (message.toolCalls?.length ?? 0) > 0;
|
|
191
211
|
if ((message.content === null || message.content === undefined) && !callsOnly) {
|
|
192
212
|
ctx.addIssue({
|
|
@@ -195,6 +215,22 @@ export const historyMessageSchema = z
|
|
|
195
215
|
path: ['content']
|
|
196
216
|
});
|
|
197
217
|
}
|
|
218
|
+
if (Array.isArray(message.content)) {
|
|
219
|
+
if (message.role !== 'user') {
|
|
220
|
+
ctx.addIssue({
|
|
221
|
+
code: 'custom',
|
|
222
|
+
message: '`content` parts are only valid on a user message.',
|
|
223
|
+
path: ['content']
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
if (message.attachments !== undefined && message.attachments.length > 0) {
|
|
227
|
+
ctx.addIssue({
|
|
228
|
+
code: 'custom',
|
|
229
|
+
message: 'Pass media either as `attachments` or as `content` parts, not both.',
|
|
230
|
+
path: ['attachments']
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
198
234
|
if (message.toolCalls !== undefined && message.role !== 'assistant') {
|
|
199
235
|
ctx.addIssue({
|
|
200
236
|
code: 'custom',
|
|
@@ -211,8 +247,34 @@ export const historyMessageSchema = z
|
|
|
211
247
|
});
|
|
212
248
|
}
|
|
213
249
|
}
|
|
250
|
+
}
|
|
251
|
+
function normalizeHistoryMessage(message) {
|
|
252
|
+
return { ...message, content: message.content ?? '' };
|
|
253
|
+
}
|
|
254
|
+
export const historyMessageSchema = historyMessageObjectSchema
|
|
255
|
+
.superRefine(refineHistoryMessage)
|
|
256
|
+
.transform(normalizeHistoryMessage);
|
|
257
|
+
export const historyMessageWithoutAttachmentsSchema = historyMessageObjectSchema
|
|
258
|
+
.extend({
|
|
259
|
+
content: z
|
|
260
|
+
.union([z.string(), z.array(historyContentPartSchema)])
|
|
261
|
+
.nullish()
|
|
262
|
+
.describe('Message content to count; media parts are rejected with guidance to use completion().'),
|
|
263
|
+
attachments: z
|
|
264
|
+
.array(attachmentSchema)
|
|
265
|
+
.max(0, 'calcTokens does not support attachments; use completion() for attachments.')
|
|
266
|
+
.optional()
|
|
214
267
|
})
|
|
215
|
-
.
|
|
268
|
+
.superRefine((message, ctx) => {
|
|
269
|
+
refineHistoryMessage(message, ctx);
|
|
270
|
+
if (Array.isArray(message.content) && message.content.some((part) => part.type === 'media')) {
|
|
271
|
+
ctx.addIssue({
|
|
272
|
+
code: 'custom',
|
|
273
|
+
message: 'calcTokens does not support media content; use completion() for media.',
|
|
274
|
+
path: ['content']
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
});
|
|
216
278
|
export const completionParamsSchema = z.object({
|
|
217
279
|
history: z
|
|
218
280
|
.array(historyMessageSchema)
|
|
@@ -220,17 +282,23 @@ export const completionParamsSchema = z.object({
|
|
|
220
282
|
modelId: z.string().describe('The identifier of the model to use for completion.'),
|
|
221
283
|
kvCache: kvCacheSchema
|
|
222
284
|
.optional()
|
|
223
|
-
.describe('KV cache configuration — `true` to auto-generate a cache key from history, a string to use a custom key, or `false`/`undefined` to
|
|
285
|
+
.describe('KV cache configuration — `true` to auto-generate a cache key from history, a string to use a custom key, or `false`/`undefined` to avoid a persistent cache key. Keyless requests reuse a model-wide shared prefix only when the model loads with `cache_share_across_keys: true`.'),
|
|
224
286
|
prefill: z
|
|
225
287
|
.boolean()
|
|
226
288
|
.optional()
|
|
227
|
-
.describe('Evaluate the prompt without generating an answer. Requires an enabled KV cache.')
|
|
289
|
+
.describe('Evaluate the prompt without generating an answer. Requires an enabled KV cache.'),
|
|
290
|
+
seedFrom: z
|
|
291
|
+
.string()
|
|
292
|
+
.min(1, 'seedFrom cannot be empty string')
|
|
293
|
+
.optional()
|
|
294
|
+
.describe('Name of another caller-managed cache to start this chat from, such as a primed system prompt and tools. On the first turn of a chat whose `kvCache` key has no cache yet, the model reads that cache and reuses the prefix it shares with the prompt, so only the rest is processed; the source is never written. Ignored once the chat has a cache. Needs a string `kvCache` other than itself. Refused when no cache of that name exists for this model and system prompt, or when the model was not loaded with `cache_share_across_keys: true`, which is off by default.')
|
|
228
295
|
});
|
|
229
296
|
const completionClientParamsBaseSchema = completionParamsSchema.extend({
|
|
230
297
|
tools: z
|
|
231
298
|
.array(toolSchema)
|
|
232
299
|
.optional()
|
|
233
300
|
.describe('Optional array of tools (full `Tool` objects or Zod-schema `ToolInput` definitions) the model can call.'),
|
|
301
|
+
toolSearch: toolSearchOptionsSchema.optional(),
|
|
234
302
|
stream: z
|
|
235
303
|
.boolean()
|
|
236
304
|
.describe('Whether to stream tokens (`true`) or return the complete response once (`false`).'),
|
|
@@ -298,6 +366,7 @@ export const completionStreamRequestSchema = completionClientParamsBaseSchema
|
|
|
298
366
|
.extend({
|
|
299
367
|
type: z.literal('completionStream')
|
|
300
368
|
})
|
|
369
|
+
.extend(trackedRequestSchema.shape)
|
|
301
370
|
.superRefine(refinePrefill)
|
|
302
371
|
.superRefine(refineNoToolsWithStructuredOutput)
|
|
303
372
|
.superRefine(refineToolChoiceMatchesTools)
|
|
@@ -326,6 +395,7 @@ export const completionOrchestrateRequestSchema = completionClientParamsBaseSche
|
|
|
326
395
|
'pass; a turn that requests tool calls consumes callbacks and starts ' +
|
|
327
396
|
'the next turn. Defaults to 8.')
|
|
328
397
|
})
|
|
398
|
+
.extend(trackedRequestSchema.shape)
|
|
329
399
|
.superRefine(refinePrefill)
|
|
330
400
|
.superRefine(refineNoToolsWithStructuredOutput)
|
|
331
401
|
.superRefine(refineToolChoiceMatchesTools)
|