@qvac/sdk 0.11.0 → 0.12.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 +1427 -39
- package/README.md +2 -0
- package/dist/client/api/classify.d.ts +23 -0
- package/dist/client/api/classify.js +43 -0
- package/dist/client/api/get-model-info.d.ts +1 -1
- package/dist/client/api/index.d.ts +4 -0
- package/dist/client/api/index.js +4 -0
- package/dist/client/api/load-model.js +24 -1
- package/dist/client/api/transcribe.d.ts +3 -0
- package/dist/client/api/transcribe.js +13 -2
- package/dist/client/api/video.d.ts +64 -0
- package/dist/client/api/video.js +147 -0
- package/dist/client/api/vla-helpers.d.ts +45 -0
- package/dist/client/api/vla-helpers.js +130 -0
- package/dist/client/api/vla.d.ts +65 -0
- package/dist/client/api/vla.js +109 -0
- package/dist/client/config-loader/resolve-config.node.d.ts +16 -0
- package/dist/client/config-loader/resolve-config.node.js +77 -23
- package/dist/client/plugins-factory.d.ts +8 -0
- package/dist/client/plugins-factory.js +10 -0
- package/dist/client/rpc/bare-client.js +62 -66
- package/dist/client/rpc/ensure-worker-ready.d.ts +9 -0
- package/dist/client/rpc/ensure-worker-ready.js +17 -0
- package/dist/client/rpc/node-rpc-client.js +4 -1
- package/dist/client/rpc/rpc-error.js +14 -1
- package/dist/commands/bundle/bare-pack.d.ts +13 -0
- package/dist/commands/bundle/bare-pack.js +54 -0
- package/dist/commands/bundle/constants.d.ts +7 -0
- package/dist/commands/bundle/constants.js +23 -0
- package/dist/commands/bundle/entry-gen.d.ts +2 -0
- package/dist/commands/bundle/entry-gen.js +48 -0
- package/dist/commands/bundle/index.d.ts +20 -0
- package/dist/commands/bundle/index.js +141 -0
- package/dist/commands/bundle/manifest.d.ts +21 -0
- package/dist/commands/bundle/manifest.js +193 -0
- package/dist/commands/bundle/plugins.d.ts +9 -0
- package/dist/commands/bundle/plugins.js +51 -0
- package/dist/commands/index.d.ts +5 -0
- package/dist/commands/index.js +2 -0
- package/dist/commands/verify/abi.d.ts +52 -0
- package/dist/commands/verify/abi.js +125 -0
- package/dist/commands/verify/addon-source.d.ts +43 -0
- package/dist/commands/verify/addon-source.js +75 -0
- package/dist/commands/verify/bundle-source.d.ts +12 -0
- package/dist/commands/verify/bundle-source.js +53 -0
- package/dist/commands/verify/index.d.ts +59 -0
- package/dist/commands/verify/index.js +371 -0
- package/dist/commands/verify/node-modules-source.d.ts +11 -0
- package/dist/commands/verify/node-modules-source.js +76 -0
- package/dist/commands/verify/prebuilds.d.ts +15 -0
- package/dist/commands/verify/prebuilds.js +39 -0
- package/dist/examples/classification/classify-image.d.ts +2 -0
- package/dist/examples/classification/classify-image.js +23 -0
- package/dist/examples/diffusion-txt2vid.d.ts +2 -0
- package/dist/examples/diffusion-txt2vid.js +81 -0
- package/dist/examples/plugins.js +3 -7
- package/dist/examples/tools/llamacpp-tools-gemma4.js +2 -5
- package/dist/examples/tools/llamacpp-tools-qwen35.js +2 -3
- package/dist/examples/transcription/parakeet-ctc-filesystem.js +18 -12
- package/dist/examples/transcription/parakeet-microphone-record.js +7 -12
- package/dist/examples/transcription/parakeet-microphone-stream.d.ts +2 -0
- package/dist/examples/transcription/parakeet-microphone-stream.js +79 -0
- package/dist/examples/transcription/parakeet-sortformer-streaming.d.ts +2 -0
- package/dist/examples/transcription/parakeet-sortformer-streaming.js +121 -0
- package/dist/examples/transcription/parakeet-sortformer.js +58 -55
- package/dist/examples/transcription/parakeet-tdt-filesystem.js +18 -15
- package/dist/examples/transcription/whispercpp-microphone-conversation.js +6 -1
- package/dist/examples/tts/chatterbox.js +7 -16
- package/dist/examples/tts/llm-to-tts-streaming.js +3 -10
- package/dist/examples/tts/supertonic-multilingual.js +4 -12
- package/dist/examples/tts/supertonic.js +5 -12
- package/dist/examples/vla-smolvla.d.ts +2 -0
- package/dist/examples/vla-smolvla.js +75 -0
- package/dist/examples/voice-assistant/voice-assistant.js +3 -10
- package/dist/expo/plugins/find-in-ancestor-node-modules.d.ts +14 -0
- package/dist/expo/plugins/find-in-ancestor-node-modules.js +24 -0
- package/dist/expo/plugins/get-project-root.d.ts +22 -0
- package/dist/expo/plugins/get-project-root.js +23 -0
- package/dist/expo/plugins/index.d.ts +4 -0
- package/dist/expo/plugins/index.js +4 -0
- package/dist/expo/plugins/resolve-sdk-package-dir.d.ts +9 -2
- package/dist/expo/plugins/resolve-sdk-package-dir.js +38 -11
- package/dist/expo/plugins/withDeviceInfo.js +2 -1
- package/dist/expo/plugins/withMobileBundle.d.ts +2 -17
- package/dist/expo/plugins/withMobileBundle.js +31 -85
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -3
- package/dist/models/registry/models.d.ts +3711 -368
- package/dist/models/registry/models.js +7066 -3562
- package/dist/models/update-models/naming.js +22 -8
- package/dist/pear/pre.js +6 -2
- package/dist/schemas/cancel.d.ts +5 -0
- package/dist/schemas/cancel.js +1 -0
- package/dist/schemas/classification.d.ts +53 -0
- package/dist/schemas/classification.js +33 -0
- package/dist/schemas/common.d.ts +1001 -1739
- package/dist/schemas/common.js +6 -1
- package/dist/schemas/completion-event.d.ts +3 -0
- package/dist/schemas/completion-event.js +1 -0
- package/dist/schemas/completion-stream.d.ts +1 -0
- package/dist/schemas/download-asset.d.ts +13 -3
- package/dist/schemas/engine-addon-map.d.ts +3 -0
- package/dist/schemas/engine-addon-map.js +18 -5
- package/dist/schemas/get-model-info.d.ts +4 -0
- package/dist/schemas/get-model-info.js +2 -0
- package/dist/schemas/index.d.ts +3 -0
- package/dist/schemas/index.js +3 -0
- package/dist/schemas/llamacpp-config.d.ts +12 -2
- package/dist/schemas/load-model.d.ts +6152 -10764
- package/dist/schemas/load-model.js +75 -7
- package/dist/schemas/model-src-utils.d.ts +22 -2
- package/dist/schemas/model-types.d.ts +46 -6
- package/dist/schemas/model-types.js +28 -5
- package/dist/schemas/ocr.d.ts +5 -0
- package/dist/schemas/plugin.d.ts +20 -5
- package/dist/schemas/plugin.js +21 -4
- package/dist/schemas/registry.d.ts +44 -0
- package/dist/schemas/registry.js +5 -0
- package/dist/schemas/reload-config.d.ts +22 -2
- package/dist/schemas/sdcpp-config.d.ts +316 -1
- package/dist/schemas/sdcpp-config.js +232 -33
- package/dist/schemas/sdk-config.d.ts +654 -1324
- package/dist/schemas/sdk-config.js +16 -1
- package/dist/schemas/sdk-errors-client.d.ts +5 -0
- package/dist/schemas/sdk-errors-client.js +26 -1
- package/dist/schemas/sdk-errors-server.d.ts +3 -1
- package/dist/schemas/sdk-errors-server.js +20 -5
- package/dist/schemas/text-to-speech.d.ts +79 -696
- package/dist/schemas/text-to-speech.js +46 -19
- package/dist/schemas/transcription-config.d.ts +37 -226
- package/dist/schemas/transcription-config.js +76 -15
- package/dist/schemas/transcription.d.ts +63 -11
- package/dist/schemas/transcription.js +56 -2
- package/dist/schemas/translation-config.d.ts +60 -10
- package/dist/schemas/vla.d.ts +87 -0
- package/dist/schemas/vla.js +108 -0
- package/dist/scripts/run-unit-tests.js +8 -2
- package/dist/server/bare/ops/transcribe.d.ts +2 -1
- package/dist/server/bare/ops/transcribe.js +59 -34
- package/dist/server/bare/plugins/ggml-classification/ops/classify.d.ts +6 -0
- package/dist/server/bare/plugins/ggml-classification/ops/classify.js +30 -0
- package/dist/server/bare/plugins/ggml-classification/plugin.d.ts +32 -0
- package/dist/server/bare/plugins/ggml-classification/plugin.js +55 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-hparams.d.ts +3 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-hparams.js +12 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-run.d.ts +3 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-run.js +75 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.d.ts +54 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.js +57 -0
- package/dist/server/bare/plugins/index.d.ts +3 -1
- package/dist/server/bare/plugins/index.js +3 -1
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +3 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/context-overflow.d.ts +29 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/context-overflow.js +65 -0
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +6 -0
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +26 -0
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +25 -0
- package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +5 -0
- package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +67 -246
- package/dist/server/bare/plugins/parakeet-transcription/plugin.js +66 -97
- package/dist/server/bare/plugins/sdcpp-generation/ops/video.d.ts +3 -0
- package/dist/server/bare/plugins/sdcpp-generation/ops/video.js +199 -0
- package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +200 -2
- package/dist/server/bare/plugins/sdcpp-generation/plugin.js +61 -8
- package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech-stream.js +2 -15
- package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech.js +2 -1
- package/dist/server/bare/plugins/tts-ggml/plugin.d.ts +75 -0
- package/dist/server/bare/plugins/tts-ggml/plugin.js +189 -0
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +29 -4
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +12 -1
- package/dist/server/bare/registry/model-config-utils.js +7 -0
- package/dist/server/bare/runtime/request-context.d.ts +1 -1
- package/dist/server/bare/runtime-lifecycle.js +9 -9
- package/dist/server/bare/types/addon-responses.d.ts +1 -0
- package/dist/server/env.js +4 -1
- package/dist/server/plugins/index.d.ts +1 -1
- package/dist/server/plugins/index.js +1 -1
- package/dist/server/plugins/registry.d.ts +1 -0
- package/dist/server/plugins/registry.js +5 -0
- package/dist/server/rpc/handler-registry.js +4 -0
- package/dist/server/rpc/handler-selection.d.ts +9 -0
- package/dist/server/rpc/handler-selection.js +14 -0
- package/dist/server/rpc/handler-utils.js +5 -13
- package/dist/server/rpc/handlers/classify.d.ts +3 -0
- package/dist/server/rpc/handlers/classify.js +4 -0
- package/dist/server/rpc/handlers/index.d.ts +2 -0
- package/dist/server/rpc/handlers/index.js +2 -0
- package/dist/server/rpc/handlers/load-model/handler.js +4 -1
- package/dist/server/rpc/handlers/load-model/resolve.js +9 -0
- package/dist/server/rpc/handlers/video-stream.d.ts +3 -0
- package/dist/server/rpc/handlers/video-stream.js +4 -0
- package/dist/server/rpc/profiling/operation-metrics.js +23 -0
- package/dist/server/utils/config-transform.js +1 -1
- package/dist/server/worker.js +14 -11
- package/dist/utils/errors-client.d.ts +15 -0
- package/dist/utils/errors-client.js +26 -0
- package/dist/utils/errors-server.d.ts +30 -2
- package/dist/utils/errors-server.js +51 -3
- package/package.json +66 -80
- package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +0 -490
- package/dist/server/bare/plugins/onnx-tts/plugin.js +0 -272
- package/dist/server/bare/plugins/onnx-tts/wav-helper.d.ts +0 -14
- package/dist/server/bare/plugins/onnx-tts/wav-helper.js +0 -107
- /package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech-stream.d.ts +0 -0
- /package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech.d.ts +0 -0
|
@@ -317,21 +317,35 @@ function generateDiffusionName({ filename, modelName, quantization, params, tags
|
|
|
317
317
|
}
|
|
318
318
|
function generateParakeetName({ filename, lowerPath, quantization, }) {
|
|
319
319
|
const lower = filename.toLowerCase();
|
|
320
|
-
// Detect model variant from registry path
|
|
321
320
|
let variant = "";
|
|
322
|
-
if (
|
|
323
|
-
variant = "
|
|
321
|
+
if (lower.includes("sortformer") || lower.includes("diar_streaming")) {
|
|
322
|
+
variant = "SORTFORMER";
|
|
324
323
|
}
|
|
325
|
-
else if (lowerPath.includes("parakeet-ctc")) {
|
|
324
|
+
else if (lower.includes("ctc") || lowerPath.includes("parakeet-ctc")) {
|
|
326
325
|
variant = "CTC";
|
|
327
326
|
}
|
|
328
|
-
else if (
|
|
327
|
+
else if (lower.includes("eou") || lowerPath.includes("parakeet-rs")) {
|
|
329
328
|
variant = "EOU";
|
|
330
329
|
}
|
|
331
|
-
else if (lowerPath.includes("
|
|
332
|
-
variant = "
|
|
330
|
+
else if (lower.includes("tdt") || lowerPath.includes("parakeet-tdt")) {
|
|
331
|
+
variant = "TDT";
|
|
332
|
+
}
|
|
333
|
+
if (lower.endsWith(".gguf")) {
|
|
334
|
+
const paramsMatch = filename.match(/(?:^|[-_])(\d+(?:\.\d+)?[mb])(?=[-_.])/i);
|
|
335
|
+
const versionMatch = filename.match(/[-_]v(\d+(?:\.\d+)?)/i);
|
|
336
|
+
const speakerMatch = filename.match(/(\d+spk)/i);
|
|
337
|
+
const paramsHint = paramsMatch ? paramsMatch[1] : "";
|
|
338
|
+
const versionHint = versionMatch ? `V${versionMatch[1]}` : "";
|
|
339
|
+
const speakerHint = speakerMatch ? speakerMatch[1] : "";
|
|
340
|
+
const nameParts = [
|
|
341
|
+
variant,
|
|
342
|
+
paramsHint,
|
|
343
|
+
speakerHint,
|
|
344
|
+
versionHint,
|
|
345
|
+
quantization,
|
|
346
|
+
].filter((p) => p && p !== "");
|
|
347
|
+
return `PARAKEET_${nameParts.map(cleanPart).join("_")}`;
|
|
333
348
|
}
|
|
334
|
-
// Detect file role from filename
|
|
335
349
|
let fileRole = "";
|
|
336
350
|
if (lower.includes("encoder") && (lower.endsWith(".data") || lower.endsWith(".onnx.data"))) {
|
|
337
351
|
fileRole = "ENCODER_DATA";
|
package/dist/pear/pre.js
CHANGED
|
@@ -32,18 +32,22 @@ const BUILTIN_PLUGINS = [
|
|
|
32
32
|
"@qvac/sdk/llamacpp-embedding/plugin",
|
|
33
33
|
"@qvac/sdk/whispercpp-transcription/plugin",
|
|
34
34
|
"@qvac/sdk/nmtcpp-translation/plugin",
|
|
35
|
-
"@qvac/sdk/
|
|
35
|
+
"@qvac/sdk/tts-ggml/plugin",
|
|
36
36
|
"@qvac/sdk/onnx-ocr/plugin",
|
|
37
37
|
"@qvac/sdk/sdcpp-generation/plugin",
|
|
38
|
+
"@qvac/sdk/ggml-vla/plugin",
|
|
39
|
+
"@qvac/sdk/ggml-classification/plugin",
|
|
38
40
|
];
|
|
39
41
|
const BUILTIN_PLUGIN_EXPORTS = {
|
|
40
42
|
"llamacpp-completion": "llmPlugin",
|
|
41
43
|
"llamacpp-embedding": "embeddingsPlugin",
|
|
42
44
|
"whispercpp-transcription": "whisperPlugin",
|
|
43
45
|
"nmtcpp-translation": "nmtPlugin",
|
|
44
|
-
"
|
|
46
|
+
"tts-ggml": "ttsPlugin",
|
|
45
47
|
"onnx-ocr": "ocrPlugin",
|
|
46
48
|
"sdcpp-generation": "diffusionPlugin",
|
|
49
|
+
"ggml-vla": "vlaPlugin",
|
|
50
|
+
"ggml-classification": "classificationPlugin",
|
|
47
51
|
};
|
|
48
52
|
const SDK_NAME = "@qvac/sdk";
|
|
49
53
|
const DEFAULT_PEAR_WORKER = "worker.js";
|
package/dist/schemas/cancel.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ declare const cancelKindSchema: z.ZodEnum<{
|
|
|
23
23
|
diffusion: "diffusion";
|
|
24
24
|
tts: "tts";
|
|
25
25
|
ocr: "ocr";
|
|
26
|
+
vla: "vla";
|
|
26
27
|
finetune: "finetune";
|
|
27
28
|
loadModel: "loadModel";
|
|
28
29
|
downloadAsset: "downloadAsset";
|
|
@@ -74,6 +75,7 @@ declare const cancelBroadParamsSchema: z.ZodObject<{
|
|
|
74
75
|
diffusion: "diffusion";
|
|
75
76
|
tts: "tts";
|
|
76
77
|
ocr: "ocr";
|
|
78
|
+
vla: "vla";
|
|
77
79
|
finetune: "finetune";
|
|
78
80
|
loadModel: "loadModel";
|
|
79
81
|
downloadAsset: "downloadAsset";
|
|
@@ -95,6 +97,7 @@ declare const cancelParamsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
95
97
|
diffusion: "diffusion";
|
|
96
98
|
tts: "tts";
|
|
97
99
|
ocr: "ocr";
|
|
100
|
+
vla: "vla";
|
|
98
101
|
finetune: "finetune";
|
|
99
102
|
loadModel: "loadModel";
|
|
100
103
|
downloadAsset: "downloadAsset";
|
|
@@ -118,6 +121,7 @@ export declare const cancelRequestSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
118
121
|
diffusion: "diffusion";
|
|
119
122
|
tts: "tts";
|
|
120
123
|
ocr: "ocr";
|
|
124
|
+
vla: "vla";
|
|
121
125
|
finetune: "finetune";
|
|
122
126
|
loadModel: "loadModel";
|
|
123
127
|
downloadAsset: "downloadAsset";
|
|
@@ -154,6 +158,7 @@ export declare const cancelBroadSugarSchema: z.ZodObject<{
|
|
|
154
158
|
diffusion: "diffusion";
|
|
155
159
|
tts: "tts";
|
|
156
160
|
ocr: "ocr";
|
|
161
|
+
vla: "vla";
|
|
157
162
|
finetune: "finetune";
|
|
158
163
|
loadModel: "loadModel";
|
|
159
164
|
downloadAsset: "downloadAsset";
|
package/dist/schemas/cancel.js
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const classificationConfigSchema: z.ZodObject<{
|
|
3
|
+
modelPath: z.ZodOptional<z.ZodString>;
|
|
4
|
+
topK: z.ZodOptional<z.ZodNumber>;
|
|
5
|
+
nativeLogger: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export declare const classifyParamsSchema: z.ZodObject<{
|
|
8
|
+
modelId: z.ZodString;
|
|
9
|
+
image: z.ZodString;
|
|
10
|
+
topK: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
channels: z.ZodOptional<z.ZodLiteral<3>>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare const classifyRequestSchema: z.ZodObject<{
|
|
16
|
+
modelId: z.ZodString;
|
|
17
|
+
image: z.ZodString;
|
|
18
|
+
topK: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
channels: z.ZodOptional<z.ZodLiteral<3>>;
|
|
22
|
+
type: z.ZodLiteral<"classify">;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const classificationResultSchema: z.ZodObject<{
|
|
25
|
+
label: z.ZodString;
|
|
26
|
+
confidence: z.ZodNumber;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export declare const classifyResponseSchema: z.ZodObject<{
|
|
29
|
+
type: z.ZodLiteral<"classify">;
|
|
30
|
+
results: z.ZodArray<z.ZodObject<{
|
|
31
|
+
label: z.ZodString;
|
|
32
|
+
confidence: z.ZodNumber;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
done: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type ClassificationConfig = z.infer<typeof classificationConfigSchema>;
|
|
37
|
+
export type ClassifyParams = z.infer<typeof classifyParamsSchema>;
|
|
38
|
+
export type ClassifyRequest = z.infer<typeof classifyRequestSchema>;
|
|
39
|
+
export type ClassificationResult = z.infer<typeof classificationResultSchema>;
|
|
40
|
+
export type ClassifyResponse = z.infer<typeof classifyResponseSchema>;
|
|
41
|
+
export interface ClassifyClientParams {
|
|
42
|
+
modelId: string;
|
|
43
|
+
/** JPEG or PNG buffer. */
|
|
44
|
+
image: Uint8Array;
|
|
45
|
+
topK?: number;
|
|
46
|
+
/** Raw RGB image width (required for raw bytes). */
|
|
47
|
+
width?: number;
|
|
48
|
+
/** Raw RGB image height (required for raw bytes). */
|
|
49
|
+
height?: number;
|
|
50
|
+
/** Channel count — must be 3 for raw RGB. */
|
|
51
|
+
channels?: 3;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=classification.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const classificationConfigSchema = z.object({
|
|
3
|
+
/** Absolute path to the GGUF weights file. Defaults to the bundled model inside @qvac/classification-ggml. */
|
|
4
|
+
modelPath: z.string().optional(),
|
|
5
|
+
/** Limit returned results to the top-K classes. Default: all classes. */
|
|
6
|
+
topK: z.number().int().optional(),
|
|
7
|
+
/** Forward native C++ log lines through the SDK logger. Off by default. */
|
|
8
|
+
nativeLogger: z.boolean().optional(),
|
|
9
|
+
});
|
|
10
|
+
export const classifyParamsSchema = z.object({
|
|
11
|
+
modelId: z.string(),
|
|
12
|
+
/** JPEG or PNG buffer encoded as base64, or raw RGB bytes. */
|
|
13
|
+
image: z.string(),
|
|
14
|
+
topK: z.number().int().optional(),
|
|
15
|
+
/** Raw RGB image width (required for raw bytes). */
|
|
16
|
+
width: z.number().int().optional(),
|
|
17
|
+
/** Raw RGB image height (required for raw bytes). */
|
|
18
|
+
height: z.number().int().optional(),
|
|
19
|
+
/** Channel count — must be 3 for raw RGB. */
|
|
20
|
+
channels: z.literal(3).optional(),
|
|
21
|
+
});
|
|
22
|
+
export const classifyRequestSchema = classifyParamsSchema.extend({
|
|
23
|
+
type: z.literal("classify"),
|
|
24
|
+
});
|
|
25
|
+
export const classificationResultSchema = z.object({
|
|
26
|
+
label: z.string(),
|
|
27
|
+
confidence: z.number(),
|
|
28
|
+
});
|
|
29
|
+
export const classifyResponseSchema = z.object({
|
|
30
|
+
type: z.literal("classify"),
|
|
31
|
+
results: z.array(classificationResultSchema),
|
|
32
|
+
done: z.boolean().optional(),
|
|
33
|
+
});
|