@qvac/sdk 0.9.1 → 0.10.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 +15 -68
- package/dist/client/api/cancel.d.ts +1 -1
- package/dist/client/api/cancel.js +1 -1
- package/dist/client/api/completion-stream.d.ts +51 -12
- package/dist/client/api/completion-stream.js +129 -56
- package/dist/client/api/delete-cache.d.ts +1 -0
- package/dist/client/api/delete-cache.js +1 -0
- package/dist/client/api/diffusion.d.ts +17 -2
- package/dist/client/api/diffusion.js +21 -4
- package/dist/client/api/embed.d.ts +4 -0
- package/dist/client/api/finetune.d.ts +21 -0
- package/dist/client/api/get-loaded-model-info.d.ts +25 -0
- package/dist/client/api/get-loaded-model-info.js +36 -0
- package/dist/client/api/get-model-info.d.ts +9 -1
- package/dist/client/api/get-model-info.js +8 -0
- package/dist/client/api/heartbeat.d.ts +2 -2
- package/dist/client/api/heartbeat.js +2 -2
- package/dist/client/api/index.d.ts +3 -1
- package/dist/client/api/index.js +3 -1
- package/dist/client/api/invoke-plugin.d.ts +16 -0
- package/dist/client/api/invoke-plugin.js +16 -0
- package/dist/client/api/load-model.d.ts +36 -3
- package/dist/client/api/load-model.js +31 -10
- package/dist/client/api/provide.d.ts +11 -5
- package/dist/client/api/provide.js +11 -6
- package/dist/client/api/rag.d.ts +9 -0
- package/dist/client/api/rag.js +9 -0
- package/dist/client/api/registry.d.ts +26 -0
- package/dist/client/api/registry.js +26 -0
- package/dist/client/api/resume.d.ts +20 -4
- package/dist/client/api/resume.js +20 -4
- package/dist/client/api/state.d.ts +23 -0
- package/dist/client/api/state.js +29 -0
- package/dist/client/api/stop-provider.d.ts +11 -5
- package/dist/client/api/stop-provider.js +11 -5
- package/dist/client/api/suspend.d.ts +21 -3
- package/dist/client/api/suspend.js +21 -3
- package/dist/client/api/text-to-speech.d.ts +64 -6
- package/dist/client/api/text-to-speech.js +423 -47
- package/dist/client/api/transcribe.d.ts +29 -4
- package/dist/client/api/transcribe.js +86 -28
- package/dist/client/api/translate.d.ts +1 -0
- package/dist/client/api/translate.js +1 -0
- package/dist/client/rpc/bare-client.js +22 -1
- package/dist/client/rpc/expo-rpc-client.d.ts +1 -1
- package/dist/client/rpc/expo-rpc-client.js +96 -4
- package/dist/client/rpc/node-rpc-client.js +36 -0
- package/dist/examples/audio/mic-input.d.ts +9 -0
- package/dist/examples/audio/mic-input.js +111 -0
- package/dist/examples/completion-events.d.ts +18 -0
- package/dist/examples/completion-events.js +79 -0
- package/dist/examples/delegated-inference/composite.js +12 -18
- package/dist/examples/delegated-inference/consumer-profiled.js +4 -11
- package/dist/examples/delegated-inference/consumer.js +8 -13
- package/dist/examples/delegated-inference/provider.js +11 -16
- package/dist/examples/diffusion-flux2-klein-img2img.d.ts +2 -0
- package/dist/examples/diffusion-flux2-klein-img2img.js +60 -0
- package/dist/examples/diffusion-flux2-klein.js +1 -0
- package/dist/examples/diffusion-img2img.d.ts +2 -0
- package/dist/examples/diffusion-img2img.js +49 -0
- package/dist/examples/diffusion-txt2img.js +2 -1
- package/dist/examples/kv-cache-example.js +11 -12
- package/dist/examples/llamacpp-cache.d.ts +2 -0
- package/dist/examples/llamacpp-cache.js +107 -0
- package/dist/examples/llamacpp-dynamic-tools.d.ts +2 -0
- package/dist/examples/llamacpp-dynamic-tools.js +144 -0
- package/dist/examples/llamacpp-native-tools.js +2 -8
- package/dist/examples/llamacpp-structured-output.d.ts +2 -0
- package/dist/examples/llamacpp-structured-output.js +106 -0
- package/dist/examples/llamacpp-tools-pythonic.d.ts +2 -0
- package/dist/examples/llamacpp-tools-pythonic.js +69 -0
- package/dist/examples/plugins.js +4 -4
- package/dist/examples/suspend-resume.js +21 -4
- package/dist/examples/transcription/parakeet-microphone-record.js +6 -33
- package/dist/examples/transcription/whispercpp-filesystem-streaming.js +7 -5
- package/dist/examples/transcription/whispercpp-filesystem.js +12 -3
- package/dist/examples/transcription/whispercpp-microphone-record.js +6 -29
- package/dist/examples/translation/translation-stream.js +5 -5
- package/dist/examples/tts/llm-to-tts-streaming.d.ts +16 -0
- package/dist/examples/tts/llm-to-tts-streaming.js +143 -0
- package/dist/examples/tts/supertonic-multilingual.js +3 -3
- package/dist/examples/tts/supertonic.js +3 -3
- package/dist/examples/tts/utils.d.ts +11 -1
- package/dist/examples/tts/utils.js +70 -17
- package/dist/examples/voice-assistant/voice-assistant.d.ts +2 -0
- package/dist/examples/voice-assistant/voice-assistant.js +207 -0
- package/dist/expo/plugins/withMobileBundle.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/logging/logger.d.ts +11 -0
- package/dist/logging/logger.js +11 -0
- package/dist/logging/types.d.ts +18 -0
- package/dist/models/registry/models.d.ts +6620 -6185
- package/dist/models/registry/models.js +6296 -5318
- package/dist/models/update-models/codegen.js +84 -23
- package/dist/models/update-models/companions.d.ts +18 -0
- package/dist/models/update-models/companions.js +175 -0
- package/dist/models/update-models/naming.js +0 -25
- package/dist/models/update-models/registry.js +4 -2
- package/dist/models/update-models/types.d.ts +37 -9
- package/dist/profiling/index.d.ts +49 -0
- package/dist/profiling/index.js +49 -0
- package/dist/schemas/cancel.d.ts +6 -2
- package/dist/schemas/cancel.js +14 -7
- package/dist/schemas/common.d.ts +361 -279
- package/dist/schemas/common.js +26 -5
- package/dist/schemas/completion-event.d.ts +225 -0
- package/dist/schemas/completion-event.js +79 -0
- package/dist/schemas/completion-stream.d.ts +122 -31
- package/dist/schemas/completion-stream.js +137 -36
- package/dist/schemas/delegate.d.ts +0 -2
- package/dist/schemas/delegate.js +25 -6
- package/dist/schemas/download-asset.d.ts +5 -5
- package/dist/schemas/embed.js +21 -9
- package/dist/schemas/engine-addon-map.d.ts +11 -1
- package/dist/schemas/engine-addon-map.js +2 -2
- package/dist/schemas/finetune.d.ts +16 -16
- package/dist/schemas/finetune.js +8 -8
- package/dist/schemas/get-loaded-model-info.d.ts +52 -0
- package/dist/schemas/get-loaded-model-info.js +44 -0
- package/dist/schemas/get-model-info.d.ts +2 -2
- package/dist/schemas/get-model-info.js +103 -32
- package/dist/schemas/heartbeat.d.ts +0 -1
- package/dist/schemas/index.d.ts +4 -1
- package/dist/schemas/index.js +4 -1
- package/dist/schemas/llamacpp-config.d.ts +14 -4
- package/dist/schemas/llamacpp-config.js +5 -0
- package/dist/schemas/load-model.d.ts +3233 -1260
- package/dist/schemas/load-model.js +23 -16
- package/dist/schemas/model-src-utils.d.ts +7 -6
- package/dist/schemas/model-src-utils.js +27 -1
- package/dist/schemas/model-types.d.ts +4 -4
- package/dist/schemas/ocr.d.ts +1 -1
- package/dist/schemas/plugin.d.ts +27 -3
- package/dist/schemas/plugin.js +27 -2
- package/dist/schemas/profiling.js +11 -3
- package/dist/schemas/provide.d.ts +1 -3
- package/dist/schemas/provide.js +0 -3
- package/dist/schemas/rag.d.ts +4 -4
- package/dist/schemas/registry.d.ts +10 -10
- package/dist/schemas/registry.js +36 -14
- package/dist/schemas/reload-config.d.ts +73 -7
- package/dist/schemas/sdcpp-config.d.ts +16 -8
- package/dist/schemas/sdcpp-config.js +118 -25
- package/dist/schemas/sdk-config.d.ts +116 -90
- package/dist/schemas/sdk-config.js +16 -0
- package/dist/schemas/sdk-errors-client.d.ts +3 -0
- package/dist/schemas/sdk-errors-client.js +16 -1
- package/dist/schemas/sdk-errors-server.d.ts +3 -0
- package/dist/schemas/sdk-errors-server.js +23 -0
- package/dist/schemas/state.d.ts +23 -0
- package/dist/schemas/state.js +14 -0
- package/dist/schemas/stop-provide.d.ts +0 -5
- package/dist/schemas/stop-provide.js +2 -6
- package/dist/schemas/text-to-speech.d.ts +93 -27
- package/dist/schemas/text-to-speech.js +27 -0
- package/dist/schemas/tools.d.ts +16 -0
- package/dist/schemas/tools.js +15 -0
- package/dist/schemas/transcription-config.d.ts +8 -8
- package/dist/schemas/transcription.d.ts +33 -0
- package/dist/schemas/transcription.js +9 -0
- package/dist/schemas/translate.js +59 -19
- package/dist/schemas/translation-config.d.ts +157 -133
- package/dist/schemas/translation-config.js +34 -11
- package/dist/server/bare/delegate-rpc-client.d.ts +1 -1
- package/dist/server/bare/delegate-rpc-client.js +131 -122
- package/dist/server/bare/hyperswarm.d.ts +2 -2
- package/dist/server/bare/hyperswarm.js +12 -7
- package/dist/server/bare/ops/cancel.js +7 -0
- package/dist/server/bare/ops/kv-cache-utils.d.ts +7 -10
- package/dist/server/bare/ops/kv-cache-utils.js +31 -40
- package/dist/server/bare/ops/load-model.js +0 -1
- package/dist/server/bare/ops/transcribe.d.ts +11 -4
- package/dist/server/bare/ops/transcribe.js +25 -4
- package/dist/server/bare/ops/translate.js +42 -4
- package/dist/server/bare/ops/unload-model.js +21 -19
- package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.js +1 -2
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.d.ts +13 -8
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +257 -85
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.d.ts +101 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.js +135 -0
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +83 -26
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +57 -32
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +10 -16
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +69 -44
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +113 -94
- package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +1 -1
- package/dist/server/bare/plugins/onnx-ocr/plugin.js +1 -2
- package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech-stream.d.ts +7 -0
- package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech-stream.js +116 -0
- package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech.d.ts +2 -3
- package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech.js +71 -9
- package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +41 -13
- package/dist/server/bare/plugins/onnx-tts/plugin.js +48 -3
- package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +15 -7
- package/dist/server/bare/plugins/parakeet-transcription/plugin.js +5 -6
- package/dist/server/bare/plugins/sdcpp-generation/ops/diffusion.js +6 -0
- package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +8 -5
- package/dist/server/bare/plugins/sdcpp-generation/plugin.js +13 -13
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +17 -1
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +40 -17
- package/dist/server/bare/registry/config-registry.js +14 -3
- package/dist/server/bare/registry/model-registry.d.ts +8 -10
- package/dist/server/bare/registry/model-registry.js +17 -12
- package/dist/server/bare/registry/registry-client.js +79 -19
- package/dist/server/bare/runtime-lifecycle.d.ts +2 -1
- package/dist/server/bare/runtime-lifecycle.js +13 -2
- package/dist/server/bare/types/addon-responses.d.ts +8 -3
- package/dist/server/bare/utils/transcribe-metadata.d.ts +21 -0
- package/dist/server/bare/utils/transcribe-metadata.js +28 -0
- package/dist/server/bare/utils/tts-stats.d.ts +22 -0
- package/dist/server/bare/utils/tts-stats.js +10 -0
- package/dist/server/rpc/create-server.d.ts +4 -1
- package/dist/server/rpc/create-server.js +5 -1
- package/dist/server/rpc/delegate-transport.js +36 -29
- package/dist/server/rpc/handle-request.js +28 -3
- package/dist/server/rpc/handler-registry.js +7 -1
- package/dist/server/rpc/handler-utils.d.ts +5 -0
- package/dist/server/rpc/handler-utils.js +22 -0
- package/dist/server/rpc/handlers/cancel-delegated.js +3 -5
- package/dist/server/rpc/handlers/cancelHandler.js +4 -5
- package/dist/server/rpc/handlers/completion-stream-delegated.js +14 -5
- package/dist/server/rpc/handlers/delete-cache.js +8 -3
- package/dist/server/rpc/handlers/download-asset.js +3 -24
- package/dist/server/rpc/handlers/get-loaded-model-info.d.ts +3 -0
- package/dist/server/rpc/handlers/get-loaded-model-info.js +39 -0
- package/dist/server/rpc/handlers/get-model-info.js +93 -84
- package/dist/server/rpc/handlers/heartbeat-delegated.js +2 -2
- package/dist/server/rpc/handlers/index.d.ts +6 -0
- package/dist/server/rpc/handlers/index.js +6 -0
- package/dist/server/rpc/handlers/load-model/download-manager.d.ts +35 -9
- package/dist/server/rpc/handlers/load-model/download-manager.js +142 -38
- package/dist/server/rpc/handlers/load-model/download-stats.d.ts +5 -4
- package/dist/server/rpc/handlers/load-model/download-stats.js +49 -8
- package/dist/server/rpc/handlers/load-model/handler.js +31 -50
- package/dist/server/rpc/handlers/load-model/http.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/http.js +97 -142
- package/dist/server/rpc/handlers/load-model/hyperdrive.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/hyperdrive.js +55 -74
- package/dist/server/rpc/handlers/load-model/index.d.ts +0 -1
- package/dist/server/rpc/handlers/load-model/index.js +0 -1
- package/dist/server/rpc/handlers/load-model/registry-client-options.d.ts +27 -0
- package/dist/server/rpc/handlers/load-model/registry-client-options.js +19 -0
- package/dist/server/rpc/handlers/load-model/registry-companion-set.d.ts +22 -0
- package/dist/server/rpc/handlers/load-model/registry-companion-set.js +208 -0
- package/dist/server/rpc/handlers/load-model/registry-download-utils.d.ts +24 -0
- package/dist/server/rpc/handlers/load-model/registry-download-utils.js +114 -0
- package/dist/server/rpc/handlers/load-model/registry.d.ts +2 -20
- package/dist/server/rpc/handlers/load-model/registry.js +109 -381
- package/dist/server/rpc/handlers/load-model/resolve-session.d.ts +15 -0
- package/dist/server/rpc/handlers/load-model/resolve-session.js +61 -0
- package/dist/server/rpc/handlers/load-model/resolve.d.ts +3 -3
- package/dist/server/rpc/handlers/load-model/resolve.js +14 -23
- package/dist/server/rpc/handlers/load-model/types.d.ts +11 -4
- package/dist/server/rpc/handlers/load-model/types.js +28 -1
- package/dist/server/rpc/handlers/load-model-delegated.js +2 -4
- package/dist/server/rpc/handlers/plugin-dispatch.js +9 -5
- package/dist/server/rpc/handlers/plugin-invoke.js +1 -1
- package/dist/server/rpc/handlers/provideHandler/connection.js +13 -2
- package/dist/server/rpc/handlers/provideHandler/handler.js +42 -29
- package/dist/server/rpc/handlers/state.d.ts +3 -0
- package/dist/server/rpc/handlers/state.js +7 -0
- package/dist/server/rpc/handlers/stopProvideHandler.d.ts +2 -2
- package/dist/server/rpc/handlers/stopProvideHandler.js +12 -7
- package/dist/server/rpc/handlers/text-to-speech-stream.d.ts +3 -0
- package/dist/server/rpc/handlers/text-to-speech-stream.js +4 -0
- package/dist/server/rpc/handlers/unload-model-delegated.js +3 -3
- package/dist/server/rpc/profiling/operation-metrics.js +20 -0
- package/dist/server/rpc/rpc-utils.js +1 -1
- package/dist/server/rpc/transport-selector.d.ts +3 -0
- package/dist/server/rpc/transport-selector.js +18 -0
- package/dist/server/utils/cache/auto-history.d.ts +4 -0
- package/dist/server/utils/cache/auto-history.js +22 -0
- package/dist/server/utils/{cache.d.ts → cache/paths.d.ts} +22 -5
- package/dist/server/utils/{cache.js → cache/paths.js} +36 -20
- package/dist/server/utils/cache/types.d.ts +8 -0
- package/dist/server/utils/cache/types.js +1 -0
- package/dist/server/utils/checksum.d.ts +2 -2
- package/dist/server/utils/checksum.js +1 -1
- package/dist/server/utils/clear-storage.d.ts +5 -0
- package/dist/server/utils/clear-storage.js +17 -0
- package/dist/server/utils/completion-normalizer.d.ts +17 -0
- package/dist/server/utils/completion-normalizer.js +301 -0
- package/dist/server/utils/expand-gguf-shards.d.ts +3 -0
- package/dist/server/utils/expand-gguf-shards.js +22 -0
- package/dist/server/utils/formatting.js +1 -1
- package/dist/server/utils/index.d.ts +4 -2
- package/dist/server/utils/index.js +4 -2
- package/dist/server/utils/qvac-paths.d.ts +2 -0
- package/dist/server/utils/qvac-paths.js +5 -0
- package/dist/server/utils/response-format.d.ts +3 -0
- package/dist/server/utils/response-format.js +20 -0
- package/dist/server/utils/tool-integration.d.ts +15 -4
- package/dist/server/utils/tool-integration.js +21 -41
- package/dist/server/utils/tools/dialect.d.ts +8 -0
- package/dist/server/utils/tools/dialect.js +12 -0
- package/dist/server/utils/tools/index.d.ts +3 -0
- package/dist/server/utils/tools/index.js +2 -0
- package/dist/server/utils/tools/parser.d.ts +6 -0
- package/dist/server/utils/tools/parser.js +40 -0
- package/dist/server/utils/tools/parsers/hermes.d.ts +4 -0
- package/dist/server/utils/tools/parsers/hermes.js +100 -0
- package/dist/server/utils/tools/parsers/json.d.ts +6 -0
- package/dist/server/utils/tools/parsers/json.js +115 -0
- package/dist/server/utils/tools/parsers/pythonic.d.ts +4 -0
- package/dist/server/utils/tools/parsers/pythonic.js +267 -0
- package/dist/server/utils/tools/shared.d.ts +18 -0
- package/dist/server/utils/tools/shared.js +54 -0
- package/dist/server/utils/worker-lock.d.ts +3 -0
- package/dist/server/utils/worker-lock.js +67 -0
- package/dist/server/worker-core.d.ts +16 -1
- package/dist/server/worker-core.js +114 -14
- package/dist/utils/aggregate-events.d.ts +16 -0
- package/dist/utils/aggregate-events.js +52 -0
- package/dist/utils/cache-normalize.d.ts +10 -0
- package/dist/utils/cache-normalize.js +23 -0
- package/dist/utils/encoding.d.ts +8 -0
- package/dist/utils/encoding.js +13 -0
- package/dist/utils/errors-client.d.ts +12 -0
- package/dist/utils/errors-client.js +20 -0
- package/dist/utils/errors-server.d.ts +14 -0
- package/dist/utils/errors-server.js +31 -0
- package/dist/utils/load-model-validation.d.ts +7 -0
- package/dist/utils/load-model-validation.js +18 -0
- package/expo/plugins/patches/android-link.mjs +1 -1
- package/expo/plugins/patches/ios-link.mjs +1 -1
- package/package.json +15 -19
- package/dist/examples/translation/translation-opus.d.ts +0 -2
- package/dist/examples/translation/translation-opus.js +0 -33
- package/dist/server/bare/utils/loader-adapter.d.ts +0 -7
- package/dist/server/bare/utils/loader-adapter.js +0 -9
- package/dist/server/utils/model-path.d.ts +0 -5
- package/dist/server/utils/model-path.js +0 -7
- package/dist/server/utils/tool-parser.d.ts +0 -7
- package/dist/server/utils/tool-parser.js +0 -248
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { toolSchema
|
|
2
|
+
import { toolSchema } from "./tools.js";
|
|
3
|
+
import { completionEventSchema } from "./completion-event.js";
|
|
4
|
+
export { completionStatsSchema } from "./completion-event.js";
|
|
5
|
+
/**
|
|
6
|
+
* Tool-call output dialect. Auto-detected from the model name; pass via
|
|
7
|
+
* `completion({ toolDialect })` to override.
|
|
8
|
+
*
|
|
9
|
+
* Expected raw model output per dialect:
|
|
10
|
+
* - `"hermes"`: `<tool_call>{"name":"get_weather","arguments":{"city":"Tokyo"}}</tool_call>`
|
|
11
|
+
* - `"pythonic"`: `[get_weather(city="Tokyo")]` (optionally `<|tool_call_start|>...<|tool_call_end|>`-wrapped)
|
|
12
|
+
* - `"json"`: `{"name":"get_weather","arguments":{"city":"Tokyo"}}` or `{"tool_calls":[{"name":"...","arguments":{...}}]}`
|
|
13
|
+
*/
|
|
14
|
+
export const toolDialectSchema = z.enum(["hermes", "pythonic", "json"]);
|
|
3
15
|
export const attachmentSchema = z.object({
|
|
4
|
-
path: z
|
|
16
|
+
path: z
|
|
17
|
+
.string()
|
|
18
|
+
.describe("Absolute or SDK-resolvable path to the attachment file (e.g., image for multimodal models)."),
|
|
5
19
|
});
|
|
6
20
|
const kvCacheSchema = z.union([
|
|
7
21
|
z.boolean(),
|
|
@@ -9,46 +23,133 @@ const kvCacheSchema = z.union([
|
|
|
9
23
|
]);
|
|
10
24
|
export const generationParamsSchema = z
|
|
11
25
|
.object({
|
|
12
|
-
temp: z
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
temp: z
|
|
27
|
+
.number()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("Sampling temperature (typically 0–2)."),
|
|
30
|
+
top_p: z
|
|
31
|
+
.number()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe("Top-p (nucleus) sampling cutoff (0–1)."),
|
|
34
|
+
top_k: z
|
|
35
|
+
.number()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe("Top-k sampling — keep only the top K tokens."),
|
|
38
|
+
predict: z
|
|
39
|
+
.number()
|
|
40
|
+
.optional()
|
|
41
|
+
.describe("Max tokens to predict. `-1` = until stop token, `-2` = until context filled."),
|
|
42
|
+
seed: z
|
|
43
|
+
.number()
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("Random seed for reproducibility."),
|
|
46
|
+
frequency_penalty: z
|
|
47
|
+
.number()
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("Penalty applied to tokens based on frequency so far."),
|
|
50
|
+
presence_penalty: z
|
|
51
|
+
.number()
|
|
52
|
+
.optional()
|
|
53
|
+
.describe("Penalty applied to tokens that have already appeared."),
|
|
54
|
+
repeat_penalty: z
|
|
55
|
+
.number()
|
|
56
|
+
.optional()
|
|
57
|
+
.describe("Penalty applied to repeated tokens."),
|
|
20
58
|
})
|
|
21
59
|
.strict();
|
|
60
|
+
const jsonSchemaObjectSchema = z.record(z.string(), z.unknown());
|
|
61
|
+
export const responseFormatSchema = z.discriminatedUnion("type", [
|
|
62
|
+
z.object({ type: z.literal("text") }).strict(),
|
|
63
|
+
z.object({ type: z.literal("json_object") }).strict(),
|
|
64
|
+
z
|
|
65
|
+
.object({
|
|
66
|
+
type: z.literal("json_schema"),
|
|
67
|
+
json_schema: z
|
|
68
|
+
.object({
|
|
69
|
+
name: z.string().min(1).describe("Schema identifier; OpenAI-compatibility only — not used by the addon."),
|
|
70
|
+
description: z
|
|
71
|
+
.string()
|
|
72
|
+
.optional()
|
|
73
|
+
.describe("Free-form schema description. Accepted for OpenAI compatibility only — not forwarded to the addon and does not affect generation."),
|
|
74
|
+
schema: jsonSchemaObjectSchema.describe("JSON Schema the model output must validate against. Forwarded to the addon as-is and converted to GBNF natively by llama.cpp's `json_schema_to_grammar()`."),
|
|
75
|
+
strict: z
|
|
76
|
+
.boolean()
|
|
77
|
+
.optional()
|
|
78
|
+
.describe("Accepted for OpenAI compatibility but does NOT trigger OpenAI's auto-tightening semantics (implicit `additionalProperties: false`, all properties required). The schema is forwarded to the addon verbatim, so callers wanting strict validation must encode it explicitly in `schema`."),
|
|
79
|
+
})
|
|
80
|
+
.strict(),
|
|
81
|
+
})
|
|
82
|
+
.strict(),
|
|
83
|
+
]);
|
|
22
84
|
export const completionParamsSchema = z.object({
|
|
23
|
-
history: z
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
85
|
+
history: z
|
|
86
|
+
.array(z.object({
|
|
87
|
+
role: z
|
|
88
|
+
.string()
|
|
89
|
+
.describe('Message role (e.g., `"user"`, `"assistant"`, `"system"`).'),
|
|
90
|
+
content: z.string().describe("Message content."),
|
|
91
|
+
attachments: z
|
|
92
|
+
.array(attachmentSchema)
|
|
93
|
+
.optional()
|
|
94
|
+
.describe("Optional file attachments for multimodal models."),
|
|
95
|
+
}))
|
|
96
|
+
.describe("Array of conversation messages sent to the model."),
|
|
97
|
+
modelId: z
|
|
98
|
+
.string()
|
|
99
|
+
.describe("The identifier of the model to use for completion."),
|
|
100
|
+
kvCache: kvCacheSchema
|
|
101
|
+
.optional()
|
|
102
|
+
.describe("KV cache configuration — `true` to auto-generate a cache key from history, a string to use a custom key, or `false`/`undefined` to disable."),
|
|
30
103
|
});
|
|
31
|
-
|
|
32
|
-
tools: z
|
|
33
|
-
|
|
104
|
+
const completionClientParamsBaseSchema = completionParamsSchema.extend({
|
|
105
|
+
tools: z
|
|
106
|
+
.array(toolSchema)
|
|
107
|
+
.optional()
|
|
108
|
+
.describe("Optional array of tools (full `Tool` objects or Zod-schema `ToolInput` definitions) the model can call."),
|
|
109
|
+
stream: z
|
|
110
|
+
.boolean()
|
|
111
|
+
.describe("Whether to stream tokens (`true`) or return the complete response once (`false`)."),
|
|
34
112
|
kvCache: kvCacheSchema.optional(),
|
|
35
|
-
generationParams: generationParamsSchema
|
|
113
|
+
generationParams: generationParamsSchema
|
|
114
|
+
.optional()
|
|
115
|
+
.describe("Optional sampling / generation parameters."),
|
|
116
|
+
captureThinking: z
|
|
117
|
+
.boolean()
|
|
118
|
+
.optional()
|
|
119
|
+
.describe("When `true`, capture and emit reasoning/thinking deltas separately from content deltas; requires a model that frames its thinking output."),
|
|
120
|
+
emitRawDeltas: z
|
|
121
|
+
.boolean()
|
|
122
|
+
.optional()
|
|
123
|
+
.describe("When `true`, also emit raw per-token deltas in the event stream in addition to normalized `contentDelta` events."),
|
|
124
|
+
toolDialect: toolDialectSchema
|
|
125
|
+
.optional()
|
|
126
|
+
.describe("Override auto-detected tool-call dialect. Use when the SDK's name-based detection picks the wrong parser chain for your model."),
|
|
127
|
+
responseFormat: responseFormatSchema
|
|
128
|
+
.optional()
|
|
129
|
+
.describe("Optional structured-output constraint: `text` (default, free-form), `json_object` (any valid JSON), or `json_schema` (output conforms to the provided JSON Schema). Mutually exclusive with `tools`."),
|
|
36
130
|
});
|
|
37
|
-
|
|
131
|
+
function refineNoToolsWithStructuredOutput(data, ctx) {
|
|
132
|
+
if (data.responseFormat &&
|
|
133
|
+
data.responseFormat.type !== "text" &&
|
|
134
|
+
data.tools &&
|
|
135
|
+
data.tools.length > 0) {
|
|
136
|
+
ctx.addIssue({
|
|
137
|
+
code: "custom",
|
|
138
|
+
message: "responseFormat (json_object/json_schema) cannot be combined with tools; tools already constrain output via their parameter schema.",
|
|
139
|
+
path: ["responseFormat"],
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
export const completionClientParamsSchema = completionClientParamsBaseSchema.superRefine(refineNoToolsWithStructuredOutput);
|
|
144
|
+
export const completionStreamRequestSchema = completionClientParamsBaseSchema
|
|
145
|
+
.extend({
|
|
38
146
|
type: z.literal("completionStream"),
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
cacheTokens: z.number().optional(),
|
|
44
|
-
backendDevice: z.enum(["cpu", "gpu"]).optional(),
|
|
45
|
-
});
|
|
46
|
-
export const completionStreamResponseSchema = z.object({
|
|
147
|
+
})
|
|
148
|
+
.superRefine(refineNoToolsWithStructuredOutput);
|
|
149
|
+
export const completionStreamResponseSchema = z
|
|
150
|
+
.object({
|
|
47
151
|
type: z.literal("completionStream"),
|
|
48
|
-
token: z.string(),
|
|
49
152
|
done: z.boolean().optional(),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
error: z.string().optional(),
|
|
54
|
-
});
|
|
153
|
+
events: z.array(completionEventSchema),
|
|
154
|
+
})
|
|
155
|
+
.strict();
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const delegateBaseSchema: z.ZodObject<{
|
|
3
|
-
topic: z.ZodString;
|
|
4
3
|
providerPublicKey: z.ZodString;
|
|
5
4
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
6
5
|
healthCheckTimeout: z.ZodOptional<z.ZodNumber>;
|
|
7
6
|
}, z.core.$strip>;
|
|
8
7
|
export declare const delegateSchema: z.ZodOptional<z.ZodObject<{
|
|
9
|
-
topic: z.ZodString;
|
|
10
8
|
providerPublicKey: z.ZodString;
|
|
11
9
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
12
10
|
healthCheckTimeout: z.ZodOptional<z.ZodNumber>;
|
package/dist/schemas/delegate.js
CHANGED
|
@@ -1,13 +1,32 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
const HYPERSWARM_PUBLIC_KEY_HEX = /^[0-9a-fA-F]{64}$/;
|
|
2
3
|
export const delegateBaseSchema = z.object({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
providerPublicKey: z
|
|
5
|
+
.string()
|
|
6
|
+
.regex(HYPERSWARM_PUBLIC_KEY_HEX, "providerPublicKey must be a 64-character hex string (32-byte ed25519 public key)")
|
|
7
|
+
.describe("Hex-encoded public key of the remote provider to delegate to."),
|
|
8
|
+
timeout: z
|
|
9
|
+
.number()
|
|
10
|
+
.min(100)
|
|
11
|
+
.optional()
|
|
12
|
+
.describe("Per-call timeout in milliseconds for the delegated request."),
|
|
13
|
+
healthCheckTimeout: z
|
|
14
|
+
.number()
|
|
15
|
+
.min(100)
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("Timeout in milliseconds for the health-check probe before delegating."),
|
|
7
18
|
});
|
|
8
19
|
export const delegateSchema = delegateBaseSchema
|
|
9
20
|
.extend({
|
|
10
|
-
fallbackToLocal: z
|
|
11
|
-
|
|
21
|
+
fallbackToLocal: z
|
|
22
|
+
.boolean()
|
|
23
|
+
.optional()
|
|
24
|
+
.default(false)
|
|
25
|
+
.describe("When `true`, fall back to local execution if the delegated provider is unreachable."),
|
|
26
|
+
forceNewConnection: z
|
|
27
|
+
.boolean()
|
|
28
|
+
.optional()
|
|
29
|
+
.default(false)
|
|
30
|
+
.describe("When `true`, skip any cached delegation connection and open a fresh one."),
|
|
12
31
|
})
|
|
13
32
|
.optional();
|
|
@@ -13,6 +13,7 @@ export declare const downloadAssetOptionsSchema: z.ZodPipe<z.ZodObject<{
|
|
|
13
13
|
expectedSize: z.ZodOptional<z.ZodNumber>;
|
|
14
14
|
sha256Checksum: z.ZodOptional<z.ZodString>;
|
|
15
15
|
addon: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
16
|
+
embeddings: "embeddings";
|
|
16
17
|
"llamacpp-completion": "llamacpp-completion";
|
|
17
18
|
"whispercpp-transcription": "whispercpp-transcription";
|
|
18
19
|
"llamacpp-embedding": "llamacpp-embedding";
|
|
@@ -23,7 +24,6 @@ export declare const downloadAssetOptionsSchema: z.ZodPipe<z.ZodObject<{
|
|
|
23
24
|
"sdcpp-generation": "sdcpp-generation";
|
|
24
25
|
llm: "llm";
|
|
25
26
|
whisper: "whisper";
|
|
26
|
-
embeddings: "embeddings";
|
|
27
27
|
nmt: "nmt";
|
|
28
28
|
parakeet: "parakeet";
|
|
29
29
|
tts: "tts";
|
|
@@ -45,7 +45,7 @@ export declare const downloadAssetOptionsSchema: z.ZodPipe<z.ZodObject<{
|
|
|
45
45
|
engine?: string | undefined;
|
|
46
46
|
expectedSize?: number | undefined;
|
|
47
47
|
sha256Checksum?: string | undefined;
|
|
48
|
-
addon?: "llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "parakeet-transcription" | "onnx-ocr" | "sdcpp-generation" | "llm" | "whisper" | "
|
|
48
|
+
addon?: "embeddings" | "llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "parakeet-transcription" | "onnx-ocr" | "sdcpp-generation" | "llm" | "whisper" | "nmt" | "parakeet" | "tts" | "ocr" | "diffusion" | "vad" | undefined;
|
|
49
49
|
};
|
|
50
50
|
}, {
|
|
51
51
|
assetSrc: string | {
|
|
@@ -59,7 +59,7 @@ export declare const downloadAssetOptionsSchema: z.ZodPipe<z.ZodObject<{
|
|
|
59
59
|
engine?: string | undefined;
|
|
60
60
|
expectedSize?: number | undefined;
|
|
61
61
|
sha256Checksum?: string | undefined;
|
|
62
|
-
addon?: "llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "parakeet-transcription" | "onnx-ocr" | "sdcpp-generation" | "llm" | "whisper" | "
|
|
62
|
+
addon?: "embeddings" | "llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "parakeet-transcription" | "onnx-ocr" | "sdcpp-generation" | "llm" | "whisper" | "nmt" | "parakeet" | "tts" | "ocr" | "diffusion" | "vad" | undefined;
|
|
63
63
|
};
|
|
64
64
|
seed?: boolean | undefined;
|
|
65
65
|
}>>;
|
|
@@ -76,6 +76,7 @@ export declare const downloadAssetOptionsToRequestSchema: z.ZodPipe<z.ZodObject<
|
|
|
76
76
|
expectedSize: z.ZodOptional<z.ZodNumber>;
|
|
77
77
|
sha256Checksum: z.ZodOptional<z.ZodString>;
|
|
78
78
|
addon: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
79
|
+
embeddings: "embeddings";
|
|
79
80
|
"llamacpp-completion": "llamacpp-completion";
|
|
80
81
|
"whispercpp-transcription": "whispercpp-transcription";
|
|
81
82
|
"llamacpp-embedding": "llamacpp-embedding";
|
|
@@ -86,7 +87,6 @@ export declare const downloadAssetOptionsToRequestSchema: z.ZodPipe<z.ZodObject<
|
|
|
86
87
|
"sdcpp-generation": "sdcpp-generation";
|
|
87
88
|
llm: "llm";
|
|
88
89
|
whisper: "whisper";
|
|
89
|
-
embeddings: "embeddings";
|
|
90
90
|
nmt: "nmt";
|
|
91
91
|
parakeet: "parakeet";
|
|
92
92
|
tts: "tts";
|
|
@@ -114,7 +114,7 @@ export declare const downloadAssetOptionsToRequestSchema: z.ZodPipe<z.ZodObject<
|
|
|
114
114
|
engine?: string | undefined;
|
|
115
115
|
expectedSize?: number | undefined;
|
|
116
116
|
sha256Checksum?: string | undefined;
|
|
117
|
-
addon?: "llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "parakeet-transcription" | "onnx-ocr" | "sdcpp-generation" | "llm" | "whisper" | "
|
|
117
|
+
addon?: "embeddings" | "llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "parakeet-transcription" | "onnx-ocr" | "sdcpp-generation" | "llm" | "whisper" | "nmt" | "parakeet" | "tts" | "ocr" | "diffusion" | "vad" | undefined;
|
|
118
118
|
};
|
|
119
119
|
seed?: boolean | undefined;
|
|
120
120
|
onProgress?: unknown;
|
package/dist/schemas/embed.js
CHANGED
|
@@ -1,28 +1,40 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export const embedParamsSchema = z.object({
|
|
3
|
-
modelId: z.string(),
|
|
4
|
-
text: z
|
|
3
|
+
modelId: z.string().describe("The identifier of the embedding model to use"),
|
|
4
|
+
text: z
|
|
5
|
+
.union([
|
|
5
6
|
z.string().min(1, "Text cannot be empty"),
|
|
6
7
|
z
|
|
7
8
|
.array(z.string().min(1, "Text cannot be empty"))
|
|
8
9
|
.min(1, "Text array cannot be empty"),
|
|
9
|
-
])
|
|
10
|
+
])
|
|
11
|
+
.describe("The input text(s) to embed. A single string returns `number[]`; an array returns `number[][]`."),
|
|
10
12
|
});
|
|
11
13
|
export const embedRequestSchema = embedParamsSchema.extend({
|
|
12
14
|
type: z.literal("embed"),
|
|
13
15
|
});
|
|
14
16
|
export const embedStatsSchema = z.object({
|
|
15
|
-
totalTime: z
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
totalTime: z
|
|
18
|
+
.number()
|
|
19
|
+
.optional()
|
|
20
|
+
.describe("Total embedding time in milliseconds"),
|
|
21
|
+
tokensPerSecond: z
|
|
22
|
+
.number()
|
|
23
|
+
.optional()
|
|
24
|
+
.describe("Tokens processed per second"),
|
|
25
|
+
totalTokens: z.number().optional().describe("Total tokens processed"),
|
|
26
|
+
backendDevice: z
|
|
27
|
+
.enum(["cpu", "gpu"])
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("Compute backend used for inference"),
|
|
19
30
|
});
|
|
20
31
|
export const embedResponseSchema = z.object({
|
|
21
32
|
type: z.literal("embed"),
|
|
22
33
|
success: z.boolean(),
|
|
23
34
|
embedding: z
|
|
24
35
|
.union([z.array(z.number()), z.array(z.array(z.number()))])
|
|
25
|
-
.default([])
|
|
26
|
-
|
|
36
|
+
.default([])
|
|
37
|
+
.describe("The embedding vector(s). Single `number[]` when `text` is a string; `number[][]` when `text` is an array."),
|
|
38
|
+
stats: embedStatsSchema.optional().describe("Performance statistics"),
|
|
27
39
|
error: z.string().optional(),
|
|
28
40
|
});
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { type ModelRegistryEngine, type ModelRegistryEntryAddon } from "./registry";
|
|
2
|
-
export declare const ENGINE_TO_ADDON:
|
|
2
|
+
export declare const ENGINE_TO_ADDON: {
|
|
3
|
+
readonly "llamacpp-completion": "llm";
|
|
4
|
+
readonly "whispercpp-transcription": "whisper";
|
|
5
|
+
readonly "llamacpp-embedding": "embeddings";
|
|
6
|
+
readonly "nmtcpp-translation": "nmt";
|
|
7
|
+
readonly "onnx-tts": "tts";
|
|
8
|
+
readonly "onnx-ocr": "ocr";
|
|
9
|
+
readonly "parakeet-transcription": "parakeet";
|
|
10
|
+
readonly "sdcpp-generation": "diffusion";
|
|
11
|
+
readonly "onnx-vad": "vad";
|
|
12
|
+
};
|
|
3
13
|
export declare function resolveCanonicalEngine(engine: string): ModelRegistryEngine | null;
|
|
4
14
|
export declare function getAddonFromEngine(engine: ModelRegistryEngine): ModelRegistryEntryAddon;
|
|
5
15
|
//# sourceMappingURL=engine-addon-map.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ModelType } from "./model-types.js";
|
|
2
2
|
import { ADDON_DIFFUSION, ADDON_EMBEDDING, ADDON_LLM, ADDON_NMT, ADDON_OCR, ADDON_PARAKEET, ADDON_TTS, ADDON_WHISPER, } from "./plugin.js";
|
|
3
3
|
import { modelRegistryEngineSchema, } from "./registry.js";
|
|
4
|
-
// Canonical engine → addon mapping (exhaustive).
|
|
5
|
-
//
|
|
4
|
+
// Canonical engine → addon mapping (exhaustive). `as const` preserves
|
|
5
|
+
// per-key literals so the addon can be derived from the engine at the type level.
|
|
6
6
|
export const ENGINE_TO_ADDON = {
|
|
7
7
|
[ModelType.llamacppCompletion]: "llm",
|
|
8
8
|
[ModelType.whispercppTranscription]: "whisper",
|
|
@@ -541,10 +541,10 @@ export declare const finetuneStatusSchema: z.ZodEnum<{
|
|
|
541
541
|
}>;
|
|
542
542
|
export declare const finetuneProgressSchema: z.ZodObject<{
|
|
543
543
|
is_train: z.ZodBoolean;
|
|
544
|
-
loss: z.ZodNullable<z.
|
|
545
|
-
loss_uncertainty: z.ZodNullable<z.
|
|
546
|
-
accuracy: z.ZodNullable<z.
|
|
547
|
-
accuracy_uncertainty: z.ZodNullable<z.
|
|
544
|
+
loss: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>;
|
|
545
|
+
loss_uncertainty: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>;
|
|
546
|
+
accuracy: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>;
|
|
547
|
+
accuracy_uncertainty: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>;
|
|
548
548
|
global_steps: z.ZodNumber;
|
|
549
549
|
current_epoch: z.ZodNumber;
|
|
550
550
|
current_batch: z.ZodNumber;
|
|
@@ -554,13 +554,13 @@ export declare const finetuneProgressSchema: z.ZodObject<{
|
|
|
554
554
|
}, z.core.$strict>;
|
|
555
555
|
export declare const finetuneStatsSchema: z.ZodObject<{
|
|
556
556
|
train_loss: z.ZodOptional<z.ZodNumber>;
|
|
557
|
-
train_loss_uncertainty: z.ZodOptional<z.ZodNullable<z.
|
|
557
|
+
train_loss_uncertainty: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>>;
|
|
558
558
|
val_loss: z.ZodOptional<z.ZodNumber>;
|
|
559
|
-
val_loss_uncertainty: z.ZodOptional<z.ZodNullable<z.
|
|
559
|
+
val_loss_uncertainty: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>>;
|
|
560
560
|
train_accuracy: z.ZodOptional<z.ZodNumber>;
|
|
561
|
-
train_accuracy_uncertainty: z.ZodOptional<z.ZodNullable<z.
|
|
561
|
+
train_accuracy_uncertainty: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>>;
|
|
562
562
|
val_accuracy: z.ZodOptional<z.ZodNumber>;
|
|
563
|
-
val_accuracy_uncertainty: z.ZodOptional<z.ZodNullable<z.
|
|
563
|
+
val_accuracy_uncertainty: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>>;
|
|
564
564
|
learning_rate: z.ZodOptional<z.ZodNumber>;
|
|
565
565
|
global_steps: z.ZodNumber;
|
|
566
566
|
epochs_completed: z.ZodNumber;
|
|
@@ -576,13 +576,13 @@ export declare const finetuneResponseSchema: z.ZodObject<{
|
|
|
576
576
|
}>;
|
|
577
577
|
stats: z.ZodOptional<z.ZodObject<{
|
|
578
578
|
train_loss: z.ZodOptional<z.ZodNumber>;
|
|
579
|
-
train_loss_uncertainty: z.ZodOptional<z.ZodNullable<z.
|
|
579
|
+
train_loss_uncertainty: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>>;
|
|
580
580
|
val_loss: z.ZodOptional<z.ZodNumber>;
|
|
581
|
-
val_loss_uncertainty: z.ZodOptional<z.ZodNullable<z.
|
|
581
|
+
val_loss_uncertainty: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>>;
|
|
582
582
|
train_accuracy: z.ZodOptional<z.ZodNumber>;
|
|
583
|
-
train_accuracy_uncertainty: z.ZodOptional<z.ZodNullable<z.
|
|
583
|
+
train_accuracy_uncertainty: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>>;
|
|
584
584
|
val_accuracy: z.ZodOptional<z.ZodNumber>;
|
|
585
|
-
val_accuracy_uncertainty: z.ZodOptional<z.ZodNullable<z.
|
|
585
|
+
val_accuracy_uncertainty: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>>;
|
|
586
586
|
learning_rate: z.ZodOptional<z.ZodNumber>;
|
|
587
587
|
global_steps: z.ZodNumber;
|
|
588
588
|
epochs_completed: z.ZodNumber;
|
|
@@ -590,10 +590,10 @@ export declare const finetuneResponseSchema: z.ZodObject<{
|
|
|
590
590
|
}, z.core.$strict>;
|
|
591
591
|
export declare const finetuneProgressResponseSchema: z.ZodObject<{
|
|
592
592
|
is_train: z.ZodBoolean;
|
|
593
|
-
loss: z.ZodNullable<z.
|
|
594
|
-
loss_uncertainty: z.ZodNullable<z.
|
|
595
|
-
accuracy: z.ZodNullable<z.
|
|
596
|
-
accuracy_uncertainty: z.ZodNullable<z.
|
|
593
|
+
loss: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>;
|
|
594
|
+
loss_uncertainty: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>;
|
|
595
|
+
accuracy: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>;
|
|
596
|
+
accuracy_uncertainty: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodNaN]>>;
|
|
597
597
|
global_steps: z.ZodNumber;
|
|
598
598
|
current_epoch: z.ZodNumber;
|
|
599
599
|
current_batch: z.ZodNumber;
|
package/dist/schemas/finetune.js
CHANGED
|
@@ -119,10 +119,10 @@ export const finetuneStatusSchema = z.enum(finetuneStatusValues);
|
|
|
119
119
|
export const finetuneProgressSchema = z
|
|
120
120
|
.object({
|
|
121
121
|
is_train: z.boolean(),
|
|
122
|
-
loss: z.
|
|
123
|
-
loss_uncertainty: z.
|
|
124
|
-
accuracy: z.
|
|
125
|
-
accuracy_uncertainty: z.
|
|
122
|
+
loss: z.union([z.number(), z.nan()]).nullable(),
|
|
123
|
+
loss_uncertainty: z.union([z.number(), z.nan()]).nullable(),
|
|
124
|
+
accuracy: z.union([z.number(), z.nan()]).nullable(),
|
|
125
|
+
accuracy_uncertainty: z.union([z.number(), z.nan()]).nullable(),
|
|
126
126
|
global_steps: z.number().int().min(0),
|
|
127
127
|
current_epoch: z.number().int().min(0),
|
|
128
128
|
current_batch: z.number().int().min(0),
|
|
@@ -134,13 +134,13 @@ export const finetuneProgressSchema = z
|
|
|
134
134
|
export const finetuneStatsSchema = z
|
|
135
135
|
.object({
|
|
136
136
|
train_loss: z.number().optional(),
|
|
137
|
-
train_loss_uncertainty: z.
|
|
137
|
+
train_loss_uncertainty: z.union([z.number(), z.nan()]).nullable().optional(),
|
|
138
138
|
val_loss: z.number().optional(),
|
|
139
|
-
val_loss_uncertainty: z.
|
|
139
|
+
val_loss_uncertainty: z.union([z.number(), z.nan()]).nullable().optional(),
|
|
140
140
|
train_accuracy: z.number().optional(),
|
|
141
|
-
train_accuracy_uncertainty: z.
|
|
141
|
+
train_accuracy_uncertainty: z.union([z.number(), z.nan()]).nullable().optional(),
|
|
142
142
|
val_accuracy: z.number().optional(),
|
|
143
|
-
val_accuracy_uncertainty: z.
|
|
143
|
+
val_accuracy_uncertainty: z.union([z.number(), z.nan()]).nullable().optional(),
|
|
144
144
|
learning_rate: z.number().optional(),
|
|
145
145
|
global_steps: z.number().int().min(0),
|
|
146
146
|
epochs_completed: z.number().int().min(0),
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const getLoadedModelInfoParamsSchema: z.ZodObject<{
|
|
3
|
+
modelId: z.ZodString;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare const getLoadedModelInfoRequestSchema: z.ZodObject<{
|
|
6
|
+
modelId: z.ZodString;
|
|
7
|
+
type: z.ZodLiteral<"getLoadedModelInfo">;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const loadedModelInfoSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
10
|
+
modelId: z.ZodString;
|
|
11
|
+
isDelegated: z.ZodLiteral<false>;
|
|
12
|
+
modelType: z.ZodString;
|
|
13
|
+
handlers: z.ZodArray<z.ZodString>;
|
|
14
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
15
|
+
addonPackage: z.ZodOptional<z.ZodString>;
|
|
16
|
+
loadedAt: z.ZodCoercedDate<unknown>;
|
|
17
|
+
name: z.ZodOptional<z.ZodString>;
|
|
18
|
+
path: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
+
modelId: z.ZodString;
|
|
21
|
+
isDelegated: z.ZodLiteral<true>;
|
|
22
|
+
handlers: z.ZodArray<z.ZodString>;
|
|
23
|
+
providerInfo: z.ZodObject<{
|
|
24
|
+
providerPublicKey: z.ZodString;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
}, z.core.$strip>], "isDelegated">;
|
|
27
|
+
export declare const getLoadedModelInfoResponseSchema: z.ZodObject<{
|
|
28
|
+
type: z.ZodLiteral<"getLoadedModelInfo">;
|
|
29
|
+
info: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
30
|
+
modelId: z.ZodString;
|
|
31
|
+
isDelegated: z.ZodLiteral<false>;
|
|
32
|
+
modelType: z.ZodString;
|
|
33
|
+
handlers: z.ZodArray<z.ZodString>;
|
|
34
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
35
|
+
addonPackage: z.ZodOptional<z.ZodString>;
|
|
36
|
+
loadedAt: z.ZodCoercedDate<unknown>;
|
|
37
|
+
name: z.ZodOptional<z.ZodString>;
|
|
38
|
+
path: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
40
|
+
modelId: z.ZodString;
|
|
41
|
+
isDelegated: z.ZodLiteral<true>;
|
|
42
|
+
handlers: z.ZodArray<z.ZodString>;
|
|
43
|
+
providerInfo: z.ZodObject<{
|
|
44
|
+
providerPublicKey: z.ZodString;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
}, z.core.$strip>], "isDelegated">;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export type GetLoadedModelInfoParams = z.input<typeof getLoadedModelInfoParamsSchema>;
|
|
49
|
+
export type GetLoadedModelInfoRequest = z.infer<typeof getLoadedModelInfoRequestSchema>;
|
|
50
|
+
export type GetLoadedModelInfoResponse = z.infer<typeof getLoadedModelInfoResponseSchema>;
|
|
51
|
+
export type LoadedModelInfo = z.infer<typeof loadedModelInfoSchema>;
|
|
52
|
+
//# sourceMappingURL=get-loaded-model-info.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const getLoadedModelInfoParamsSchema = z.object({
|
|
3
|
+
modelId: z.string(),
|
|
4
|
+
});
|
|
5
|
+
export const getLoadedModelInfoRequestSchema = getLoadedModelInfoParamsSchema.extend({
|
|
6
|
+
type: z.literal("getLoadedModelInfo"),
|
|
7
|
+
});
|
|
8
|
+
const delegatedProviderInfoSchema = z.object({
|
|
9
|
+
providerPublicKey: z.string(),
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Loaded local model: routing plugin known on this node, so modelType +
|
|
13
|
+
* handler vocabulary are authoritative.
|
|
14
|
+
*/
|
|
15
|
+
const localLoadedModelInfoSchema = z.object({
|
|
16
|
+
modelId: z.string(),
|
|
17
|
+
isDelegated: z.literal(false),
|
|
18
|
+
modelType: z.string(),
|
|
19
|
+
handlers: z.array(z.string()),
|
|
20
|
+
displayName: z.string().optional(),
|
|
21
|
+
addonPackage: z.string().optional(),
|
|
22
|
+
loadedAt: z.coerce.date(),
|
|
23
|
+
name: z.string().optional(),
|
|
24
|
+
path: z.string().optional(),
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Loaded delegated model: this node only stores routing info, so `modelType`,
|
|
28
|
+
* `displayName`, `addonPackage`, `loadedAt`, `name`, and `path` are absent,
|
|
29
|
+
* and `handlers` is always empty.
|
|
30
|
+
*/
|
|
31
|
+
const delegatedLoadedModelInfoSchema = z.object({
|
|
32
|
+
modelId: z.string(),
|
|
33
|
+
isDelegated: z.literal(true),
|
|
34
|
+
handlers: z.array(z.string()),
|
|
35
|
+
providerInfo: delegatedProviderInfoSchema,
|
|
36
|
+
});
|
|
37
|
+
export const loadedModelInfoSchema = z.discriminatedUnion("isDelegated", [
|
|
38
|
+
localLoadedModelInfoSchema,
|
|
39
|
+
delegatedLoadedModelInfoSchema,
|
|
40
|
+
]);
|
|
41
|
+
export const getLoadedModelInfoResponseSchema = z.object({
|
|
42
|
+
type: z.literal("getLoadedModelInfo"),
|
|
43
|
+
info: loadedModelInfoSchema,
|
|
44
|
+
});
|
|
@@ -35,9 +35,9 @@ export declare const modelInfoSchema: z.ZodObject<{
|
|
|
35
35
|
expectedSize: z.ZodNumber;
|
|
36
36
|
sha256Checksum: z.ZodString;
|
|
37
37
|
addon: z.ZodEnum<{
|
|
38
|
+
embeddings: "embeddings";
|
|
38
39
|
llm: "llm";
|
|
39
40
|
whisper: "whisper";
|
|
40
|
-
embeddings: "embeddings";
|
|
41
41
|
nmt: "nmt";
|
|
42
42
|
parakeet: "parakeet";
|
|
43
43
|
tts: "tts";
|
|
@@ -82,9 +82,9 @@ export declare const getModelInfoResponseSchema: z.ZodObject<{
|
|
|
82
82
|
expectedSize: z.ZodNumber;
|
|
83
83
|
sha256Checksum: z.ZodString;
|
|
84
84
|
addon: z.ZodEnum<{
|
|
85
|
+
embeddings: "embeddings";
|
|
85
86
|
llm: "llm";
|
|
86
87
|
whisper: "whisper";
|
|
87
|
-
embeddings: "embeddings";
|
|
88
88
|
nmt: "nmt";
|
|
89
89
|
parakeet: "parakeet";
|
|
90
90
|
tts: "tts";
|