@qvac/sdk 0.12.2 → 0.13.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 +55 -1225
- package/README.md +12 -0
- package/dist/client/api/bci-transcribe.d.ts +57 -0
- package/dist/client/api/bci-transcribe.js +172 -0
- package/dist/client/api/get-model-info.d.ts +1 -1
- package/dist/client/api/index.d.ts +1 -0
- package/dist/client/api/index.js +1 -0
- package/dist/client/api/video.d.ts +26 -6
- package/dist/client/api/video.js +30 -7
- package/dist/client/api/vla.d.ts +11 -7
- package/dist/client/api/vla.js +11 -7
- package/dist/client/rpc/bare-client.js +2 -2
- package/dist/commands/bundle/constants.js +2 -0
- package/dist/examples/bci/bci-filesystem-streaming.d.ts +2 -0
- package/dist/examples/bci/bci-filesystem-streaming.js +77 -0
- package/dist/examples/bci/bci-filesystem.d.ts +2 -0
- package/dist/examples/bci/bci-filesystem.js +63 -0
- package/dist/examples/cache-management.js +0 -1
- package/dist/examples/cancel-by-request-id.js +0 -1
- package/dist/examples/classification/classify-image.js +1 -1
- package/dist/examples/completion-events.js +6 -2
- package/dist/examples/completion-stop-reason.d.ts +25 -0
- package/dist/examples/completion-stop-reason.js +65 -0
- package/dist/examples/concurrent-completion-collision.d.ts +2 -0
- package/dist/examples/concurrent-completion-collision.js +98 -0
- package/dist/examples/config-reload.js +1 -2
- package/dist/examples/default-config-usage.js +0 -1
- package/dist/examples/delegated-inference/composite.js +0 -1
- package/dist/examples/delegated-inference/consumer-profiled.js +0 -1
- package/dist/examples/delegated-inference/consumer.js +0 -1
- package/dist/examples/diffusion-esrgan-upscale.js +1 -3
- package/dist/examples/diffusion-flux2-klein-img2img.js +1 -1
- package/dist/examples/diffusion-flux2-klein.js +2 -2
- package/dist/examples/diffusion-img2img.js +1 -1
- package/dist/examples/diffusion-img2vid.d.ts +2 -0
- package/dist/examples/diffusion-img2vid.js +78 -0
- package/dist/examples/diffusion-simple.js +1 -1
- package/dist/examples/diffusion-txt2img.js +8 -3
- package/dist/examples/diffusion-txt2vid.js +2 -3
- package/dist/examples/download-with-blind-relays.js +0 -1
- package/dist/examples/embed-multi-gpu.js +1 -2
- package/dist/examples/embed-p2p.js +4 -2
- package/dist/examples/finetune/llamacpp-finetune.js +5 -3
- package/dist/examples/kv-cache-cleanup.js +0 -1
- package/dist/examples/kv-cache-custom-key.js +0 -1
- package/dist/examples/kv-cache-example.js +4 -2
- package/dist/examples/llamacpp-cache.js +0 -1
- package/dist/examples/llamacpp-dynamic-tools.js +4 -2
- package/dist/examples/llamacpp-filesystem.js +1 -1
- package/dist/examples/llamacpp-http.js +1 -1
- package/dist/examples/llamacpp-multi-gpu.js +2 -2
- package/dist/examples/llamacpp-multimodal.js +0 -1
- package/dist/examples/llamacpp-p2p.js +0 -1
- package/dist/examples/llamacpp-sharded.js +1 -1
- package/dist/examples/llamacpp-structured-output.js +0 -1
- package/dist/examples/logging-file-transport.js +0 -1
- package/dist/examples/logging-streaming.js +0 -2
- package/dist/examples/mcp-websearch.js +0 -1
- package/dist/examples/multi-model-demo.js +0 -2
- package/dist/examples/ocr-fasttext.js +0 -1
- package/dist/examples/plugins.js +1 -4
- package/dist/examples/profiling/basic.js +3 -2
- package/dist/examples/profiling/per-call.js +0 -1
- package/dist/examples/quickstart.js +0 -1
- package/dist/examples/rag/rag-chromadb.js +0 -1
- package/dist/examples/rag/rag-hyperdb/cancellation.js +0 -1
- package/dist/examples/rag/rag-hyperdb/ingest.js +0 -1
- package/dist/examples/rag/rag-hyperdb/pipeline.js +0 -1
- package/dist/examples/rag/rag-hyperdb/workspaces.js +0 -1
- package/dist/examples/rag/rag-lancedb.js +0 -1
- package/dist/examples/rag/rag-sqlite.js +0 -1
- package/dist/examples/suspend-resume.js +0 -1
- package/dist/examples/tools/llamacpp-native-tools.js +0 -1
- package/dist/examples/tools/llamacpp-tools-gemma4.js +1 -1
- package/dist/examples/tools/llamacpp-tools-pythonic.js +2 -2
- package/dist/examples/tools/llamacpp-tools-qwen35.js +1 -1
- package/dist/examples/transcription/parakeet-ctc-filesystem.js +1 -1
- package/dist/examples/transcription/parakeet-microphone-record.js +0 -1
- package/dist/examples/transcription/parakeet-microphone-stream.js +0 -1
- package/dist/examples/transcription/parakeet-sortformer.js +1 -2
- package/dist/examples/transcription/parakeet-tdt-filesystem.js +1 -1
- package/dist/examples/transcription/whispercpp-filesystem-streaming.js +10 -6
- package/dist/examples/transcription/whispercpp-filesystem.js +4 -2
- package/dist/examples/transcription/whispercpp-microphone-conversation.js +0 -1
- package/dist/examples/transcription/whispercpp-microphone-record.js +0 -1
- package/dist/examples/transcription/whispercpp-prompt.js +0 -1
- package/dist/examples/translation/translation-bergamot-batch.js +1 -2
- package/dist/examples/translation/translation-bergamot-pivot.js +3 -4
- package/dist/examples/translation/translation-bergamot.js +1 -2
- package/dist/examples/translation/translation-indic.js +1 -2
- package/dist/examples/translation/translation-llm-afriquegemma.js +3 -4
- package/dist/examples/translation/translation-llm-context.js +1 -2
- package/dist/examples/translation/translation-llm.js +2 -3
- package/dist/examples/translation/translation-stream.js +2 -3
- package/dist/examples/tts/chatterbox.js +1 -2
- package/dist/examples/tts/llm-to-tts-streaming.js +2 -4
- package/dist/examples/tts/supertonic-multilingual.js +1 -2
- package/dist/examples/tts/supertonic.js +1 -2
- package/dist/examples/vla-pi05.d.ts +2 -0
- package/dist/examples/vla-pi05.js +84 -0
- package/dist/examples/vla-smolvla.js +1 -1
- package/dist/examples/voice-assistant/voice-assistant.js +1 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -7
- package/dist/models/registry/models.d.ts +869 -186
- package/dist/models/registry/models.js +3160 -2453
- package/dist/models/update-models/companions.d.ts +7 -0
- package/dist/models/update-models/companions.js +56 -0
- package/dist/models/update-models/naming.js +10 -0
- package/dist/pear/pre.js +2 -0
- package/dist/schemas/bci-config.d.ts +36 -0
- package/dist/schemas/bci-config.js +56 -0
- package/dist/schemas/bci.d.ts +177 -0
- package/dist/schemas/bci.js +95 -0
- package/dist/schemas/common.d.ts +395 -51
- package/dist/schemas/common.js +5 -0
- package/dist/schemas/completion-event.d.ts +1 -0
- package/dist/schemas/download-asset.d.ts +7 -3
- package/dist/schemas/embed.d.ts +2 -0
- package/dist/schemas/embed.js +1 -0
- package/dist/schemas/engine-addon-map.d.ts +1 -0
- package/dist/schemas/engine-addon-map.js +4 -1
- package/dist/schemas/get-model-info.d.ts +2 -0
- package/dist/schemas/get-model-info.js +1 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/llamacpp-config.d.ts +6 -2
- package/dist/schemas/load-model.d.ts +1841 -267
- package/dist/schemas/load-model.js +34 -1
- package/dist/schemas/model-src-utils.d.ts +10 -2
- package/dist/schemas/model-types.d.ts +19 -1
- package/dist/schemas/model-types.js +11 -0
- package/dist/schemas/ocr.d.ts +2 -0
- package/dist/schemas/plugin.d.ts +13 -5
- package/dist/schemas/plugin.js +13 -4
- package/dist/schemas/registry.d.ts +18 -0
- package/dist/schemas/registry.js +2 -0
- package/dist/schemas/reload-config.d.ts +10 -2
- package/dist/schemas/sdcpp-config.d.ts +75 -8
- package/dist/schemas/sdcpp-config.js +56 -10
- package/dist/schemas/sdk-config.d.ts +342 -0
- package/dist/schemas/text-to-speech.d.ts +8 -0
- package/dist/schemas/transcription-config.d.ts +2 -0
- package/dist/schemas/transcription.d.ts +12 -0
- package/dist/schemas/transcription.js +8 -0
- package/dist/schemas/translation-config.d.ts +44 -16
- package/dist/schemas/translation-config.js +2 -0
- package/dist/schemas/vla.d.ts +14 -0
- package/dist/schemas/vla.js +26 -3
- package/dist/server/bare/delegate-connect-diagnostics.d.ts +9 -0
- package/dist/server/bare/delegate-connect-diagnostics.js +44 -0
- package/dist/server/bare/delegate-rpc-client.js +10 -12
- package/dist/server/bare/hyperswarm.js +1 -0
- package/dist/server/bare/ops/bci-transcribe.d.ts +13 -0
- package/dist/server/bare/ops/bci-transcribe.js +248 -0
- package/dist/server/bare/ops/embed.js +2 -1
- package/dist/server/bare/ops/kv-cache-utils.js +4 -3
- package/dist/server/bare/ops/transcribe.js +6 -2
- package/dist/server/bare/ops/translate.js +1 -1
- package/dist/server/bare/plugins/bci-whispercpp-transcription/plugin.d.ts +130 -0
- package/dist/server/bare/plugins/bci-whispercpp-transcription/plugin.js +116 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-run.js +4 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.d.ts +7 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.js +1 -1
- package/dist/server/bare/plugins/index.d.ts +1 -0
- package/dist/server/bare/plugins/index.js +1 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/finetune.js +22 -29
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +2 -0
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +38 -7
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.d.ts +1 -0
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +9 -1
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +14 -0
- package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +2 -0
- package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +8 -0
- package/dist/server/bare/plugins/sdcpp-generation/ops/video.js +7 -1
- package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +58 -4
- package/dist/server/bare/plugins/sdcpp-generation/plugin.js +9 -4
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +10 -0
- package/dist/server/bare/registry/model-config-utils.js +3 -0
- package/dist/server/bare/runtime/request-registry-singleton.js +11 -4
- package/dist/server/bare/runtime/request-registry.d.ts +60 -16
- package/dist/server/bare/runtime/request-registry.js +258 -15
- package/dist/server/bare/runtime/with-request-context.d.ts +1 -1
- package/dist/server/bare/runtime/with-request-context.js +1 -1
- package/dist/server/bare/types/addon-responses.d.ts +5 -0
- package/dist/server/rpc/handler-registry.js +4 -0
- package/dist/server/rpc/handlers/bci-transcribe-stream.d.ts +3 -0
- package/dist/server/rpc/handlers/bci-transcribe-stream.js +4 -0
- package/dist/server/rpc/handlers/bci-transcribe.d.ts +3 -0
- package/dist/server/rpc/handlers/bci-transcribe.js +4 -0
- package/dist/server/rpc/handlers/download-asset.js +1 -1
- package/dist/server/rpc/handlers/get-model-info.js +3 -3
- package/dist/server/rpc/handlers/index.d.ts +4 -0
- package/dist/server/rpc/handlers/index.js +4 -0
- package/dist/server/rpc/handlers/load-model/download-manager.d.ts +1 -1
- package/dist/server/rpc/handlers/load-model/handler.js +1 -1
- package/dist/server/rpc/handlers/load-model/http.js +6 -6
- package/dist/server/rpc/handlers/load-model/hyperdrive.js +1 -0
- package/dist/server/rpc/handlers/load-model/registry-companion-set.d.ts +1 -0
- package/dist/server/rpc/handlers/load-model/registry-companion-set.js +2 -2
- package/dist/server/rpc/handlers/load-model/registry.js +1 -0
- package/dist/server/rpc/handlers/load-model/resolve-session.d.ts +1 -1
- package/dist/server/rpc/handlers/rag.js +5 -5
- package/dist/server/utils/checksum.js +2 -1
- package/dist/server/utils/formatting.js +2 -1
- package/dist/server/utils/multi-gpu-mobile.d.ts +5 -0
- package/dist/server/utils/multi-gpu-mobile.js +10 -0
- package/dist/server/worker.js +2 -1
- package/dist/utils/aggregate-events.d.ts +2 -1
- package/dist/utils/aggregate-events.js +11 -3
- package/dist/utils/errors-server.d.ts +6 -4
- package/dist/utils/errors-server.js +6 -4
- package/electron-forge/index.cjs +820 -0
- package/package.json +68 -35
- package/dist/scripts/run-security-tests-bare.d.ts +0 -2
- package/dist/scripts/run-security-tests-bare.js +0 -78
|
@@ -3,7 +3,6 @@ try {
|
|
|
3
3
|
// Load the model
|
|
4
4
|
const modelId = await loadModel({
|
|
5
5
|
modelSrc: LLAMA_3_2_1B_INST_Q4_0,
|
|
6
|
-
modelType: "llm",
|
|
7
6
|
modelConfig: {
|
|
8
7
|
device: "gpu",
|
|
9
8
|
ctx_size: 2048,
|
|
@@ -32,7 +31,10 @@ try {
|
|
|
32
31
|
console.log("🔄 Continuing conversation (reusing previous turn cache):");
|
|
33
32
|
const history2 = [
|
|
34
33
|
{ role: "user", content: "What is the capital of France?" },
|
|
35
|
-
{
|
|
34
|
+
{
|
|
35
|
+
role: "assistant",
|
|
36
|
+
content: final1.cacheableAssistantContent ?? final1.contentText,
|
|
37
|
+
},
|
|
36
38
|
{ role: "user", content: "What about Germany?" },
|
|
37
39
|
];
|
|
38
40
|
// Auto-keyed caching should:
|
|
@@ -105,7 +105,6 @@ async function chatTurn({ modelId, kvCache, history, tools }) {
|
|
|
105
105
|
async function main() {
|
|
106
106
|
const modelId = await loadModel({
|
|
107
107
|
modelSrc: QWEN3_1_7B_INST_Q4,
|
|
108
|
-
modelType: "llm",
|
|
109
108
|
modelConfig: {
|
|
110
109
|
ctx_size: 4096,
|
|
111
110
|
tools: true,
|
|
@@ -128,7 +127,10 @@ async function main() {
|
|
|
128
127
|
await chatTurn({ modelId, kvCache, history, tools: weatherTools });
|
|
129
128
|
// Turn 2 — same session, swap to horoscope tools. Dynamic mode lets the
|
|
130
129
|
// model see a different tool set without invalidating the kv-cache.
|
|
131
|
-
history.push({
|
|
130
|
+
history.push({
|
|
131
|
+
role: "user",
|
|
132
|
+
content: "Now check my horoscope for Aquarius.",
|
|
133
|
+
});
|
|
132
134
|
console.log("\n\n🤖 Turn 2 (tools=horoscope):\n");
|
|
133
135
|
await chatTurn({ modelId, kvCache, history, tools: horoscopeTools });
|
|
134
136
|
// Turn 3 — swap to a parameterless tool to confirm empty-arg flows work.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { completion, loadModel, unloadModel, VERBOSITY, LLAMA_3_2_1B_INST_Q4_0 } from "@qvac/sdk";
|
|
1
|
+
import { completion, loadModel, unloadModel, VERBOSITY, LLAMA_3_2_1B_INST_Q4_0, } from "@qvac/sdk";
|
|
2
2
|
// Multi-GPU inference distributes a model across multiple GPUs using llama.cpp's
|
|
3
3
|
// built-in split modes. Two strategies are available:
|
|
4
4
|
//
|
|
@@ -16,7 +16,7 @@ const modelSrc = process.argv[2] ?? LLAMA_3_2_1B_INST_Q4_0;
|
|
|
16
16
|
try {
|
|
17
17
|
const modelId = await loadModel({
|
|
18
18
|
modelSrc,
|
|
19
|
-
modelType: "
|
|
19
|
+
modelType: "llamacpp-completion",
|
|
20
20
|
modelConfig: {
|
|
21
21
|
"split-mode": "layer",
|
|
22
22
|
"tensor-split": "1,1",
|
|
@@ -8,7 +8,7 @@ import { completion, loadModel, unloadModel, VERBOSITY } from "@qvac/sdk";
|
|
|
8
8
|
try {
|
|
9
9
|
const modelId = await loadModel({
|
|
10
10
|
modelSrc: "https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF/resolve/main/qwen2.5-coder-7b-instruct-q4_0-00001-of-00002.gguf",
|
|
11
|
-
modelType: "
|
|
11
|
+
modelType: "llamacpp-completion",
|
|
12
12
|
modelConfig: {
|
|
13
13
|
device: "gpu",
|
|
14
14
|
ctx_size: 2048,
|
|
@@ -58,7 +58,6 @@ async function runToContent(run) {
|
|
|
58
58
|
try {
|
|
59
59
|
const modelId = await loadModel({
|
|
60
60
|
modelSrc: QWEN3_600M_INST_Q4,
|
|
61
|
-
modelType: "llm",
|
|
62
61
|
onProgress: (p) => process.stdout.write(`\rLoading: ${p.percentage.toFixed(1)}%`),
|
|
63
62
|
});
|
|
64
63
|
console.log(`\nModel loaded: ${modelId}\n`);
|
|
@@ -16,7 +16,6 @@ try {
|
|
|
16
16
|
console.log("📥 Loading models (watch SDK logs above)...\n");
|
|
17
17
|
const llmModelId = await loadModel({
|
|
18
18
|
modelSrc: LLAMA_3_2_1B_INST_Q4_0,
|
|
19
|
-
modelType: "llm",
|
|
20
19
|
modelConfig: {
|
|
21
20
|
ctx_size: 2048,
|
|
22
21
|
temp: 0.7,
|
|
@@ -25,7 +24,6 @@ try {
|
|
|
25
24
|
});
|
|
26
25
|
const embedModelId = await loadModel({
|
|
27
26
|
modelSrc: GTE_LARGE_FP16,
|
|
28
|
-
modelType: "embeddings",
|
|
29
27
|
});
|
|
30
28
|
console.log("📡 Starting model-specific log streams...\n");
|
|
31
29
|
(async () => {
|
|
@@ -2,14 +2,12 @@ import { completion, LLAMA_3_2_1B_INST_Q4_0, loadModel, QWEN3_1_7B_INST_Q4, unlo
|
|
|
2
2
|
try {
|
|
3
3
|
const alice = await loadModel({
|
|
4
4
|
modelSrc: QWEN3_1_7B_INST_Q4,
|
|
5
|
-
modelType: "llm",
|
|
6
5
|
modelConfig: {
|
|
7
6
|
ctx_size: 4096,
|
|
8
7
|
},
|
|
9
8
|
});
|
|
10
9
|
const bob = await loadModel({
|
|
11
10
|
modelSrc: LLAMA_3_2_1B_INST_Q4_0,
|
|
12
|
-
modelType: "llm",
|
|
13
11
|
modelConfig: {
|
|
14
12
|
ctx_size: 4096,
|
|
15
13
|
},
|
package/dist/examples/plugins.js
CHANGED
|
@@ -47,7 +47,6 @@ console.log("1. LLM Completion (llamacpp-completion plugin)");
|
|
|
47
47
|
try {
|
|
48
48
|
const llmModelId = await loadModel({
|
|
49
49
|
modelSrc: LLAMA_3_2_1B_INST_Q4_0,
|
|
50
|
-
modelType: "llm",
|
|
51
50
|
modelConfig: { ctx_size: 2048 },
|
|
52
51
|
onProgress: (p) => console.log(` Loading LLM: ${p.percentage.toFixed(1)}%`),
|
|
53
52
|
});
|
|
@@ -75,7 +74,6 @@ console.log("2. Translation (nmtcpp-translation plugin)");
|
|
|
75
74
|
try {
|
|
76
75
|
const nmtModelId = await loadModel({
|
|
77
76
|
modelSrc: BERGAMOT_EN_ES,
|
|
78
|
-
modelType: "nmt",
|
|
79
77
|
modelConfig: {
|
|
80
78
|
engine: "Bergamot",
|
|
81
79
|
from: "en",
|
|
@@ -88,7 +86,7 @@ try {
|
|
|
88
86
|
const result = translate({
|
|
89
87
|
modelId: nmtModelId,
|
|
90
88
|
text,
|
|
91
|
-
modelType: "
|
|
89
|
+
modelType: "nmtcpp-translation",
|
|
92
90
|
stream: false,
|
|
93
91
|
});
|
|
94
92
|
const translated = await result.text;
|
|
@@ -105,7 +103,6 @@ console.log(" Attempting to load an embeddings model...\n");
|
|
|
105
103
|
try {
|
|
106
104
|
const embedModelId = await loadModel({
|
|
107
105
|
modelSrc: GTE_LARGE_FP16,
|
|
108
|
-
modelType: "embeddings",
|
|
109
106
|
});
|
|
110
107
|
await embed({ modelId: embedModelId, text: "test" });
|
|
111
108
|
console.error(" ❌ Unexpected: embed succeeded without the plugin!");
|
|
@@ -8,7 +8,6 @@ try {
|
|
|
8
8
|
console.log("Profiler enabled:", profiler.isEnabled());
|
|
9
9
|
const modelId = await loadModel({
|
|
10
10
|
modelSrc: LLAMA_3_2_1B_INST_Q4_0,
|
|
11
|
-
modelType: "llm",
|
|
12
11
|
onProgress: (p) => console.log(` ${p.percentage.toFixed(1)}%`),
|
|
13
12
|
});
|
|
14
13
|
console.log("Model loaded:", modelId);
|
|
@@ -54,7 +53,9 @@ try {
|
|
|
54
53
|
else {
|
|
55
54
|
console.log(" (no loadModel handler event captured)");
|
|
56
55
|
// Debug: show what ops are available
|
|
57
|
-
const ops = [
|
|
56
|
+
const ops = [
|
|
57
|
+
...new Set(json.recentEvents?.map((e) => `${e.op}:${e.kind}`) ?? []),
|
|
58
|
+
];
|
|
58
59
|
console.log(" Available ops:", ops.join(", "));
|
|
59
60
|
}
|
|
60
61
|
console.log("\n=== Profiler JSON (structure) ===");
|
|
@@ -4,7 +4,6 @@ try {
|
|
|
4
4
|
console.log("Profiler globally enabled:", profiler.isEnabled());
|
|
5
5
|
const modelId = await loadModel({
|
|
6
6
|
modelSrc: GTE_LARGE_FP16,
|
|
7
|
-
modelType: "embeddings",
|
|
8
7
|
onProgress: (p) => console.log(` ${p.percentage.toFixed(1)}%`),
|
|
9
8
|
});
|
|
10
9
|
console.log("Model loaded:", modelId);
|
|
@@ -22,7 +22,7 @@ let modelId;
|
|
|
22
22
|
try {
|
|
23
23
|
modelId = await loadModel({
|
|
24
24
|
modelSrc,
|
|
25
|
-
modelType: "
|
|
25
|
+
modelType: "llamacpp-completion",
|
|
26
26
|
modelConfig: { ctx_size: 4096, tools: true },
|
|
27
27
|
onProgress: (progress) => console.log(`Loading: ${progress.percentage.toFixed(1)}%`),
|
|
28
28
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { completion, loadModel, unloadModel
|
|
1
|
+
import { completion, loadModel, unloadModel } from "@qvac/sdk";
|
|
2
2
|
import { tools } from "./shared.js";
|
|
3
3
|
const LFM_TOOL_HF = "https://huggingface.co/LiquidAI/LFM2-1.2B-Tool-GGUF/resolve/main/LFM2-1.2B-Tool-Q4_K_M.gguf";
|
|
4
4
|
try {
|
|
5
5
|
const modelId = await loadModel({
|
|
6
6
|
modelSrc: LFM_TOOL_HF,
|
|
7
|
-
modelType: "
|
|
7
|
+
modelType: "llamacpp-completion",
|
|
8
8
|
modelConfig: { ctx_size: 4096, tools: true },
|
|
9
9
|
onProgress: (progress) => console.log(`Loading: ${progress.percentage.toFixed(1)}%`),
|
|
10
10
|
});
|
|
@@ -18,7 +18,7 @@ let modelId;
|
|
|
18
18
|
try {
|
|
19
19
|
modelId = await loadModel({
|
|
20
20
|
modelSrc,
|
|
21
|
-
modelType: "
|
|
21
|
+
modelType: "llamacpp-completion",
|
|
22
22
|
modelConfig: { ctx_size: 4096, tools: true },
|
|
23
23
|
onProgress: (progress) => console.log(`Loading: ${progress.percentage.toFixed(1)}%`),
|
|
24
24
|
});
|
|
@@ -24,7 +24,7 @@ try {
|
|
|
24
24
|
console.log("Loading Parakeet CTC model...");
|
|
25
25
|
const modelId = await loadModel({
|
|
26
26
|
modelSrc: parakeetModelSrc,
|
|
27
|
-
modelType: "parakeet",
|
|
27
|
+
modelType: "parakeet-transcription",
|
|
28
28
|
onProgress: (progress) => {
|
|
29
29
|
console.log(`Download progress: ${progress.percentage.toFixed(1)}%`);
|
|
30
30
|
},
|
|
@@ -29,7 +29,6 @@ catch {
|
|
|
29
29
|
console.log("Loading Parakeet model...");
|
|
30
30
|
const modelId = await loadModel({
|
|
31
31
|
modelSrc: PARAKEET_TDT_0_6B_V3_Q8_0,
|
|
32
|
-
modelType: "parakeet",
|
|
33
32
|
onProgress: (p) => console.log(`Download: ${p.percentage.toFixed(1)}%`),
|
|
34
33
|
});
|
|
35
34
|
console.log("Model loaded.\n");
|
|
@@ -43,7 +43,6 @@ try {
|
|
|
43
43
|
console.log("Loading Parakeet (EOU) streaming model...");
|
|
44
44
|
modelId = await loadModel({
|
|
45
45
|
modelSrc: PARAKEET_EOU_120M_V1_Q8_0,
|
|
46
|
-
modelType: "parakeet",
|
|
47
46
|
onProgress: (p) => console.log(`Download: ${p.percentage.toFixed(1)}%`),
|
|
48
47
|
});
|
|
49
48
|
console.log("Model loaded.\n");
|
|
@@ -27,7 +27,7 @@ try {
|
|
|
27
27
|
// ── Step 1: Diarize with Sortformer ──
|
|
28
28
|
const sfModelId = await loadModel({
|
|
29
29
|
modelSrc: sortformerSrc,
|
|
30
|
-
modelType: "parakeet",
|
|
30
|
+
modelType: "parakeet-transcription",
|
|
31
31
|
});
|
|
32
32
|
const diarization = await transcribe({
|
|
33
33
|
modelId: sfModelId,
|
|
@@ -38,7 +38,6 @@ try {
|
|
|
38
38
|
// ── Step 2: Transcribe each segment with TDT ──
|
|
39
39
|
const tdtModelId = await loadModel({
|
|
40
40
|
modelSrc: PARAKEET_TDT_0_6B_V3_Q8_0,
|
|
41
|
-
modelType: "parakeet",
|
|
42
41
|
});
|
|
43
42
|
const pcm = readPcm(audioFilePath);
|
|
44
43
|
const sliceDir = join(tmpdir(), `qvac-diarize-${Date.now()}`);
|
|
@@ -25,7 +25,7 @@ try {
|
|
|
25
25
|
console.log("Loading Parakeet model...");
|
|
26
26
|
const modelId = await loadModel({
|
|
27
27
|
modelSrc: parakeetModelSrc,
|
|
28
|
-
modelType: "parakeet",
|
|
28
|
+
modelType: "parakeet-transcription",
|
|
29
29
|
onProgress: (progress) => {
|
|
30
30
|
console.log(`Download progress: ${progress.percentage.toFixed(1)}%`);
|
|
31
31
|
},
|
|
@@ -29,7 +29,6 @@ try {
|
|
|
29
29
|
console.log("Loading model...");
|
|
30
30
|
const modelId = await loadModel({
|
|
31
31
|
modelSrc: WHISPER_TINY,
|
|
32
|
-
modelType: "whisper",
|
|
33
32
|
modelConfig: {
|
|
34
33
|
vadModelSrc: VAD_SILERO_5_1_2,
|
|
35
34
|
audio_format: "f32le",
|
|
@@ -54,11 +53,16 @@ try {
|
|
|
54
53
|
const session = await transcribeStream({ modelId, metadata: true });
|
|
55
54
|
console.log("Session open. Streaming audio...\n");
|
|
56
55
|
const ffmpeg = spawn("ffmpeg", [
|
|
57
|
-
"-i",
|
|
58
|
-
|
|
59
|
-
"-
|
|
60
|
-
|
|
61
|
-
"-
|
|
56
|
+
"-i",
|
|
57
|
+
SAMPLE_FILE,
|
|
58
|
+
"-ar",
|
|
59
|
+
String(SAMPLE_RATE),
|
|
60
|
+
"-ac",
|
|
61
|
+
"1",
|
|
62
|
+
"-sample_fmt",
|
|
63
|
+
"flt",
|
|
64
|
+
"-f",
|
|
65
|
+
"f32le",
|
|
62
66
|
"pipe:1",
|
|
63
67
|
], { stdio: ["ignore", "pipe", "ignore"] });
|
|
64
68
|
let totalBytes = 0;
|
|
@@ -12,7 +12,6 @@ try {
|
|
|
12
12
|
console.log("📥 Loading Whisper model...");
|
|
13
13
|
const modelId = await loadModel({
|
|
14
14
|
modelSrc: WHISPER_TINY,
|
|
15
|
-
modelType: "whisper",
|
|
16
15
|
modelConfig: {
|
|
17
16
|
audio_format: "f32le",
|
|
18
17
|
// Sampling strategy
|
|
@@ -66,7 +65,10 @@ try {
|
|
|
66
65
|
const end = (segment.endMs / 1000).toFixed(2);
|
|
67
66
|
console.log(` [${start}s → ${end}s] (id=${segment.id}, append=${segment.append}) ${segment.text}`);
|
|
68
67
|
}
|
|
69
|
-
console.log(`\nFull transcript: ${segments
|
|
68
|
+
console.log(`\nFull transcript: ${segments
|
|
69
|
+
.map((s) => s.text)
|
|
70
|
+
.join("")
|
|
71
|
+
.trim()}`);
|
|
70
72
|
// Unload the model when done
|
|
71
73
|
console.log("🧹 Unloading Whisper model...");
|
|
72
74
|
await unloadModel({ modelId });
|
|
@@ -2,7 +2,6 @@ import { loadModel, translate, unloadModel, BERGAMOT_EN_FR } from "@qvac/sdk";
|
|
|
2
2
|
try {
|
|
3
3
|
const modelId = await loadModel({
|
|
4
4
|
modelSrc: BERGAMOT_EN_FR,
|
|
5
|
-
modelType: "nmt",
|
|
6
5
|
modelConfig: {
|
|
7
6
|
engine: "Bergamot",
|
|
8
7
|
from: "en",
|
|
@@ -30,7 +29,7 @@ try {
|
|
|
30
29
|
const result = translate({
|
|
31
30
|
modelId,
|
|
32
31
|
text: texts, // Pass array for batch processing
|
|
33
|
-
modelType: "
|
|
32
|
+
modelType: "nmtcpp-translation",
|
|
34
33
|
stream: false,
|
|
35
34
|
});
|
|
36
35
|
const translatedText = await result.text;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BERGAMOT_ES_EN, BERGAMOT_EN_IT, loadModel, translate, unloadModel } from "@qvac/sdk";
|
|
1
|
+
import { BERGAMOT_ES_EN, BERGAMOT_EN_IT, loadModel, translate, unloadModel, } from "@qvac/sdk";
|
|
2
2
|
/**
|
|
3
3
|
* Example: Pivot Translation with Bergamot
|
|
4
4
|
*
|
|
@@ -17,7 +17,6 @@ try {
|
|
|
17
17
|
// Load the primary model (Spanish → English) with pivot configuration
|
|
18
18
|
const modelId = await loadModel({
|
|
19
19
|
modelSrc: BERGAMOT_ES_EN, // Primary model: Spanish → English
|
|
20
|
-
modelType: "nmt",
|
|
21
20
|
modelConfig: {
|
|
22
21
|
engine: "Bergamot",
|
|
23
22
|
from: "es",
|
|
@@ -35,7 +34,7 @@ try {
|
|
|
35
34
|
topk: 100,
|
|
36
35
|
normalize: 1,
|
|
37
36
|
lengthpenalty: 1.2,
|
|
38
|
-
}
|
|
37
|
+
},
|
|
39
38
|
},
|
|
40
39
|
onProgress: (progress) => {
|
|
41
40
|
console.log(progress);
|
|
@@ -54,7 +53,7 @@ try {
|
|
|
54
53
|
const result = translate({
|
|
55
54
|
modelId,
|
|
56
55
|
text: spanishText,
|
|
57
|
-
modelType: "
|
|
56
|
+
modelType: "nmtcpp-translation",
|
|
58
57
|
stream: false,
|
|
59
58
|
});
|
|
60
59
|
const italianText = await result.text;
|
|
@@ -6,7 +6,6 @@ try {
|
|
|
6
6
|
// - dstVocabSrc: target vocabulary file (optional)
|
|
7
7
|
const modelId = await loadModel({
|
|
8
8
|
modelSrc: BERGAMOT_EN_FR,
|
|
9
|
-
modelType: "nmt",
|
|
10
9
|
modelConfig: {
|
|
11
10
|
engine: "Bergamot",
|
|
12
11
|
from: "en",
|
|
@@ -26,7 +25,7 @@ try {
|
|
|
26
25
|
const result = translate({
|
|
27
26
|
modelId,
|
|
28
27
|
text,
|
|
29
|
-
modelType: "
|
|
28
|
+
modelType: "nmtcpp-translation",
|
|
30
29
|
stream: false,
|
|
31
30
|
});
|
|
32
31
|
const translatedText = await result.text;
|
|
@@ -5,7 +5,6 @@ import { loadModel, translate, unloadModel, MARIAN_EN_HI_INDIC_1B_Q4_0, } from "
|
|
|
5
5
|
try {
|
|
6
6
|
const modelId = await loadModel({
|
|
7
7
|
modelSrc: MARIAN_EN_HI_INDIC_1B_Q4_0,
|
|
8
|
-
modelType: "nmt",
|
|
9
8
|
onProgress: (progress) => {
|
|
10
9
|
console.log(progress);
|
|
11
10
|
},
|
|
@@ -20,7 +19,7 @@ try {
|
|
|
20
19
|
const result = translate({
|
|
21
20
|
modelId,
|
|
22
21
|
text,
|
|
23
|
-
modelType: "
|
|
22
|
+
modelType: "nmtcpp-translation",
|
|
24
23
|
stream: false,
|
|
25
24
|
});
|
|
26
25
|
const translatedText = await result.text;
|
|
@@ -2,7 +2,6 @@ import { translate, loadModel, unloadModel, AFRICAN_4B_TRANSLATION_Q4_K_M, } fro
|
|
|
2
2
|
try {
|
|
3
3
|
const modelId = await loadModel({
|
|
4
4
|
modelSrc: AFRICAN_4B_TRANSLATION_Q4_K_M,
|
|
5
|
-
modelType: "llm",
|
|
6
5
|
onProgress: (progress) => {
|
|
7
6
|
console.log(progress);
|
|
8
7
|
},
|
|
@@ -16,8 +15,8 @@ try {
|
|
|
16
15
|
repeat_penalty: 1,
|
|
17
16
|
seed: 42,
|
|
18
17
|
predict: 256,
|
|
19
|
-
stop_sequences: [
|
|
20
|
-
}
|
|
18
|
+
stop_sequences: ["\n"],
|
|
19
|
+
},
|
|
21
20
|
});
|
|
22
21
|
// With explicit source language
|
|
23
22
|
const engText = "Hello, how are you today?";
|
|
@@ -26,7 +25,7 @@ try {
|
|
|
26
25
|
text: engText,
|
|
27
26
|
from: "en",
|
|
28
27
|
to: "swh_Latn",
|
|
29
|
-
modelType: "
|
|
28
|
+
modelType: "llamacpp-completion",
|
|
30
29
|
stream: false,
|
|
31
30
|
});
|
|
32
31
|
const translatedTextExplicit = await resultExplicit.text;
|
|
@@ -2,7 +2,6 @@ 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
|
-
modelType: "llm",
|
|
6
5
|
onProgress: (progress) => {
|
|
7
6
|
console.log(progress);
|
|
8
7
|
},
|
|
@@ -15,7 +14,7 @@ try {
|
|
|
15
14
|
text: engText,
|
|
16
15
|
from: "en",
|
|
17
16
|
to: "es",
|
|
18
|
-
modelType: "
|
|
17
|
+
modelType: "llamacpp-completion",
|
|
19
18
|
context: "Use formal language, letter for financial institution",
|
|
20
19
|
stream: false,
|
|
21
20
|
});
|