@qvac/sdk 0.13.5 → 0.14.1
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 +95 -1151
- package/README.md +1 -2
- package/bare-imports.json +0 -5
- package/dist/client/api/bci-transcribe.js +2 -1
- package/dist/client/api/download-asset.js +2 -1
- package/dist/client/api/finetune.js +6 -5
- package/dist/client/api/index.d.ts +1 -0
- package/dist/client/api/index.js +1 -0
- package/dist/client/api/load-model.d.ts +11 -8
- package/dist/client/api/load-model.js +6 -6
- package/dist/client/api/subscribe-logs.d.ts +28 -0
- package/dist/client/api/subscribe-logs.js +43 -0
- package/dist/client/api/text-to-speech.js +2 -1
- package/dist/client/config-loader/config-utils.js +2 -4
- package/dist/client/config-loader/resolve-config.bare.js +4 -3
- package/dist/client/parse-input.d.ts +3 -0
- package/dist/client/parse-input.js +14 -0
- package/dist/client/rpc/expo-rpc-client.js +2 -11
- package/dist/client/rpc/node-rpc-client.js +8 -2
- package/dist/client/rpc/rpc-client.js +39 -7
- package/dist/commands/bundle/constants.js +2 -1
- package/dist/commands/bundle/entry-gen.d.ts +1 -1
- package/dist/commands/bundle/entry-gen.js +6 -6
- package/dist/commands/bundle/index.js +3 -1
- package/dist/commands/bundle/resolve-sdk-import.d.ts +6 -0
- package/dist/commands/bundle/resolve-sdk-import.js +60 -0
- package/dist/examples/bci/bci-filesystem-streaming.js +14 -14
- package/dist/examples/bci/bci-filesystem.js +17 -13
- package/dist/examples/cache-management.js +38 -38
- package/dist/examples/cancel-by-request-id.js +9 -9
- package/dist/examples/completion-events.js +20 -14
- package/dist/examples/completion-stop-reason.js +13 -7
- package/dist/examples/concurrent-completion-collision.js +7 -7
- package/dist/examples/config-reload.js +7 -8
- package/dist/examples/default-config-usage.js +4 -4
- package/dist/examples/delegated-inference/composite.js +14 -10
- package/dist/examples/delegated-inference/consumer-profiled.js +13 -13
- package/dist/examples/delegated-inference/consumer.js +16 -12
- package/dist/examples/delegated-inference/provider.js +12 -12
- package/dist/examples/diffusion-esrgan-upscale.js +19 -15
- package/dist/examples/diffusion-flux2-klein-img2img.js +16 -11
- package/dist/examples/diffusion-flux2-klein.js +14 -9
- package/dist/examples/diffusion-img2img.js +9 -10
- package/dist/examples/diffusion-img2vid.js +17 -12
- package/dist/examples/diffusion-simple.js +1 -1
- package/dist/examples/diffusion-txt2img.js +14 -9
- package/dist/examples/diffusion-txt2vid.js +15 -10
- package/dist/examples/download-with-blind-relays.js +16 -21
- package/dist/examples/download-with-cancel.js +15 -16
- package/dist/examples/embed-multi-gpu.js +3 -4
- package/dist/examples/embed-p2p.js +11 -7
- package/dist/examples/finetune/llamacpp-finetune.js +7 -7
- package/dist/examples/kv-cache-cleanup.js +35 -35
- package/dist/examples/kv-cache-custom-key.js +24 -24
- package/dist/examples/kv-cache-example.js +9 -9
- package/dist/examples/llamacpp-cache.js +18 -14
- package/dist/examples/llamacpp-dynamic-tools.js +15 -9
- package/dist/examples/llamacpp-filesystem.js +15 -9
- package/dist/examples/llamacpp-http.js +12 -10
- package/dist/examples/llamacpp-multi-gpu.js +4 -4
- package/dist/examples/llamacpp-multimodal.js +13 -9
- package/dist/examples/llamacpp-p2p.js +8 -4
- package/dist/examples/llamacpp-sharded.js +5 -5
- package/dist/examples/llamacpp-structured-output.js +15 -9
- package/dist/examples/logging-file-transport.js +3 -3
- package/dist/examples/logging-global.d.ts +2 -0
- package/dist/examples/logging-global.js +34 -0
- package/dist/examples/logging-streaming.js +7 -10
- package/dist/examples/mcp-websearch.js +24 -18
- package/dist/examples/multi-model-demo.js +17 -11
- package/dist/examples/ocr-fasttext.js +14 -16
- package/dist/examples/parallel-download.js +7 -7
- package/dist/examples/plugins.js +40 -28
- package/dist/examples/profiling/basic.js +16 -10
- package/dist/examples/profiling/per-call.js +17 -11
- package/dist/examples/quickstart.bare.d.ts +2 -0
- package/dist/examples/quickstart.bare.js +18 -0
- package/dist/examples/quickstart.js +10 -3
- package/dist/examples/rag/rag-chromadb.js +18 -14
- package/dist/examples/rag/rag-hyperdb/cancellation.js +17 -14
- package/dist/examples/rag/rag-hyperdb/ingest.js +14 -12
- package/dist/examples/rag/rag-hyperdb/pipeline.js +19 -17
- package/dist/examples/rag/rag-hyperdb/workspaces.js +31 -27
- package/dist/examples/rag/rag-lancedb.js +12 -8
- package/dist/examples/rag/rag-sqlite.js +11 -7
- package/dist/examples/registry-query.js +17 -17
- package/dist/examples/seed-p2p.js +10 -6
- package/dist/examples/suspend-resume.js +20 -16
- package/dist/examples/tools/llamacpp-native-tools.js +24 -18
- package/dist/examples/tools/llamacpp-tools-gemma4.js +14 -8
- package/dist/examples/tools/llamacpp-tools-harmony-multiturn.js +20 -14
- package/dist/examples/tools/llamacpp-tools-pythonic.js +14 -8
- package/dist/examples/tools/llamacpp-tools-qwen35.js +14 -8
- package/dist/examples/transcription/parakeet-ctc-filesystem.js +12 -9
- package/dist/examples/transcription/parakeet-microphone-record.js +15 -9
- package/dist/examples/transcription/parakeet-microphone-stream.js +15 -9
- package/dist/examples/transcription/parakeet-sortformer-streaming.js +12 -6
- package/dist/examples/transcription/parakeet-sortformer.js +3 -5
- package/dist/examples/transcription/parakeet-tdt-filesystem.js +13 -10
- package/dist/examples/transcription/whispercpp-filesystem-streaming.js +16 -17
- package/dist/examples/transcription/whispercpp-filesystem.js +14 -10
- package/dist/examples/transcription/whispercpp-microphone-conversation.js +10 -10
- package/dist/examples/transcription/whispercpp-microphone-record.js +6 -6
- package/dist/examples/transcription/whispercpp-prompt.js +14 -10
- package/dist/examples/translation/translation-bergamot-batch.js +11 -7
- package/dist/examples/translation/translation-bergamot-pivot.js +13 -9
- package/dist/examples/translation/translation-bergamot.js +8 -4
- package/dist/examples/translation/translation-indic.js +8 -4
- package/dist/examples/translation/translation-llm-afriquegemma.js +7 -3
- package/dist/examples/translation/translation-llm-context.js +8 -4
- package/dist/examples/translation/translation-llm.js +7 -3
- package/dist/examples/translation/translation-stream.js +4 -4
- package/dist/examples/tts/chatterbox.js +19 -11
- package/dist/examples/tts/llm-to-tts-streaming.js +27 -14
- package/dist/examples/tts/supertonic-multilingual.js +18 -14
- package/dist/examples/tts/supertonic.js +19 -15
- package/dist/examples/tts/utils.js +1 -1
- package/dist/examples/vla-pi05.js +18 -14
- package/dist/examples/vla-smolvla.js +18 -14
- package/dist/examples/voice-assistant/voice-assistant.js +12 -12
- package/dist/index.d.ts +3 -4
- package/dist/index.js +3 -4
- package/dist/logging/client-logger.js +2 -1
- package/dist/logging/index.d.ts +1 -1
- package/dist/logging/index.js +1 -1
- package/dist/logging/namespaces.d.ts +1 -0
- package/dist/logging/namespaces.js +2 -0
- package/dist/logging/server-logger.js +1 -4
- package/dist/logging/utils.js +6 -1
- package/dist/models/registry/index.d.ts +17 -0
- package/dist/models/registry/index.js +20 -1
- package/dist/models/registry/models.d.ts +1062 -38
- package/dist/models/registry/models.js +3546 -2490
- package/dist/pear/pre.js +2 -2
- package/dist/schemas/bci-config.d.ts +37 -0
- package/dist/schemas/bci-config.js +2 -0
- package/dist/schemas/bci.d.ts +2 -0
- package/dist/schemas/common.d.ts +171 -94
- package/dist/schemas/completion-stream.d.ts +6 -3
- package/dist/schemas/completion-stream.js +10 -2
- package/dist/schemas/download-asset.d.ts +5 -5
- package/dist/schemas/engine-addon-map.d.ts +1 -1
- package/dist/schemas/engine-addon-map.js +6 -3
- package/dist/schemas/error.js +6 -1
- package/dist/schemas/llamacpp-config.d.ts +27 -8
- package/dist/schemas/llamacpp-config.js +19 -2
- package/dist/schemas/load-model.d.ts +4170 -570
- package/dist/schemas/load-model.js +85 -26
- package/dist/schemas/logging-stream.js +7 -1
- package/dist/schemas/model-src-utils.d.ts +6 -6
- package/dist/schemas/model-types.d.ts +14 -15
- package/dist/schemas/model-types.js +10 -11
- package/dist/schemas/ocr.d.ts +10 -8
- package/dist/schemas/ocr.js +8 -6
- package/dist/schemas/plugin.d.ts +6 -5
- package/dist/schemas/plugin.js +4 -4
- package/dist/schemas/rag.d.ts +4 -4
- package/dist/schemas/registry.d.ts +8 -8
- package/dist/schemas/registry.js +1 -1
- package/dist/schemas/reload-config.d.ts +6 -6
- package/dist/schemas/sdcpp-config.d.ts +12 -12
- package/dist/schemas/sdk-config.d.ts +171 -117
- package/dist/schemas/sdk-config.js +5 -5
- package/dist/schemas/sdk-errors-client.d.ts +1 -0
- package/dist/schemas/sdk-errors-client.js +7 -2
- package/dist/schemas/text-to-speech.d.ts +157 -13
- package/dist/schemas/text-to-speech.js +70 -7
- package/dist/schemas/transcription-config.d.ts +5 -1
- package/dist/schemas/transcription-config.js +2 -0
- package/dist/schemas/transcription.d.ts +3 -0
- package/dist/schemas/transcription.js +2 -1
- package/dist/schemas/translate.d.ts +6 -6
- package/dist/schemas/translate.js +2 -3
- package/dist/schemas/translation-config.d.ts +20 -20
- package/dist/server/bare/hyperswarm.js +3 -3
- package/dist/server/bare/ops/transcribe.js +46 -15
- package/dist/server/bare/plugins/bci-whispercpp-transcription/args.d.ts +3 -0
- package/dist/server/bare/plugins/bci-whispercpp-transcription/args.js +13 -0
- package/dist/server/bare/plugins/bci-whispercpp-transcription/plugin.d.ts +41 -0
- package/dist/server/bare/plugins/bci-whispercpp-transcription/plugin.js +6 -11
- package/dist/server/bare/plugins/bci-whispercpp-transcription/resolve-config.d.ts +75 -0
- package/dist/server/bare/plugins/bci-whispercpp-transcription/resolve-config.js +11 -0
- package/dist/server/bare/plugins/{onnx-ocr → ggml-ocr}/plugin.d.ts +16 -10
- package/dist/server/bare/plugins/{onnx-ocr → ggml-ocr}/plugin.js +25 -18
- package/dist/server/bare/plugins/index.d.ts +1 -1
- package/dist/server/bare/plugins/index.js +1 -1
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stats.d.ts +10 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stats.js +29 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +4 -22
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +15 -7
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +7 -7
- package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +2 -0
- package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +10 -10
- package/dist/server/bare/plugins/tts-ggml/plugin.d.ts +14 -8
- package/dist/server/bare/plugins/tts-ggml/plugin.js +12 -0
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +3 -1
- package/dist/server/bare/registry/logging-stream-registry.d.ts +4 -2
- package/dist/server/bare/registry/logging-stream-registry.js +12 -7
- package/dist/server/bare/registry/model-config-utils.js +2 -2
- package/dist/server/bare/registry/registry-client.js +1 -1
- package/dist/server/bare/runtime-lifecycle.d.ts +9 -0
- package/dist/server/bare/runtime-lifecycle.js +24 -0
- package/dist/server/bare/types/addon-responses.d.ts +1 -0
- package/dist/server/env.js +7 -10
- package/dist/server/plugins/registry.js +2 -4
- package/dist/server/rpc/handlers/load-model/handler.js +2 -4
- package/dist/server/rpc/handlers/load-model/http.js +253 -51
- package/dist/server/rpc/handlers/logging-stream.js +4 -2
- package/dist/server/rpc/handlers/plugin-invoke.js +5 -16
- package/dist/server/utils/completion-normalizer.js +13 -4
- package/dist/server/utils/worker-lock.js +5 -5
- package/dist/server/worker-core.d.ts +1 -1
- package/dist/server/worker-core.js +28 -18
- package/dist/utils/errors-client.d.ts +3 -0
- package/dist/utils/errors-client.js +5 -0
- package/dist/utils/errors-server.d.ts +2 -0
- package/dist/utils/errors-server.js +3 -0
- package/dist/utils/zod-error.d.ts +3 -0
- package/dist/utils/zod-error.js +4 -0
- package/package.json +21 -24
- package/dist/polyfills/bare-globals.d.ts +0 -2
- package/dist/polyfills/bare-globals.js +0 -4
- package/dist/polyfills/bare-globals.noop.d.ts +0 -2
- package/dist/polyfills/bare-globals.noop.js +0 -1
- /package/dist/server/bare/plugins/{onnx-ocr → ggml-ocr}/ops/ocr-stream.d.ts +0 -0
- /package/dist/server/bare/plugins/{onnx-ocr → ggml-ocr}/ops/ocr-stream.js +0 -0
|
@@ -2,11 +2,15 @@ import { translate, loadModel, unloadModel, SALAMANDRATA_2B_INST_Q8, } from "@qv
|
|
|
2
2
|
try {
|
|
3
3
|
const modelId = await loadModel({
|
|
4
4
|
modelSrc: SALAMANDRATA_2B_INST_Q8,
|
|
5
|
-
onProgress: (
|
|
6
|
-
|
|
5
|
+
onProgress: (p) => {
|
|
6
|
+
const mb = (n) => (n / 1e6).toFixed(1);
|
|
7
|
+
const line = `▸ Downloading ${p.percentage.toFixed(0)}% (${mb(p.downloaded)}/${mb(p.total)} MB)`;
|
|
8
|
+
process.stderr.write(process.stderr.isTTY ? `\r${line}` : `${line}\n`);
|
|
9
|
+
if (p.percentage >= 100)
|
|
10
|
+
process.stderr.write("\n");
|
|
7
11
|
},
|
|
8
12
|
});
|
|
9
|
-
console.log(
|
|
13
|
+
console.log(`▸ Model loaded: ${modelId}`);
|
|
10
14
|
// With explicit source language
|
|
11
15
|
const engText = "bank";
|
|
12
16
|
const resultExplicit = translate({
|
|
@@ -23,6 +27,6 @@ try {
|
|
|
23
27
|
await unloadModel({ modelId, clearStorage: false });
|
|
24
28
|
}
|
|
25
29
|
catch (error) {
|
|
26
|
-
console.error("
|
|
30
|
+
console.error("✖", error);
|
|
27
31
|
process.exit(1);
|
|
28
32
|
}
|
|
@@ -2,8 +2,12 @@ import { translate, loadModel, unloadModel, SALAMANDRATA_2B_INST_Q4, } from "@qv
|
|
|
2
2
|
try {
|
|
3
3
|
const modelId = await loadModel({
|
|
4
4
|
modelSrc: SALAMANDRATA_2B_INST_Q4,
|
|
5
|
-
onProgress: (
|
|
6
|
-
|
|
5
|
+
onProgress: (p) => {
|
|
6
|
+
const mb = (n) => (n / 1e6).toFixed(1);
|
|
7
|
+
const line = `▸ Downloading ${p.percentage.toFixed(0)}% (${mb(p.downloaded)}/${mb(p.total)} MB)`;
|
|
8
|
+
process.stderr.write(process.stderr.isTTY ? `\r${line}` : `${line}\n`);
|
|
9
|
+
if (p.percentage >= 100)
|
|
10
|
+
process.stderr.write("\n");
|
|
7
11
|
},
|
|
8
12
|
});
|
|
9
13
|
// With explicit source language
|
|
@@ -32,6 +36,6 @@ try {
|
|
|
32
36
|
await unloadModel({ modelId, clearStorage: false });
|
|
33
37
|
}
|
|
34
38
|
catch (error) {
|
|
35
|
-
console.error("
|
|
39
|
+
console.error("✖", error);
|
|
36
40
|
process.exit(1);
|
|
37
41
|
}
|
|
@@ -8,9 +8,9 @@ try {
|
|
|
8
8
|
to: "es",
|
|
9
9
|
},
|
|
10
10
|
});
|
|
11
|
-
console.log(
|
|
11
|
+
console.log(`▸ Model loaded: ${modelId}`);
|
|
12
12
|
const text = "Hello, how are you today? I hope you are having a wonderful day!";
|
|
13
|
-
console.log("
|
|
13
|
+
console.log("▸ Streaming Translation");
|
|
14
14
|
const streamResult = translate({
|
|
15
15
|
modelId,
|
|
16
16
|
text,
|
|
@@ -24,11 +24,11 @@ try {
|
|
|
24
24
|
console.log();
|
|
25
25
|
const stats = await streamResult.stats;
|
|
26
26
|
if (stats) {
|
|
27
|
-
console.log(
|
|
27
|
+
console.log(`▸ Processing stats:`, stats);
|
|
28
28
|
}
|
|
29
29
|
await unloadModel({ modelId, clearStorage: false });
|
|
30
30
|
}
|
|
31
31
|
catch (error) {
|
|
32
|
-
console.error("
|
|
32
|
+
console.error("✖", error);
|
|
33
33
|
process.exit(1);
|
|
34
34
|
}
|
|
@@ -12,14 +12,22 @@ try {
|
|
|
12
12
|
ttsEngine: "chatterbox",
|
|
13
13
|
language: "en",
|
|
14
14
|
s3genModelSrc: TTS_S3GEN_EN_CHATTERBOX.src,
|
|
15
|
+
streamChunkTokens: 25,
|
|
16
|
+
streamFirstChunkTokens: 10,
|
|
17
|
+
cfmSteps: 1,
|
|
18
|
+
threads: 8,
|
|
15
19
|
...(referenceAudioSrc ? { referenceAudioSrc } : {}),
|
|
16
20
|
},
|
|
17
|
-
onProgress: (
|
|
18
|
-
|
|
21
|
+
onProgress: (p) => {
|
|
22
|
+
const mb = (n) => (n / 1e6).toFixed(1);
|
|
23
|
+
const line = `▸ Downloading ${p.percentage.toFixed(0)}% (${mb(p.downloaded)}/${mb(p.total)} MB)`;
|
|
24
|
+
process.stderr.write(process.stderr.isTTY ? `\r${line}` : `${line}\n`);
|
|
25
|
+
if (p.percentage >= 100)
|
|
26
|
+
process.stderr.write("\n");
|
|
19
27
|
},
|
|
20
28
|
});
|
|
21
|
-
console.log(
|
|
22
|
-
console.log("
|
|
29
|
+
console.log(`▸ Model loaded: ${modelId}`);
|
|
30
|
+
console.log("▸ Testing Text-to-Speech...");
|
|
23
31
|
const result = textToSpeech({
|
|
24
32
|
modelId,
|
|
25
33
|
text: `QVAC SDK is the canonical entry point to QVAC. Written in TypeScript, it provides all QVAC capabilities through a unified interface while also abstracting away the complexity of running your application in a JS environment other than Bare. Supported JS environments include Bare, Node.js, Expo and Bun.`,
|
|
@@ -27,23 +35,23 @@ try {
|
|
|
27
35
|
stream: false,
|
|
28
36
|
});
|
|
29
37
|
const audioBuffer = await result.buffer;
|
|
30
|
-
console.log(
|
|
31
|
-
console.log("
|
|
38
|
+
console.log(`▸ TTS complete. Total bytes: ${audioBuffer.length}`);
|
|
39
|
+
console.log("▸ Saving audio to file...");
|
|
32
40
|
createWav(audioBuffer, CHATTERBOX_SAMPLE_RATE, "tts-output.wav");
|
|
33
|
-
console.log("
|
|
34
|
-
console.log("
|
|
41
|
+
console.log("▸ Audio saved to tts-output.wav");
|
|
42
|
+
console.log("▸ Playing audio...");
|
|
35
43
|
const audioData = int16ArrayToBuffer(audioBuffer);
|
|
36
44
|
const wavBuffer = Buffer.concat([
|
|
37
45
|
createWavHeader(audioData.length, CHATTERBOX_SAMPLE_RATE),
|
|
38
46
|
audioData,
|
|
39
47
|
]);
|
|
40
48
|
playAudio(wavBuffer);
|
|
41
|
-
console.log("
|
|
49
|
+
console.log("▸ Audio playback complete");
|
|
42
50
|
await unloadModel({ modelId });
|
|
43
|
-
console.log("Model unloaded");
|
|
51
|
+
console.log("▸ Model unloaded");
|
|
44
52
|
process.exit(0);
|
|
45
53
|
}
|
|
46
54
|
catch (error) {
|
|
47
|
-
console.error("
|
|
55
|
+
console.error("✖", error);
|
|
48
56
|
process.exit(1);
|
|
49
57
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Usage:
|
|
13
13
|
* bun run examples/tts/llm-to-tts-streaming.ts
|
|
14
14
|
*/
|
|
15
|
-
import { completion, loadModel, textToSpeechStream, unloadModel, LLAMA_3_2_1B_INST_Q4_0,
|
|
15
|
+
import { completion, loadModel, textToSpeechStream, unloadModel, LLAMA_3_2_1B_INST_Q4_0, TTS_MULTILINGUAL_SUPERTONIC3_Q8_0, } from "@qvac/sdk";
|
|
16
16
|
import { createWav, playPcmInt16Chunk } from "./utils.js";
|
|
17
17
|
const SUPERTONIC_SAMPLE_RATE = 44100;
|
|
18
18
|
/**
|
|
@@ -57,18 +57,24 @@ function appendPcmSamples(target, chunk) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
try {
|
|
60
|
-
console.log(
|
|
60
|
+
console.log(`▸ Loading LLM from registry: ${LLAMA_3_2_1B_INST_Q4_0.name}`);
|
|
61
61
|
const llmModelId = await loadModel({
|
|
62
62
|
modelSrc: LLAMA_3_2_1B_INST_Q4_0,
|
|
63
63
|
modelConfig: {
|
|
64
64
|
ctx_size: 2048,
|
|
65
65
|
},
|
|
66
|
-
onProgress: (
|
|
66
|
+
onProgress: (p) => {
|
|
67
|
+
const mb = (n) => (n / 1e6).toFixed(1);
|
|
68
|
+
const line = `▸ Downloading ${p.percentage.toFixed(0)}% (${mb(p.downloaded)}/${mb(p.total)} MB)`;
|
|
69
|
+
process.stderr.write(process.stderr.isTTY ? `\r${line}` : `${line}\n`);
|
|
70
|
+
if (p.percentage >= 100)
|
|
71
|
+
process.stderr.write("\n");
|
|
72
|
+
},
|
|
67
73
|
});
|
|
68
|
-
console.log(
|
|
69
|
-
console.log("Loading Supertonic TTS (registry)…");
|
|
74
|
+
console.log(`▸ LLM ready: ${llmModelId}`);
|
|
75
|
+
console.log("▸ Loading Supertonic TTS (registry)…");
|
|
70
76
|
const ttsModelId = await loadModel({
|
|
71
|
-
modelSrc:
|
|
77
|
+
modelSrc: TTS_MULTILINGUAL_SUPERTONIC3_Q8_0,
|
|
72
78
|
modelConfig: {
|
|
73
79
|
ttsEngine: "supertonic",
|
|
74
80
|
language: "en",
|
|
@@ -76,11 +82,18 @@ try {
|
|
|
76
82
|
ttsSpeed: 1.05,
|
|
77
83
|
ttsNumInferenceSteps: 10,
|
|
78
84
|
},
|
|
79
|
-
onProgress: (
|
|
85
|
+
onProgress: (p) => {
|
|
86
|
+
const mb = (n) => (n / 1e6).toFixed(1);
|
|
87
|
+
const line = `▸ Downloading ${p.percentage.toFixed(0)}% (${mb(p.downloaded)}/${mb(p.total)} MB)`;
|
|
88
|
+
process.stderr.write(process.stderr.isTTY ? `\r${line}` : `${line}\n`);
|
|
89
|
+
if (p.percentage >= 100)
|
|
90
|
+
process.stderr.write("\n");
|
|
91
|
+
},
|
|
80
92
|
});
|
|
81
|
-
console.log(
|
|
93
|
+
console.log(`▸ TTS ready: ${ttsModelId}`);
|
|
82
94
|
const prompt = "What is a constellation?";
|
|
83
|
-
console.log(
|
|
95
|
+
console.log(`▸ User: ${prompt}`);
|
|
96
|
+
console.log("▸ Assistant (streaming):");
|
|
84
97
|
const result = completion({
|
|
85
98
|
modelId: llmModelId,
|
|
86
99
|
history: [{ role: "user", content: prompt }],
|
|
@@ -102,7 +115,7 @@ try {
|
|
|
102
115
|
const preview = typeof m.sentenceChunk === "string"
|
|
103
116
|
? m.sentenceChunk.replace(/\s+/g, " ").trim().slice(0, 72)
|
|
104
117
|
: "";
|
|
105
|
-
console.log(`\n[TTS phrase ${phraseIndex}] ${m.buffer.length} samples${preview ? ` — "${preview}${preview.length >= 72 ? "..." : ""}"` : ""}`);
|
|
118
|
+
console.log(`\n▸ [TTS phrase ${phraseIndex}] ${m.buffer.length} samples${preview ? ` — "${preview}${preview.length >= 72 ? "..." : ""}"` : ""}`);
|
|
106
119
|
await playPcmInt16Chunk(m.buffer, SUPERTONIC_SAMPLE_RATE);
|
|
107
120
|
}
|
|
108
121
|
}
|
|
@@ -118,17 +131,17 @@ try {
|
|
|
118
131
|
await drainPcm;
|
|
119
132
|
const stats = await result.stats;
|
|
120
133
|
if (stats) {
|
|
121
|
-
console.log("\
|
|
134
|
+
console.log("\n▸ LLM stats:", stats);
|
|
122
135
|
}
|
|
123
136
|
const outWav = "llm-to-tts-streaming-output.wav";
|
|
124
|
-
console.log(`\
|
|
137
|
+
console.log(`\n▸ Writing ${combinedPcm.length} samples to ${outWav} (full utterance; phrases were already played above).`);
|
|
125
138
|
createWav(combinedPcm, SUPERTONIC_SAMPLE_RATE, outWav);
|
|
126
139
|
await unloadModel({ modelId: llmModelId, clearStorage: false });
|
|
127
140
|
await unloadModel({ modelId: ttsModelId, clearStorage: false });
|
|
128
|
-
console.log("Models unloaded.");
|
|
141
|
+
console.log("▸ Models unloaded.");
|
|
129
142
|
process.exit(0);
|
|
130
143
|
}
|
|
131
144
|
catch (error) {
|
|
132
|
-
console.error("
|
|
145
|
+
console.error("✖", error);
|
|
133
146
|
process.exit(1);
|
|
134
147
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { loadModel, textToSpeech, unloadModel,
|
|
1
|
+
import { loadModel, textToSpeech, unloadModel, TTS_MULTILINGUAL_SUPERTONIC3_Q8_0, } from "@qvac/sdk";
|
|
2
2
|
import { createWav, playAudio, int16ArrayToBuffer, createWavHeader, } from "./utils.js";
|
|
3
|
-
// Supertonic
|
|
3
|
+
// Supertonic 3 TTS (GGML): multilingual synthesis across 31 languages.
|
|
4
4
|
const SUPERTONIC_SAMPLE_RATE = 44100;
|
|
5
5
|
try {
|
|
6
6
|
const modelId = await loadModel({
|
|
7
|
-
modelSrc:
|
|
7
|
+
modelSrc: TTS_MULTILINGUAL_SUPERTONIC3_Q8_0,
|
|
8
8
|
modelConfig: {
|
|
9
9
|
ttsEngine: "supertonic",
|
|
10
10
|
language: "es",
|
|
@@ -12,12 +12,16 @@ try {
|
|
|
12
12
|
ttsSpeed: 1.05,
|
|
13
13
|
ttsNumInferenceSteps: 5,
|
|
14
14
|
},
|
|
15
|
-
onProgress: (
|
|
16
|
-
|
|
15
|
+
onProgress: (p) => {
|
|
16
|
+
const mb = (n) => (n / 1e6).toFixed(1);
|
|
17
|
+
const line = `▸ Downloading ${p.percentage.toFixed(0)}% (${mb(p.downloaded)}/${mb(p.total)} MB)`;
|
|
18
|
+
process.stderr.write(process.stderr.isTTY ? `\r${line}` : `${line}\n`);
|
|
19
|
+
if (p.percentage >= 100)
|
|
20
|
+
process.stderr.write("\n");
|
|
17
21
|
},
|
|
18
22
|
});
|
|
19
|
-
console.log(
|
|
20
|
-
console.log("
|
|
23
|
+
console.log(`▸ Model loaded: ${modelId}`);
|
|
24
|
+
console.log("▸ Testing Text-to-Speech...");
|
|
21
25
|
const result = textToSpeech({
|
|
22
26
|
modelId,
|
|
23
27
|
text: `Hola mundo. Esta es una demostración de síntesis de voz con Supertonic en español.`,
|
|
@@ -25,23 +29,23 @@ try {
|
|
|
25
29
|
stream: false,
|
|
26
30
|
});
|
|
27
31
|
const audioBuffer = await result.buffer;
|
|
28
|
-
console.log(
|
|
29
|
-
console.log("
|
|
32
|
+
console.log(`▸ TTS complete. Total samples: ${audioBuffer.length}`);
|
|
33
|
+
console.log("▸ Saving audio to file...");
|
|
30
34
|
createWav(audioBuffer, SUPERTONIC_SAMPLE_RATE, "supertonic-multilingual-output.wav");
|
|
31
|
-
console.log("
|
|
32
|
-
console.log("
|
|
35
|
+
console.log("▸ Audio saved to supertonic-multilingual-output.wav");
|
|
36
|
+
console.log("▸ Playing audio...");
|
|
33
37
|
const audioData = int16ArrayToBuffer(audioBuffer);
|
|
34
38
|
const wavBuffer = Buffer.concat([
|
|
35
39
|
createWavHeader(audioData.length, SUPERTONIC_SAMPLE_RATE),
|
|
36
40
|
audioData,
|
|
37
41
|
]);
|
|
38
42
|
playAudio(wavBuffer);
|
|
39
|
-
console.log("
|
|
43
|
+
console.log("▸ Audio playback complete");
|
|
40
44
|
await unloadModel({ modelId });
|
|
41
|
-
console.log("Model unloaded");
|
|
45
|
+
console.log("▸ Model unloaded");
|
|
42
46
|
process.exit(0);
|
|
43
47
|
}
|
|
44
48
|
catch (error) {
|
|
45
|
-
console.error("
|
|
49
|
+
console.error("✖", error);
|
|
46
50
|
process.exit(1);
|
|
47
51
|
}
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import { loadModel, textToSpeech, unloadModel,
|
|
1
|
+
import { loadModel, textToSpeech, unloadModel, TTS_MULTILINGUAL_SUPERTONIC3_Q8_0, } from "@qvac/sdk";
|
|
2
2
|
import { createWav, playAudio, int16ArrayToBuffer, createWavHeader, } from "./utils.js";
|
|
3
|
-
// Supertonic TTS (GGML): fast
|
|
3
|
+
// Supertonic 3 TTS (GGML): fast multilingual synthesis with baked-in voices.
|
|
4
4
|
// Uses registry model constants — downloads automatically from QVAC Registry.
|
|
5
5
|
const SUPERTONIC_SAMPLE_RATE = 44100;
|
|
6
6
|
try {
|
|
7
7
|
const modelId = await loadModel({
|
|
8
|
-
modelSrc:
|
|
8
|
+
modelSrc: TTS_MULTILINGUAL_SUPERTONIC3_Q8_0,
|
|
9
9
|
modelConfig: {
|
|
10
10
|
ttsEngine: "supertonic",
|
|
11
11
|
language: "en",
|
|
12
12
|
voice: "F1",
|
|
13
13
|
ttsSpeed: 1.05,
|
|
14
|
-
ttsNumInferenceSteps: 5
|
|
14
|
+
ttsNumInferenceSteps: 5
|
|
15
15
|
},
|
|
16
|
-
onProgress: (
|
|
17
|
-
|
|
16
|
+
onProgress: (p) => {
|
|
17
|
+
const mb = (n) => (n / 1e6).toFixed(1);
|
|
18
|
+
const line = `▸ Downloading ${p.percentage.toFixed(0)}% (${mb(p.downloaded)}/${mb(p.total)} MB)`;
|
|
19
|
+
process.stderr.write(process.stderr.isTTY ? `\r${line}` : `${line}\n`);
|
|
20
|
+
if (p.percentage >= 100)
|
|
21
|
+
process.stderr.write("\n");
|
|
18
22
|
},
|
|
19
23
|
});
|
|
20
|
-
console.log(
|
|
21
|
-
console.log("
|
|
24
|
+
console.log(`▸ Model loaded: ${modelId}`);
|
|
25
|
+
console.log("▸ Testing Text-to-Speech...");
|
|
22
26
|
const result = textToSpeech({
|
|
23
27
|
modelId,
|
|
24
28
|
text: `QVAC SDK is the canonical entry point to QVAC. Written in TypeScript, it provides all QVAC capabilities through a unified interface while also abstracting away the complexity of running your application in a JS environment other than Bare. Supported JS environments include Bare, Node.js, Expo and Bun.`,
|
|
@@ -26,23 +30,23 @@ try {
|
|
|
26
30
|
stream: false,
|
|
27
31
|
});
|
|
28
32
|
const audioBuffer = await result.buffer;
|
|
29
|
-
console.log(
|
|
30
|
-
console.log("
|
|
33
|
+
console.log(`▸ TTS complete. Total samples: ${audioBuffer.length}`);
|
|
34
|
+
console.log("▸ Saving audio to file...");
|
|
31
35
|
createWav(audioBuffer, SUPERTONIC_SAMPLE_RATE, "supertonic-output.wav");
|
|
32
|
-
console.log("
|
|
33
|
-
console.log("
|
|
36
|
+
console.log("▸ Audio saved to supertonic-output.wav");
|
|
37
|
+
console.log("▸ Playing audio...");
|
|
34
38
|
const audioData = int16ArrayToBuffer(audioBuffer);
|
|
35
39
|
const wavBuffer = Buffer.concat([
|
|
36
40
|
createWavHeader(audioData.length, SUPERTONIC_SAMPLE_RATE),
|
|
37
41
|
audioData,
|
|
38
42
|
]);
|
|
39
43
|
playAudio(wavBuffer);
|
|
40
|
-
console.log("
|
|
44
|
+
console.log("▸ Audio playback complete");
|
|
41
45
|
await unloadModel({ modelId });
|
|
42
|
-
console.log("Model unloaded");
|
|
46
|
+
console.log("▸ Model unloaded");
|
|
43
47
|
process.exit(0);
|
|
44
48
|
}
|
|
45
49
|
catch (error) {
|
|
46
|
-
console.error("
|
|
50
|
+
console.error("✖", error);
|
|
47
51
|
process.exit(1);
|
|
48
52
|
}
|
|
@@ -44,7 +44,7 @@ export function createWav(audioBuffer, sampleRate, filename) {
|
|
|
44
44
|
const wavHeader = createWavHeader(audioData.length, sampleRate);
|
|
45
45
|
const wavFile = Buffer.concat([wavHeader, audioData]);
|
|
46
46
|
writeFileSync(filename, wavFile);
|
|
47
|
-
console.log(
|
|
47
|
+
console.log(`▸ WAV file saved as: ${filename}`);
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Play a WAV buffer by streaming it into ffplay over stdin.
|
|
@@ -22,21 +22,25 @@ import { close, loadModel, PI05_BASE_Q_AGGRESSIVE, unloadModel, vla, vlaHparams,
|
|
|
22
22
|
const modelSrcOverride = process.argv[2];
|
|
23
23
|
const modelSrc = modelSrcOverride ?? PI05_BASE_Q_AGGRESSIVE;
|
|
24
24
|
try {
|
|
25
|
-
console.log("Loading π₀.₅ (pi05) model...");
|
|
25
|
+
console.log("▸ Loading π₀.₅ (pi05) model...");
|
|
26
26
|
const modelId = await loadModel({
|
|
27
27
|
modelSrc,
|
|
28
28
|
modelType: "ggml-vla",
|
|
29
29
|
modelConfig: { backend: "cpu" },
|
|
30
|
-
onProgress: (p) =>
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
onProgress: (p) => {
|
|
31
|
+
const mb = (n) => (n / 1e6).toFixed(1);
|
|
32
|
+
const line = `▸ Downloading ${p.percentage.toFixed(0)}% (${mb(p.downloaded)}/${mb(p.total)} MB)`;
|
|
33
|
+
process.stderr.write(process.stderr.isTTY ? `\r${line}` : `${line}\n`);
|
|
34
|
+
if (p.percentage >= 100)
|
|
35
|
+
process.stderr.write("\n");
|
|
36
|
+
},
|
|
33
37
|
});
|
|
34
38
|
if (typeof modelSrc !== "string")
|
|
35
|
-
process.
|
|
36
|
-
console.log(
|
|
39
|
+
process.stderr.write("\n");
|
|
40
|
+
console.log(`▸ Model loaded: ${modelId}`);
|
|
37
41
|
const { hparams, backendName } = await vlaHparams({ modelId });
|
|
38
|
-
console.log(
|
|
39
|
-
console.log("Hparams:", hparams);
|
|
42
|
+
console.log(`▸ Backend: ${backendName ?? "(unknown)"}`);
|
|
43
|
+
console.log("▸ Hparams:", hparams);
|
|
40
44
|
// Build synthetic inputs sized to the model's expectations. A real
|
|
41
45
|
// consumer would: read camera frames, tokenize the instruction with the
|
|
42
46
|
// model's tokenizer, and (for π₀.₅) inline the robot state into the prompt.
|
|
@@ -54,7 +58,7 @@ try {
|
|
|
54
58
|
// into the prompt), so pass an empty Float32Array. π₀.₅ requires `noise`.
|
|
55
59
|
const state = new Float32Array(0);
|
|
56
60
|
const noise = new Float32Array(hparams.chunkSize * hparams.maxActionDim);
|
|
57
|
-
console.log("Running VLA inference...");
|
|
61
|
+
console.log("▸ Running VLA inference...");
|
|
58
62
|
const { actions, actionDim, chunkSize, stats } = await vla({
|
|
59
63
|
modelId,
|
|
60
64
|
images,
|
|
@@ -65,20 +69,20 @@ try {
|
|
|
65
69
|
mask,
|
|
66
70
|
noise,
|
|
67
71
|
});
|
|
68
|
-
console.log(
|
|
69
|
-
console.log(
|
|
72
|
+
console.log(`▸ Got ${chunkSize} action steps of dim ${actionDim}.`);
|
|
73
|
+
console.log(Array.from(actions.subarray(0, actionDim)));
|
|
70
74
|
if (stats) {
|
|
71
|
-
console.log(
|
|
75
|
+
console.log(`▸ Timing: vision=${stats.vision_ms?.toFixed(0)}ms ` +
|
|
72
76
|
`prefill=${stats.prefill_total_ms?.toFixed(0)}ms ` +
|
|
73
77
|
`ode=${stats.ode_ms?.toFixed(0)}ms ` +
|
|
74
78
|
`total=${stats.total_ms?.toFixed(0)}ms`);
|
|
75
79
|
}
|
|
76
80
|
await unloadModel({ modelId, clearStorage: false });
|
|
77
|
-
console.log("Model unloaded.");
|
|
81
|
+
console.log("▸ Model unloaded.");
|
|
78
82
|
process.exit(0);
|
|
79
83
|
}
|
|
80
84
|
catch (error) {
|
|
81
|
-
console.error("
|
|
85
|
+
console.error("✖", error);
|
|
82
86
|
await close();
|
|
83
87
|
process.exit(1);
|
|
84
88
|
}
|
|
@@ -16,21 +16,25 @@ import { close, loadModel, SMOLVLA_LIBERO_VISION_Q8, unloadModel, vla, vlaHparam
|
|
|
16
16
|
const modelSrcOverride = process.argv[2];
|
|
17
17
|
const modelSrc = modelSrcOverride ?? SMOLVLA_LIBERO_VISION_Q8;
|
|
18
18
|
try {
|
|
19
|
-
console.log("Loading SmolVLA model...");
|
|
19
|
+
console.log("▸ Loading SmolVLA model...");
|
|
20
20
|
const modelId = await loadModel({
|
|
21
21
|
modelSrc,
|
|
22
22
|
modelType: "ggml-vla",
|
|
23
23
|
modelConfig: { backend: "cpu" },
|
|
24
|
-
onProgress: (p) =>
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
onProgress: (p) => {
|
|
25
|
+
const mb = (n) => (n / 1e6).toFixed(1);
|
|
26
|
+
const line = `▸ Downloading ${p.percentage.toFixed(0)}% (${mb(p.downloaded)}/${mb(p.total)} MB)`;
|
|
27
|
+
process.stderr.write(process.stderr.isTTY ? `\r${line}` : `${line}\n`);
|
|
28
|
+
if (p.percentage >= 100)
|
|
29
|
+
process.stderr.write("\n");
|
|
30
|
+
},
|
|
27
31
|
});
|
|
28
32
|
if (typeof modelSrc !== "string")
|
|
29
|
-
process.
|
|
30
|
-
console.log(
|
|
33
|
+
process.stderr.write("\n");
|
|
34
|
+
console.log(`▸ Model loaded: ${modelId}`);
|
|
31
35
|
const { hparams, backendName } = await vlaHparams({ modelId });
|
|
32
|
-
console.log(
|
|
33
|
-
console.log("Hparams:", hparams);
|
|
36
|
+
console.log(`▸ Backend: ${backendName ?? "(unknown)"}`);
|
|
37
|
+
console.log("▸ Hparams:", hparams);
|
|
34
38
|
// Build synthetic inputs sized to the model's expectations. A real
|
|
35
39
|
// consumer would: read camera frames, tokenize the instruction with the
|
|
36
40
|
// SmolVLM2 tokenizer, and read the robot's current end-effector pose.
|
|
@@ -45,7 +49,7 @@ try {
|
|
|
45
49
|
mask[0] = 1;
|
|
46
50
|
const state = vlaPadState([0, 0, 0, 0, 0, 0], hparams.maxStateDim);
|
|
47
51
|
const noise = new Float32Array(hparams.chunkSize * hparams.maxActionDim);
|
|
48
|
-
console.log("Running VLA inference...");
|
|
52
|
+
console.log("▸ Running VLA inference...");
|
|
49
53
|
const { actions, actionDim, chunkSize, stats } = await vla({
|
|
50
54
|
modelId,
|
|
51
55
|
images: [front, wrist],
|
|
@@ -56,20 +60,20 @@ try {
|
|
|
56
60
|
mask,
|
|
57
61
|
noise,
|
|
58
62
|
});
|
|
59
|
-
console.log(
|
|
60
|
-
console.log(
|
|
63
|
+
console.log(`▸ Got ${chunkSize} action steps of dim ${actionDim}.`);
|
|
64
|
+
console.log(Array.from(actions.subarray(0, actionDim)));
|
|
61
65
|
if (stats) {
|
|
62
|
-
console.log(
|
|
66
|
+
console.log(`▸ Timing: vision=${stats.vision_ms?.toFixed(0)}ms ` +
|
|
63
67
|
`smollm2=${stats.smollm2_total_ms?.toFixed(0)}ms ` +
|
|
64
68
|
`ode=${stats.ode_ms?.toFixed(0)}ms ` +
|
|
65
69
|
`total=${stats.total_ms?.toFixed(0)}ms`);
|
|
66
70
|
}
|
|
67
71
|
await unloadModel({ modelId, clearStorage: false });
|
|
68
|
-
console.log("Model unloaded.");
|
|
72
|
+
console.log("▸ Model unloaded.");
|
|
69
73
|
process.exit(0);
|
|
70
74
|
}
|
|
71
75
|
catch (error) {
|
|
72
|
-
console.error("
|
|
76
|
+
console.error("✖", error);
|
|
73
77
|
await close();
|
|
74
78
|
process.exit(1);
|
|
75
79
|
}
|
|
@@ -69,11 +69,11 @@ function sleep(ms) {
|
|
|
69
69
|
for (const tool of ["ffmpeg", "ffplay"]) {
|
|
70
70
|
const r = spawnSync(tool, ["-version"], { stdio: "ignore" });
|
|
71
71
|
if (r.error || r.status !== 0) {
|
|
72
|
-
console.error(
|
|
72
|
+
console.error(`✖ ${tool} not found on PATH. Install ffmpeg (ffplay ships with it) and retry.`);
|
|
73
73
|
process.exit(1);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
console.log("Loading whisper-tiny + Silero VAD...");
|
|
76
|
+
console.log("▸ Loading whisper-tiny + Silero VAD...");
|
|
77
77
|
const asrModelId = await loadModel({
|
|
78
78
|
modelSrc: WHISPER_TINY,
|
|
79
79
|
modelConfig: {
|
|
@@ -89,14 +89,14 @@ const asrModelId = await loadModel({
|
|
|
89
89
|
vad_params: VAD_PARAMS,
|
|
90
90
|
},
|
|
91
91
|
});
|
|
92
|
-
console.log("Loading Llama 3.2 1B...");
|
|
92
|
+
console.log("▸ Loading Llama 3.2 1B...");
|
|
93
93
|
const llmModelId = await loadModel({
|
|
94
94
|
modelSrc: LLAMA_3_2_1B_INST_Q4_0,
|
|
95
95
|
modelConfig: {
|
|
96
96
|
ctx_size: 4096,
|
|
97
97
|
},
|
|
98
98
|
});
|
|
99
|
-
console.log("Loading Supertonic TTS...");
|
|
99
|
+
console.log("▸ Loading Supertonic TTS...");
|
|
100
100
|
const ttsModelId = await loadModel({
|
|
101
101
|
modelSrc: TTS_EN_SUPERTONIC_Q8_0,
|
|
102
102
|
modelConfig: {
|
|
@@ -107,7 +107,7 @@ const ttsModelId = await loadModel({
|
|
|
107
107
|
ttsNumInferenceSteps: 5,
|
|
108
108
|
},
|
|
109
109
|
});
|
|
110
|
-
console.log("All models loaded.\n");
|
|
110
|
+
console.log("▸ All models loaded.\n");
|
|
111
111
|
const ffmpeg = startMicrophone({
|
|
112
112
|
sampleRate: MIC_SAMPLE_RATE,
|
|
113
113
|
format: "f32le",
|
|
@@ -129,7 +129,7 @@ async function cleanup() {
|
|
|
129
129
|
if (shuttingDown)
|
|
130
130
|
return;
|
|
131
131
|
shuttingDown = true;
|
|
132
|
-
console.log("\n\
|
|
132
|
+
console.log("\n\n▸ Stopping...");
|
|
133
133
|
ffmpeg.kill();
|
|
134
134
|
try {
|
|
135
135
|
session.end();
|
|
@@ -140,21 +140,21 @@ async function cleanup() {
|
|
|
140
140
|
await unloadModel({ modelId: ttsModelId }).catch(() => { });
|
|
141
141
|
await unloadModel({ modelId: llmModelId }).catch(() => { });
|
|
142
142
|
await unloadModel({ modelId: asrModelId }).catch(() => { });
|
|
143
|
-
console.log("Done.");
|
|
143
|
+
console.log("▸ Done.");
|
|
144
144
|
process.exit(0);
|
|
145
145
|
}
|
|
146
146
|
process.on("SIGINT", () => void cleanup());
|
|
147
147
|
process.on("SIGTERM", () => void cleanup());
|
|
148
|
-
console.log("
|
|
148
|
+
console.log("▸ Listening. Speak a question and pause. Ctrl+C to quit.\n");
|
|
149
149
|
for await (const rawText of session) {
|
|
150
150
|
if (!isMeaningfulTranscript(rawText))
|
|
151
151
|
continue;
|
|
152
152
|
const userText = rawText.trim();
|
|
153
|
-
console.log(
|
|
153
|
+
console.log(`▸ You: ${userText}`);
|
|
154
154
|
history.push({ role: "user", content: userText });
|
|
155
155
|
isSpeaking = true;
|
|
156
156
|
try {
|
|
157
|
-
|
|
157
|
+
console.log("▸ Assistant:");
|
|
158
158
|
const llmResult = completion({
|
|
159
159
|
modelId: llmModelId,
|
|
160
160
|
history,
|
|
@@ -188,10 +188,10 @@ for await (const rawText of session) {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
catch (turnError) {
|
|
191
|
-
console.error("\n
|
|
191
|
+
console.error("\n✖ Turn failed:", turnError instanceof Error ? turnError.message : turnError);
|
|
192
192
|
}
|
|
193
193
|
finally {
|
|
194
194
|
isSpeaking = false;
|
|
195
|
-
console.log("\n
|
|
195
|
+
console.log("\n▸ Listening...\n");
|
|
196
196
|
}
|
|
197
197
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, loggingStream, ocr, invokePlugin, invokePluginStream, diffusion, type DiffusionProgressTick, classify, video, type VideoProgressTick, upscale, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams, suspend, resume, state, vla, vlaHparams, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, type FinetuneHandle, } from "./client/api/index";
|
|
1
|
+
export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, loggingStream, subscribeServerLogs, type ServerLogHandler, ocr, invokePlugin, invokePluginStream, diffusion, type DiffusionProgressTick, classify, video, type VideoProgressTick, upscale, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams, suspend, resume, state, vla, vlaHparams, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, type FinetuneHandle, } from "./client/api/index";
|
|
3
2
|
export { close } from "./client/index";
|
|
4
3
|
export { plugins } from "./client/plugins-factory";
|
|
5
4
|
export { type LifecycleState, type ModelProgressUpdate, type LoadModelOptions, type LoadCustomPluginModelOptions, type DownloadAssetOptions, type Tool, type ToolCall, type ToolCallWithCall, type ToolCallError, type ToolCallEvent, type CompletionEvent, type CompletionFinal, type CompletionRun, type CompletionStats, type EmbedStats, VERBOSITY, type Attachment, type TranscribeStreamSession, type TranscribeStreamMetadataSession, type TranscribeStreamConversationSession, type TranscribeStreamEvent, type VadStateEvent, type EndOfTurnEvent, type TranscribeSegment, type BciConfig, type BciTranscribeClientParams, type BciTranscribeStreamClientParams, type BciTranscribeStreamSession, type BciTranscribeStreamMetadataSession, type BciStreamOpts, type NeuralInput, type TextToSpeechStreamSession, type TextToSpeechStreamResponse, type TextToSpeechStreamClientParams, type CompletionParams, type ToolDialect, type RagSearchResult, type RagSaveEmbeddingsResult, type RagReindexResult, type RagEmbeddedDoc, type RagDoc, type RagWorkspaceInfo, type RagCloseWorkspaceParams, type RagDeleteWorkspaceParams, type RagIngestStage, type RagReindexStage, type RagSaveStage, SDK_CLIENT_ERROR_CODES, SDK_SERVER_ERROR_CODES, RAG_ERROR_CODES, type QvacConfig, type ModelInfo, type GetModelInfoParams, type GetLoadedModelInfoParams, type LoadedModelInfo, type LoadedInstance, type CacheFileInfo, toolSchema, TOOLS_MODE, type ToolsMode, type McpClient, type McpClientInput, type OCRClientParams, type OCRTextBlock, type OCROptions, type ClassifyClientParams, type ClassificationResult, type DiffusionClientParams, type DiffusionStreamResponse, type DiffusionStats, type VideoClientParams, type VideoStreamResponse, type VideoStats, type UpscaleClientParams, type UpscaleStreamResponse, type UpscaleStats, type VlaConfig, type VlaClientRunParams, type VlaClientRunResult, type VlaHparams, type VlaStats, definePlugin, defineHandler, defineDuplexHandler, type QvacPlugin, type CreateModelParams, type PluginModelResult, type ModelRegistryEntry, type ModelRegistryEntryAddon, PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_BCI, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_VLA, PLUGIN_CLASSIFICATION, SDK_DEFAULT_PLUGINS, type BuiltinPlugin, type ProfilerMode, type FinetuneValidation, type FinetuneRunParams, type FinetuneGetStateParams, type FinetuneStopParams, type FinetuneParams, type FinetuneStatus, type FinetuneProgress, type FinetuneStats, type FinetuneResult, } from "./schemas/index";
|
|
@@ -10,8 +9,8 @@ export { SUPPORTED_AUDIO_FORMATS } from "./constants/audio";
|
|
|
10
9
|
export { InferenceCancelledError } from "./utils/errors-server";
|
|
11
10
|
export type { InferenceCancelledPartial } from "./utils/errors-server";
|
|
12
11
|
export { ContextOverflowError, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, } from "./utils/errors-server";
|
|
13
|
-
export { BareRuntimeBinaryNotFoundError, WorkerCrashedError, WorkerShutdownError, } from "./utils/errors-client";
|
|
14
|
-
export { getLogger, SDK_LOG_ID } from "./logging/index";
|
|
12
|
+
export { BareRuntimeBinaryNotFoundError, WorkerCrashedError, WorkerShutdownError, RequestValidationFailedError, } from "./utils/errors-client";
|
|
13
|
+
export { getLogger, SDK_LOG_ID, SDK_ALL_LOG_ID } from "./logging/index";
|
|
15
14
|
export type { Logger, LogTransport, LoggerOptions } from "./logging/index";
|
|
16
15
|
export { profiler } from "./profiling/index";
|
|
17
16
|
export type { ProfilerRuntimeOptions, ProfilerExport } from "./profiling/index";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import "#polyfill-bare-globals";
|
|
2
1
|
// Public API exports only
|
|
3
|
-
export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, loggingStream, ocr, invokePlugin, invokePluginStream, diffusion, classify, video, upscale, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, suspend, resume, state, vla, vlaHparams, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, } from "./client/api/index.js";
|
|
2
|
+
export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, loggingStream, subscribeServerLogs, ocr, invokePlugin, invokePluginStream, diffusion, classify, video, upscale, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, suspend, resume, state, vla, vlaHparams, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, } from "./client/api/index.js";
|
|
4
3
|
export { close } from "./client/index.js";
|
|
5
4
|
export { plugins } from "./client/plugins-factory.js";
|
|
6
5
|
export { VERBOSITY, SDK_CLIENT_ERROR_CODES, SDK_SERVER_ERROR_CODES, RAG_ERROR_CODES, toolSchema, TOOLS_MODE, definePlugin, defineHandler, defineDuplexHandler, PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_BCI, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_VLA, PLUGIN_CLASSIFICATION, SDK_DEFAULT_PLUGINS, } from "./schemas/index.js";
|
|
@@ -39,8 +38,8 @@ export { ContextOverflowError, RequestIdConflictError, RequestNotFoundError, Req
|
|
|
39
38
|
// spawn because the platform's `bare-runtime-<platform>-<arch>` package is
|
|
40
39
|
// missing (common under pnpm). Exported so consumers can pattern-match with
|
|
41
40
|
// `instanceof`.
|
|
42
|
-
export { BareRuntimeBinaryNotFoundError, WorkerCrashedError, WorkerShutdownError, } from "./utils/errors-client.js";
|
|
41
|
+
export { BareRuntimeBinaryNotFoundError, WorkerCrashedError, WorkerShutdownError, RequestValidationFailedError, } from "./utils/errors-client.js";
|
|
43
42
|
// Logging exports
|
|
44
|
-
export { getLogger, SDK_LOG_ID } from "./logging/index.js";
|
|
43
|
+
export { getLogger, SDK_LOG_ID, SDK_ALL_LOG_ID } from "./logging/index.js";
|
|
45
44
|
// Profiler exports
|
|
46
45
|
export { profiler } from "./profiling/index.js";
|