@qvac/sdk 0.5.0 → 0.6.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/README.md +48 -11
- package/bare-imports.json +35 -0
- package/dist/client/api/cancel.d.ts +12 -3
- package/dist/client/api/cancel.js +12 -3
- package/dist/client/api/get-model-info.d.ts +2 -2
- package/dist/client/api/get-model-info.js +2 -2
- package/dist/client/api/index.d.ts +2 -1
- package/dist/client/api/index.js +2 -1
- package/dist/client/api/load-model.js +6 -1
- package/dist/client/api/ocr.d.ts +31 -0
- package/dist/client/api/ocr.js +88 -0
- package/dist/client/api/rag.d.ts +215 -20
- package/dist/client/api/rag.js +382 -23
- package/dist/client/api/translate.js +10 -11
- package/dist/client/api/unload-model.js +1 -1
- package/dist/client/init-hooks.d.ts +4 -3
- package/dist/client/init-hooks.js +40 -31
- package/dist/client/rpc/bare-client.d.ts +1 -178
- package/dist/client/rpc/bare-client.js +42 -9
- package/dist/client/rpc/expo-rpc-client.js +57 -2
- package/dist/client/rpc/node-rpc-client.js +5 -1
- package/dist/client/rpc/rpc-client.d.ts +1 -1
- package/dist/client/rpc/rpc-client.js +11 -57
- package/dist/examples/config/blind-relay/blind-relay.config.d.ts +5 -0
- package/dist/examples/config/blind-relay/blind-relay.config.js +7 -0
- package/dist/examples/config/default/default.config.d.ts +8 -0
- package/dist/examples/config/default/default.config.js +6 -0
- package/dist/examples/default-config-usage.d.ts +17 -0
- package/dist/examples/default-config-usage.js +47 -0
- package/dist/examples/delegated-inference/consumer.js +1 -0
- package/dist/examples/download-with-blind-relays.js +4 -3
- package/dist/examples/embed-hyperdrive.js +4 -0
- package/dist/examples/kv-cache-custom-key.js +16 -1
- package/dist/examples/llamacpp-sharded.js +12 -3
- package/dist/examples/ocr-fasttext.d.ts +2 -0
- package/dist/examples/ocr-fasttext.js +52 -0
- package/dist/examples/quickstart.d.ts +2 -0
- package/dist/examples/quickstart.js +28 -0
- package/dist/examples/rag/rag-hyperdb/cancellation.d.ts +2 -0
- package/dist/examples/rag/rag-hyperdb/cancellation.js +75 -0
- package/dist/examples/rag/rag-hyperdb/ingest.d.ts +2 -0
- package/dist/examples/rag/{rag-hyperdb.js → rag-hyperdb/ingest.js} +10 -4
- package/dist/examples/rag/rag-hyperdb/pipeline.d.ts +2 -0
- package/dist/examples/rag/rag-hyperdb/pipeline.js +74 -0
- package/dist/examples/rag/rag-hyperdb/workspaces.d.ts +2 -0
- package/dist/examples/rag/rag-hyperdb/workspaces.js +178 -0
- package/dist/examples/translation/translation-bergamot-batch.d.ts +2 -0
- package/dist/examples/translation/translation-bergamot-batch.js +49 -0
- package/dist/examples/translation/translation-bergamot.d.ts +2 -0
- package/dist/examples/translation/translation-bergamot.js +39 -0
- package/dist/examples/translation/translation-indic.js +1 -0
- package/dist/examples/translation/translation-opus.js +1 -0
- package/dist/examples/translation/translation-stream.js +1 -0
- package/dist/expo/plugins/withMobileBundle.js +29 -10
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -1
- package/dist/logging/addon.js +23 -7
- package/dist/logging/base-logger.js +2 -2
- package/dist/logging/client-logger.js +15 -4
- package/dist/logging/index.d.ts +1 -0
- package/dist/logging/index.js +1 -0
- package/dist/logging/logger.js +11 -3
- package/dist/logging/namespaces.d.ts +1 -0
- package/dist/logging/namespaces.js +1 -0
- package/dist/logging/registry.d.ts +5 -0
- package/dist/logging/registry.js +17 -5
- package/dist/logging/transport.js +2 -2
- package/dist/logging/utils.d.ts +2 -0
- package/dist/logging/utils.js +62 -0
- package/dist/models/hyperdrive/models.d.ts +1096 -178
- package/dist/models/hyperdrive/models.js +1476 -507
- package/dist/schemas/archive.d.ts +9 -0
- package/dist/schemas/archive.js +17 -0
- package/dist/schemas/cancel.d.ts +6 -0
- package/dist/schemas/cancel.js +5 -0
- package/dist/schemas/common.d.ts +582 -77
- package/dist/schemas/common.js +6 -1
- package/dist/schemas/delegate.d.ts +1 -0
- package/dist/schemas/delegate.js +1 -0
- package/dist/schemas/download-asset.d.ts +21 -9
- package/dist/schemas/get-model-info.d.ts +12 -10
- package/dist/schemas/get-model-info.js +9 -1
- package/dist/schemas/index.d.ts +6 -2
- package/dist/schemas/index.js +9 -2
- package/dist/schemas/llamacpp-config.d.ts +112 -8
- package/dist/schemas/llamacpp-config.js +40 -8
- package/dist/schemas/load-model.d.ts +2993 -525
- package/dist/schemas/load-model.js +88 -33
- package/dist/schemas/logging-stream.d.ts +2 -2
- package/dist/schemas/model-src-utils.d.ts +38 -16
- package/dist/schemas/model-src-utils.js +4 -8
- package/dist/schemas/model-types.d.ts +154 -0
- package/dist/schemas/model-types.js +140 -0
- package/dist/schemas/ocr.d.ts +88 -0
- package/dist/schemas/ocr.js +52 -0
- package/dist/schemas/rag.d.ts +183 -52
- package/dist/schemas/rag.js +148 -23
- package/dist/schemas/reload-config.d.ts +20 -8
- package/dist/schemas/reload-config.js +7 -5
- package/dist/schemas/runtime-context.d.ts +19 -0
- package/dist/schemas/runtime-context.js +7 -0
- package/dist/schemas/sdk-config.d.ts +697 -2
- package/dist/schemas/sdk-config.js +99 -1
- package/dist/schemas/sdk-errors-client.d.ts +1 -0
- package/dist/schemas/sdk-errors-client.js +5 -0
- package/dist/schemas/sdk-errors-server.d.ts +14 -0
- package/dist/schemas/sdk-errors-server.js +70 -0
- package/dist/schemas/shard.d.ts +21 -0
- package/dist/schemas/shard.js +17 -0
- package/dist/schemas/translate.d.ts +68 -23
- package/dist/schemas/translate.js +37 -11
- package/dist/schemas/translation-config.d.ts +272 -29
- package/dist/schemas/translation-config.js +63 -6
- package/dist/scripts/run-unit-tests.d.ts +2 -0
- package/dist/scripts/run-unit-tests.js +17 -0
- package/dist/server/bare/addons/llamacpp-completion/cache-logger.d.ts +6 -0
- package/dist/server/bare/addons/llamacpp-completion/cache-logger.js +34 -0
- package/dist/server/bare/addons/{llamacpp → llamacpp-completion}/create-model.d.ts +1 -5
- package/dist/server/bare/addons/{llamacpp → llamacpp-completion}/create-model.js +3 -26
- package/dist/server/bare/addons/{llamacpp → llamacpp-completion}/handlers/completion-stream.js +26 -7
- package/dist/server/bare/addons/llamacpp-completion/index.d.ts +4 -0
- package/dist/server/bare/addons/llamacpp-completion/index.js +3 -0
- package/dist/server/bare/addons/{llamacpp → llamacpp-completion}/kv-cache-utils.d.ts +4 -1
- package/dist/server/bare/addons/{llamacpp → llamacpp-completion}/kv-cache-utils.js +43 -10
- package/dist/server/bare/addons/llamacpp-embedding/create-model.d.ts +8 -0
- package/dist/server/bare/addons/llamacpp-embedding/create-model.js +38 -0
- package/dist/server/bare/addons/llamacpp-embedding/index.d.ts +3 -0
- package/dist/server/bare/addons/llamacpp-embedding/index.js +2 -0
- package/dist/server/bare/addons/load-model.js +28 -24
- package/dist/server/bare/addons/{translation → nmtcpp-translation}/create-model.js +23 -8
- package/dist/server/bare/addons/{translation → nmtcpp-translation}/handlers/translate.js +35 -11
- package/dist/server/bare/addons/onnx-ocr/create-model.d.ts +10 -0
- package/dist/server/bare/addons/onnx-ocr/create-model.js +39 -0
- package/dist/server/bare/addons/onnx-ocr/handlers/ocr-stream.d.ts +10 -0
- package/dist/server/bare/addons/onnx-ocr/handlers/ocr-stream.js +109 -0
- package/dist/server/bare/addons/onnx-ocr/index.d.ts +3 -0
- package/dist/server/bare/addons/onnx-ocr/index.js +2 -0
- package/dist/server/bare/addons/{whispercpp → whispercpp-transcription}/create-model.js +2 -1
- package/dist/server/bare/delegate-rpc-client.js +19 -1
- package/dist/server/bare/rag-hyperdb/handlers/chunk.d.ts +3 -0
- package/dist/server/bare/rag-hyperdb/handlers/chunk.js +7 -0
- package/dist/server/bare/rag-hyperdb/handlers/close-workspace.d.ts +3 -0
- package/dist/server/bare/rag-hyperdb/handlers/close-workspace.js +9 -0
- package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.js +9 -10
- package/dist/server/bare/rag-hyperdb/handlers/delete-workspace.d.ts +3 -0
- package/dist/server/bare/rag-hyperdb/handlers/delete-workspace.js +14 -0
- package/dist/server/bare/rag-hyperdb/handlers/ingest.d.ts +9 -0
- package/dist/server/bare/rag-hyperdb/handlers/ingest.js +18 -0
- package/dist/server/bare/rag-hyperdb/handlers/list-workspaces.d.ts +3 -0
- package/dist/server/bare/rag-hyperdb/handlers/list-workspaces.js +4 -0
- package/dist/server/bare/rag-hyperdb/handlers/reindex.d.ts +9 -0
- package/dist/server/bare/rag-hyperdb/handlers/reindex.js +16 -0
- package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.d.ts +7 -4
- package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.js +13 -14
- package/dist/server/bare/rag-hyperdb/handlers/search.js +10 -10
- package/dist/server/bare/rag-hyperdb/index.d.ts +8 -1
- package/dist/server/bare/rag-hyperdb/index.js +8 -1
- package/dist/server/bare/rag-hyperdb/rag-operation-manager.d.ts +7 -0
- package/dist/server/bare/rag-hyperdb/rag-operation-manager.js +39 -0
- package/dist/server/bare/rag-hyperdb/rag-workspace-manager.d.ts +15 -0
- package/dist/server/bare/rag-hyperdb/rag-workspace-manager.js +135 -0
- package/dist/server/bare/registry/config-registry.js +11 -0
- package/dist/server/bare/registry/logging-stream-registry.js +3 -3
- package/dist/server/bare/registry/model-config-registry.d.ts +4 -0
- package/dist/server/bare/registry/model-config-registry.js +15 -0
- package/dist/server/bare/registry/model-config-utils.d.ts +15 -0
- package/dist/server/bare/registry/model-config-utils.js +121 -0
- package/dist/server/bare/registry/model-registry.d.ts +6 -29
- package/dist/server/bare/registry/runtime-context-registry.d.ts +7 -0
- package/dist/server/bare/registry/runtime-context-registry.js +26 -0
- package/dist/server/bare/utils/loader-adapter.d.ts +7 -0
- package/dist/server/bare/utils/loader-adapter.js +9 -0
- package/dist/server/error-handlers.js +4 -2
- package/dist/server/rpc/handle-request.js +91 -9
- package/dist/server/rpc/handlers/cancelHandler.js +10 -1
- package/dist/server/rpc/handlers/completion-stream.js +1 -1
- package/dist/server/rpc/handlers/delete-cache.js +1 -1
- package/dist/server/rpc/handlers/embed.js +1 -1
- package/dist/server/rpc/handlers/get-model-info.d.ts +1 -1
- package/dist/server/rpc/handlers/get-model-info.js +22 -10
- package/dist/server/rpc/handlers/index.d.ts +4 -1
- package/dist/server/rpc/handlers/index.js +2 -0
- package/dist/server/rpc/handlers/load-model/download-manager.d.ts +11 -11
- package/dist/server/rpc/handlers/load-model/download-manager.js +36 -26
- package/dist/server/rpc/handlers/{load-model.d.ts → load-model/handler.d.ts} +2 -2
- package/dist/server/rpc/handlers/load-model/handler.js +179 -0
- package/dist/server/rpc/handlers/load-model/http.js +342 -33
- package/dist/server/rpc/handlers/load-model/hyperdrive.js +5 -3
- package/dist/server/rpc/handlers/load-model/index.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/index.js +2 -2
- package/dist/server/rpc/handlers/load-model/resolve.js +32 -3
- package/dist/server/rpc/handlers/load-model-delegated.js +6 -3
- package/dist/server/rpc/handlers/ocr-stream.d.ts +3 -0
- package/dist/server/rpc/handlers/ocr-stream.js +39 -0
- package/dist/server/rpc/handlers/rag.d.ts +2 -2
- package/dist/server/rpc/handlers/rag.js +107 -43
- package/dist/server/rpc/handlers/text-to-speech.js +1 -1
- package/dist/server/rpc/handlers/transcribe-stream.js +1 -1
- package/dist/server/rpc/handlers/translate.js +6 -15
- package/dist/server/utils/archive.d.ts +3 -0
- package/dist/server/utils/archive.js +171 -0
- package/dist/server/utils/audio/decoder.js +2 -2
- package/dist/server/utils/cache.d.ts +5 -5
- package/dist/server/utils/cache.js +6 -6
- package/dist/server/utils/config-transform.d.ts +2 -2
- package/dist/server/utils/config-transform.js +8 -6
- package/dist/server/utils/formatting.d.ts +13 -0
- package/dist/server/utils/formatting.js +26 -0
- package/dist/server/utils/gguf-tensor-extractor.d.ts +15 -0
- package/dist/server/utils/gguf-tensor-extractor.js +314 -0
- package/dist/server/utils/index.d.ts +3 -1
- package/dist/server/utils/index.js +3 -1
- package/dist/server/utils/shard-utils.d.ts +42 -16
- package/dist/server/utils/shard-utils.js +95 -7
- package/dist/server/worker.js +8 -3
- package/dist/utils/errors-base.d.ts +1 -1
- package/dist/utils/errors-base.js +2 -2
- package/dist/utils/errors-client.d.ts +12 -0
- package/dist/utils/errors-client.js +20 -0
- package/dist/utils/errors-server.d.ts +33 -0
- package/dist/utils/errors-server.js +55 -0
- package/package.json +40 -15
- package/dist/client/rpc/bare-rpc-client.d.ts +0 -4
- package/dist/client/rpc/bare-rpc-client.js +0 -94
- package/dist/examples/config/config-path.d.ts +0 -8
- package/dist/examples/config/config-path.js +0 -13
- package/dist/examples/rag/rag-hyperdb-workspaces.d.ts +0 -2
- package/dist/examples/rag/rag-hyperdb-workspaces.js +0 -106
- package/dist/examples/rag/rag-hyperdb.d.ts +0 -2
- package/dist/server/bare/addons/llamacpp/index.d.ts +0 -4
- package/dist/server/bare/addons/llamacpp/index.js +0 -3
- package/dist/server/bare/rag-hyperdb/rag-manager.d.ts +0 -5
- package/dist/server/bare/rag-hyperdb/rag-manager.js +0 -66
- package/dist/server/rpc/handlers/load-model.js +0 -111
- package/dist/server/utils/hash.d.ts +0 -5
- package/dist/server/utils/hash.js +0 -11
- package/dist/utils/getProcessSafe.d.ts +0 -7
- package/dist/utils/getProcessSafe.js +0 -17
- package/dist/utils/runtime.d.ts +0 -30
- package/dist/utils/runtime.js +0 -48
- /package/dist/server/bare/addons/{llamacpp → llamacpp-completion}/handlers/completion-stream.d.ts +0 -0
- /package/dist/server/bare/addons/{llamacpp → llamacpp-embedding}/handlers/embed.d.ts +0 -0
- /package/dist/server/bare/addons/{llamacpp → llamacpp-embedding}/handlers/embed.js +0 -0
- /package/dist/server/bare/addons/{translation → nmtcpp-translation}/create-model.d.ts +0 -0
- /package/dist/server/bare/addons/{translation → nmtcpp-translation}/handlers/translate.d.ts +0 -0
- /package/dist/server/bare/addons/{translation → nmtcpp-translation}/index.d.ts +0 -0
- /package/dist/server/bare/addons/{translation → nmtcpp-translation}/index.js +0 -0
- /package/dist/server/bare/addons/{tts → onnx-tts}/create-model.d.ts +0 -0
- /package/dist/server/bare/addons/{tts → onnx-tts}/create-model.js +0 -0
- /package/dist/server/bare/addons/{tts → onnx-tts}/handlers/text-to-speech.d.ts +0 -0
- /package/dist/server/bare/addons/{tts → onnx-tts}/handlers/text-to-speech.js +0 -0
- /package/dist/server/bare/addons/{tts → onnx-tts}/index.d.ts +0 -0
- /package/dist/server/bare/addons/{tts → onnx-tts}/index.js +0 -0
- /package/dist/server/bare/addons/{whispercpp → whispercpp-transcription}/create-model.d.ts +0 -0
- /package/dist/server/bare/addons/{whispercpp → whispercpp-transcription}/handlers/transcribe-stream.d.ts +0 -0
- /package/dist/server/bare/addons/{whispercpp → whispercpp-transcription}/handlers/transcribe-stream.js +0 -0
- /package/dist/server/bare/addons/{whispercpp → whispercpp-transcription}/index.d.ts +0 -0
- /package/dist/server/bare/addons/{whispercpp → whispercpp-transcription}/index.js +0 -0
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { llmConfigBaseSchema, embedConfigBaseSchema, } from "./llamacpp-config.js";
|
|
3
3
|
import { whisperConfigSchema } from "./whispercpp-config.js";
|
|
4
4
|
import { delegateSchema } from "./delegate.js";
|
|
5
5
|
import { nmtConfigSchema } from "./translation-config.js";
|
|
6
6
|
import { ttsConfigSchema } from "./text-to-speech.js";
|
|
7
|
+
import { ocrConfigSchema } from "./ocr.js";
|
|
7
8
|
import { modelSrcInputSchema, modelInputToSrcSchema, modelInputToNameSchema, } from "./model-src-utils.js";
|
|
9
|
+
import { llmModelTypeSchema, whisperModelTypeSchema, embeddingsModelTypeSchema, nmtModelTypeSchema, ttsModelTypeSchema, ocrModelTypeSchema, ModelType, } from "./model-types.js";
|
|
8
10
|
import { reloadConfigRequestSchema } from "./reload-config.js";
|
|
9
11
|
const loadModelOptionsBaseSchema = z.union([
|
|
10
12
|
z.object({
|
|
11
13
|
modelSrc: modelSrcInputSchema,
|
|
12
|
-
modelType:
|
|
13
|
-
modelConfig:
|
|
14
|
+
modelType: llmModelTypeSchema,
|
|
15
|
+
modelConfig: llmConfigBaseSchema.strict().optional(),
|
|
14
16
|
seed: z.boolean().optional(),
|
|
15
17
|
projectionModelSrc: modelSrcInputSchema.optional(),
|
|
16
18
|
delegate: delegateSchema,
|
|
@@ -18,7 +20,7 @@ const loadModelOptionsBaseSchema = z.union([
|
|
|
18
20
|
}),
|
|
19
21
|
z.object({
|
|
20
22
|
modelSrc: modelSrcInputSchema,
|
|
21
|
-
modelType:
|
|
23
|
+
modelType: whisperModelTypeSchema,
|
|
22
24
|
modelConfig: whisperConfigSchema.partial().strict().optional(),
|
|
23
25
|
seed: z.boolean().optional(),
|
|
24
26
|
vadModelSrc: modelSrcInputSchema.optional(),
|
|
@@ -26,27 +28,37 @@ const loadModelOptionsBaseSchema = z.union([
|
|
|
26
28
|
}),
|
|
27
29
|
z.object({
|
|
28
30
|
modelSrc: modelSrcInputSchema,
|
|
29
|
-
modelType:
|
|
30
|
-
modelConfig:
|
|
31
|
+
modelType: embeddingsModelTypeSchema,
|
|
32
|
+
modelConfig: embedConfigBaseSchema.strict().optional(),
|
|
31
33
|
seed: z.boolean().optional(),
|
|
32
34
|
delegate: delegateSchema,
|
|
33
35
|
}),
|
|
34
36
|
z.object({
|
|
35
37
|
modelSrc: modelSrcInputSchema,
|
|
36
|
-
modelType:
|
|
38
|
+
modelType: nmtModelTypeSchema,
|
|
37
39
|
modelConfig: nmtConfigSchema,
|
|
40
|
+
srcVocabSrc: modelSrcInputSchema.optional(),
|
|
41
|
+
dstVocabSrc: modelSrcInputSchema.optional(),
|
|
38
42
|
seed: z.boolean().optional(),
|
|
39
43
|
delegate: delegateSchema,
|
|
40
44
|
}),
|
|
41
45
|
z.object({
|
|
42
46
|
modelSrc: modelSrcInputSchema,
|
|
43
|
-
modelType:
|
|
47
|
+
modelType: ttsModelTypeSchema,
|
|
44
48
|
modelConfig: ttsConfigSchema,
|
|
45
49
|
configSrc: modelSrcInputSchema,
|
|
46
50
|
eSpeakDataPath: z.string(),
|
|
47
51
|
seed: z.boolean().optional(),
|
|
48
52
|
delegate: delegateSchema,
|
|
49
53
|
}),
|
|
54
|
+
z.object({
|
|
55
|
+
modelSrc: modelSrcInputSchema,
|
|
56
|
+
modelType: ocrModelTypeSchema,
|
|
57
|
+
modelConfig: ocrConfigSchema.partial().strict().optional(),
|
|
58
|
+
detectorModelSrc: modelSrcInputSchema.optional(),
|
|
59
|
+
seed: z.boolean().optional(),
|
|
60
|
+
delegate: delegateSchema,
|
|
61
|
+
}),
|
|
50
62
|
]);
|
|
51
63
|
export const loadModelOptionsSchema = loadModelOptionsBaseSchema.transform((data) => ({
|
|
52
64
|
...data,
|
|
@@ -56,8 +68,8 @@ export const loadModelOptionsToRequestSchema = z.union([
|
|
|
56
68
|
z
|
|
57
69
|
.object({
|
|
58
70
|
modelSrc: modelSrcInputSchema,
|
|
59
|
-
modelType:
|
|
60
|
-
modelConfig:
|
|
71
|
+
modelType: llmModelTypeSchema,
|
|
72
|
+
modelConfig: llmConfigBaseSchema.strict().optional(),
|
|
61
73
|
seed: z.boolean().optional(),
|
|
62
74
|
projectionModelSrc: modelSrcInputSchema.optional(),
|
|
63
75
|
delegate: delegateSchema,
|
|
@@ -67,7 +79,7 @@ export const loadModelOptionsToRequestSchema = z.union([
|
|
|
67
79
|
})
|
|
68
80
|
.transform((data) => ({
|
|
69
81
|
type: "loadModel",
|
|
70
|
-
modelType:
|
|
82
|
+
modelType: ModelType.llamacppCompletion,
|
|
71
83
|
modelSrc: modelInputToSrcSchema.parse(data.modelSrc),
|
|
72
84
|
modelName: modelInputToNameSchema.parse(data.modelSrc),
|
|
73
85
|
modelConfig: (data.modelConfig ?? {}),
|
|
@@ -81,7 +93,7 @@ export const loadModelOptionsToRequestSchema = z.union([
|
|
|
81
93
|
z
|
|
82
94
|
.object({
|
|
83
95
|
modelSrc: modelSrcInputSchema,
|
|
84
|
-
modelType:
|
|
96
|
+
modelType: whisperModelTypeSchema,
|
|
85
97
|
modelConfig: whisperConfigSchema.partial().strict().optional(),
|
|
86
98
|
seed: z.boolean().optional(),
|
|
87
99
|
vadModelSrc: modelSrcInputSchema.optional(),
|
|
@@ -91,7 +103,7 @@ export const loadModelOptionsToRequestSchema = z.union([
|
|
|
91
103
|
})
|
|
92
104
|
.transform((data) => ({
|
|
93
105
|
type: "loadModel",
|
|
94
|
-
modelType:
|
|
106
|
+
modelType: ModelType.whispercppTranscription,
|
|
95
107
|
modelSrc: modelInputToSrcSchema.parse(data.modelSrc),
|
|
96
108
|
modelName: modelInputToNameSchema.parse(data.modelSrc),
|
|
97
109
|
modelConfig: (data.modelConfig ?? {}),
|
|
@@ -105,8 +117,8 @@ export const loadModelOptionsToRequestSchema = z.union([
|
|
|
105
117
|
z
|
|
106
118
|
.object({
|
|
107
119
|
modelSrc: modelSrcInputSchema,
|
|
108
|
-
modelType:
|
|
109
|
-
modelConfig:
|
|
120
|
+
modelType: embeddingsModelTypeSchema,
|
|
121
|
+
modelConfig: embedConfigBaseSchema.strict().optional(),
|
|
110
122
|
seed: z.boolean().optional(),
|
|
111
123
|
delegate: delegateSchema,
|
|
112
124
|
onProgress: z.unknown().optional(),
|
|
@@ -114,7 +126,7 @@ export const loadModelOptionsToRequestSchema = z.union([
|
|
|
114
126
|
})
|
|
115
127
|
.transform((data) => ({
|
|
116
128
|
type: "loadModel",
|
|
117
|
-
modelType:
|
|
129
|
+
modelType: ModelType.llamacppEmbedding,
|
|
118
130
|
modelSrc: modelInputToSrcSchema.parse(data.modelSrc),
|
|
119
131
|
modelName: modelInputToNameSchema.parse(data.modelSrc),
|
|
120
132
|
modelConfig: (data.modelConfig ?? {}),
|
|
@@ -125,8 +137,10 @@ export const loadModelOptionsToRequestSchema = z.union([
|
|
|
125
137
|
z
|
|
126
138
|
.object({
|
|
127
139
|
modelSrc: modelSrcInputSchema,
|
|
128
|
-
modelType:
|
|
140
|
+
modelType: nmtModelTypeSchema,
|
|
129
141
|
modelConfig: nmtConfigSchema,
|
|
142
|
+
srcVocabSrc: modelSrcInputSchema.optional(),
|
|
143
|
+
dstVocabSrc: modelSrcInputSchema.optional(),
|
|
130
144
|
seed: z.boolean().optional(),
|
|
131
145
|
delegate: delegateSchema,
|
|
132
146
|
onProgress: z.unknown().optional(),
|
|
@@ -134,10 +148,16 @@ export const loadModelOptionsToRequestSchema = z.union([
|
|
|
134
148
|
})
|
|
135
149
|
.transform((data) => ({
|
|
136
150
|
type: "loadModel",
|
|
137
|
-
modelType:
|
|
151
|
+
modelType: ModelType.nmtcppTranslation,
|
|
138
152
|
modelSrc: modelInputToSrcSchema.parse(data.modelSrc),
|
|
139
153
|
modelName: modelInputToNameSchema.parse(data.modelSrc),
|
|
140
154
|
modelConfig: data.modelConfig,
|
|
155
|
+
srcVocabSrc: data.srcVocabSrc
|
|
156
|
+
? modelInputToSrcSchema.parse(data.srcVocabSrc)
|
|
157
|
+
: undefined,
|
|
158
|
+
dstVocabSrc: data.dstVocabSrc
|
|
159
|
+
? modelInputToSrcSchema.parse(data.dstVocabSrc)
|
|
160
|
+
: undefined,
|
|
141
161
|
seed: data.seed ?? false,
|
|
142
162
|
withProgress: data.withProgress ?? !!data.onProgress,
|
|
143
163
|
delegate: data.delegate,
|
|
@@ -145,7 +165,7 @@ export const loadModelOptionsToRequestSchema = z.union([
|
|
|
145
165
|
z
|
|
146
166
|
.object({
|
|
147
167
|
modelSrc: modelSrcInputSchema,
|
|
148
|
-
modelType:
|
|
168
|
+
modelType: ttsModelTypeSchema,
|
|
149
169
|
modelConfig: ttsConfigSchema,
|
|
150
170
|
configSrc: modelSrcInputSchema,
|
|
151
171
|
eSpeakDataPath: z.string(),
|
|
@@ -156,7 +176,7 @@ export const loadModelOptionsToRequestSchema = z.union([
|
|
|
156
176
|
})
|
|
157
177
|
.transform((data) => ({
|
|
158
178
|
type: "loadModel",
|
|
159
|
-
modelType:
|
|
179
|
+
modelType: ModelType.onnxTts,
|
|
160
180
|
modelSrc: modelInputToSrcSchema.parse(data.modelSrc),
|
|
161
181
|
modelName: modelInputToNameSchema.parse(data.modelSrc),
|
|
162
182
|
modelConfig: data.modelConfig,
|
|
@@ -166,6 +186,30 @@ export const loadModelOptionsToRequestSchema = z.union([
|
|
|
166
186
|
configSrc: modelInputToSrcSchema.parse(data.configSrc),
|
|
167
187
|
eSpeakDataPath: data.eSpeakDataPath,
|
|
168
188
|
})),
|
|
189
|
+
z
|
|
190
|
+
.object({
|
|
191
|
+
modelSrc: modelSrcInputSchema,
|
|
192
|
+
modelType: ocrModelTypeSchema,
|
|
193
|
+
modelConfig: ocrConfigSchema.partial().strict().optional(),
|
|
194
|
+
detectorModelSrc: modelSrcInputSchema.optional(),
|
|
195
|
+
seed: z.boolean().optional(),
|
|
196
|
+
delegate: delegateSchema,
|
|
197
|
+
onProgress: z.unknown().optional(),
|
|
198
|
+
withProgress: z.boolean().optional(),
|
|
199
|
+
})
|
|
200
|
+
.transform((data) => ({
|
|
201
|
+
type: "loadModel",
|
|
202
|
+
modelType: ModelType.onnxOcr,
|
|
203
|
+
modelSrc: modelInputToSrcSchema.parse(data.modelSrc),
|
|
204
|
+
modelName: modelInputToNameSchema.parse(data.modelSrc),
|
|
205
|
+
modelConfig: (data.modelConfig ?? {}),
|
|
206
|
+
seed: data.seed ?? false,
|
|
207
|
+
withProgress: data.withProgress ?? !!data.onProgress,
|
|
208
|
+
delegate: data.delegate,
|
|
209
|
+
detectorModelSrc: data.detectorModelSrc
|
|
210
|
+
? modelInputToSrcSchema.parse(data.detectorModelSrc)
|
|
211
|
+
: undefined,
|
|
212
|
+
})),
|
|
169
213
|
]);
|
|
170
214
|
const commonModelConfigSchema = z.object({
|
|
171
215
|
type: z.literal("loadModel"),
|
|
@@ -174,41 +218,51 @@ const commonModelConfigSchema = z.object({
|
|
|
174
218
|
projectionModelSrc: z.string().optional(),
|
|
175
219
|
vadModelSrc: z.string().optional(),
|
|
176
220
|
configSrc: z.string().optional(),
|
|
221
|
+
detectorModelSrc: z.string().optional(),
|
|
177
222
|
withProgress: z.boolean().optional(),
|
|
178
223
|
seed: z.boolean().optional(),
|
|
179
224
|
delegate: delegateSchema,
|
|
180
225
|
});
|
|
181
|
-
// Request schemas for each model type
|
|
226
|
+
// Request schemas for each model type (use canonical types since transforms normalize)
|
|
227
|
+
// Use base schemas (no defaults) for client-side validation.
|
|
228
|
+
// Server applies device defaults, then full schema defaults.
|
|
182
229
|
export const loadLlmModelRequestSchema = commonModelConfigSchema.extend({
|
|
183
|
-
modelType: z.literal(
|
|
184
|
-
modelConfig:
|
|
230
|
+
modelType: z.literal(ModelType.llamacppCompletion),
|
|
231
|
+
modelConfig: llmConfigBaseSchema,
|
|
185
232
|
});
|
|
186
233
|
export const loadWhisperModelRequestSchema = commonModelConfigSchema.extend({
|
|
187
|
-
modelType: z.literal(
|
|
188
|
-
modelConfig: whisperConfigSchema,
|
|
234
|
+
modelType: z.literal(ModelType.whispercppTranscription),
|
|
235
|
+
modelConfig: whisperConfigSchema, // whisper has no defaults
|
|
189
236
|
});
|
|
190
237
|
export const loadEmbeddingsModelRequestSchema = commonModelConfigSchema.extend({
|
|
191
|
-
modelType: z.literal(
|
|
192
|
-
modelConfig:
|
|
238
|
+
modelType: z.literal(ModelType.llamacppEmbedding),
|
|
239
|
+
modelConfig: embedConfigBaseSchema,
|
|
193
240
|
});
|
|
194
241
|
export const loadNmtModelRequestSchema = commonModelConfigSchema.extend({
|
|
195
|
-
modelType: z.literal(
|
|
196
|
-
modelConfig: nmtConfigSchema,
|
|
242
|
+
modelType: z.literal(ModelType.nmtcppTranslation),
|
|
243
|
+
modelConfig: nmtConfigSchema, // nmt has no defaults
|
|
244
|
+
srcVocabSrc: z.string().optional(),
|
|
245
|
+
dstVocabSrc: z.string().optional(),
|
|
197
246
|
});
|
|
198
247
|
export const loadTtsModelRequestSchema = commonModelConfigSchema.extend({
|
|
199
|
-
modelType: z.literal(
|
|
200
|
-
modelConfig: ttsConfigSchema,
|
|
248
|
+
modelType: z.literal(ModelType.onnxTts),
|
|
249
|
+
modelConfig: ttsConfigSchema, // tts has no defaults
|
|
201
250
|
configSrc: z.string(),
|
|
202
251
|
eSpeakDataPath: z.string(),
|
|
203
252
|
});
|
|
204
|
-
|
|
253
|
+
export const loadOcrModelRequestSchema = commonModelConfigSchema.extend({
|
|
254
|
+
modelType: z.literal(ModelType.onnxOcr),
|
|
255
|
+
modelConfig: ocrConfigSchema, // ocr has no defaults
|
|
256
|
+
});
|
|
257
|
+
// Union of all load model request types (using z.union since each modelType accepts multiple values)
|
|
205
258
|
export const loadModelSrcRequestSchema = z
|
|
206
|
-
.
|
|
259
|
+
.union([
|
|
207
260
|
loadLlmModelRequestSchema,
|
|
208
261
|
loadWhisperModelRequestSchema,
|
|
209
262
|
loadEmbeddingsModelRequestSchema,
|
|
210
263
|
loadNmtModelRequestSchema,
|
|
211
264
|
loadTtsModelRequestSchema,
|
|
265
|
+
loadOcrModelRequestSchema,
|
|
212
266
|
])
|
|
213
267
|
.transform((data) => ({
|
|
214
268
|
...data,
|
|
@@ -257,5 +311,6 @@ export const loadModelServerParamsSchema = z.object({
|
|
|
257
311
|
vadModelPath: z.string().optional(),
|
|
258
312
|
ttsConfigModelPath: z.string().optional(),
|
|
259
313
|
eSpeakDataPath: z.string().optional(),
|
|
314
|
+
detectorModelPath: z.string().optional(),
|
|
260
315
|
modelName: z.string().optional(),
|
|
261
316
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const logLevelSchema: z.ZodEnum<{
|
|
3
3
|
error: "error";
|
|
4
|
+
off: "off";
|
|
4
5
|
warn: "warn";
|
|
5
6
|
info: "info";
|
|
6
7
|
debug: "debug";
|
|
7
|
-
off: "off";
|
|
8
8
|
}>;
|
|
9
9
|
declare const loggingParamsSchema: z.ZodObject<{
|
|
10
10
|
id: z.ZodString;
|
|
@@ -18,10 +18,10 @@ export declare const loggingStreamResponseSchema: z.ZodObject<{
|
|
|
18
18
|
id: z.ZodString;
|
|
19
19
|
level: z.ZodEnum<{
|
|
20
20
|
error: "error";
|
|
21
|
+
off: "off";
|
|
21
22
|
warn: "warn";
|
|
22
23
|
info: "info";
|
|
23
24
|
debug: "debug";
|
|
24
|
-
off: "off";
|
|
25
25
|
}>;
|
|
26
26
|
namespace: z.ZodString;
|
|
27
27
|
message: z.ZodString;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const MODEL_TYPES: readonly ["llm", "whisper", "embeddings", "nmt", "tts"];
|
|
3
|
-
export type ModelType = (typeof MODEL_TYPES)[number];
|
|
4
2
|
export declare const modelDescriptorSchema: z.ZodObject<{
|
|
5
3
|
src: z.ZodString;
|
|
6
4
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -9,14 +7,20 @@ export declare const modelDescriptorSchema: z.ZodObject<{
|
|
|
9
7
|
hyperbeeKey: z.ZodOptional<z.ZodString>;
|
|
10
8
|
expectedSize: z.ZodOptional<z.ZodNumber>;
|
|
11
9
|
sha256Checksum: z.ZodOptional<z.ZodString>;
|
|
12
|
-
addon: z.ZodOptional<z.ZodEnum<{
|
|
10
|
+
addon: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
11
|
+
"llamacpp-completion": "llamacpp-completion";
|
|
12
|
+
"whispercpp-transcription": "whispercpp-transcription";
|
|
13
|
+
"llamacpp-embedding": "llamacpp-embedding";
|
|
14
|
+
"nmtcpp-translation": "nmtcpp-translation";
|
|
15
|
+
"onnx-tts": "onnx-tts";
|
|
16
|
+
"onnx-ocr": "onnx-ocr";
|
|
13
17
|
llm: "llm";
|
|
14
18
|
whisper: "whisper";
|
|
15
19
|
embeddings: "embeddings";
|
|
16
20
|
nmt: "nmt";
|
|
17
21
|
tts: "tts";
|
|
18
|
-
|
|
19
|
-
}>>;
|
|
22
|
+
ocr: "ocr";
|
|
23
|
+
}>, z.ZodLiteral<"vad">]>>;
|
|
20
24
|
}, z.core.$strip>;
|
|
21
25
|
export declare const modelSrcInputSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
22
26
|
src: z.ZodString;
|
|
@@ -26,14 +30,20 @@ export declare const modelSrcInputSchema: z.ZodUnion<readonly [z.ZodString, z.Zo
|
|
|
26
30
|
hyperbeeKey: z.ZodOptional<z.ZodString>;
|
|
27
31
|
expectedSize: z.ZodOptional<z.ZodNumber>;
|
|
28
32
|
sha256Checksum: z.ZodOptional<z.ZodString>;
|
|
29
|
-
addon: z.ZodOptional<z.ZodEnum<{
|
|
33
|
+
addon: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
34
|
+
"llamacpp-completion": "llamacpp-completion";
|
|
35
|
+
"whispercpp-transcription": "whispercpp-transcription";
|
|
36
|
+
"llamacpp-embedding": "llamacpp-embedding";
|
|
37
|
+
"nmtcpp-translation": "nmtcpp-translation";
|
|
38
|
+
"onnx-tts": "onnx-tts";
|
|
39
|
+
"onnx-ocr": "onnx-ocr";
|
|
30
40
|
llm: "llm";
|
|
31
41
|
whisper: "whisper";
|
|
32
42
|
embeddings: "embeddings";
|
|
33
43
|
nmt: "nmt";
|
|
34
44
|
tts: "tts";
|
|
35
|
-
|
|
36
|
-
}>>;
|
|
45
|
+
ocr: "ocr";
|
|
46
|
+
}>, z.ZodLiteral<"vad">]>>;
|
|
37
47
|
}, z.core.$strip>]>;
|
|
38
48
|
export type ModelDescriptor = z.infer<typeof modelDescriptorSchema>;
|
|
39
49
|
export type ModelSrcInput = z.infer<typeof modelSrcInputSchema>;
|
|
@@ -49,14 +59,20 @@ export declare const modelInputToSrcSchema: z.ZodPipe<z.ZodUnion<readonly [z.Zod
|
|
|
49
59
|
hyperbeeKey: z.ZodOptional<z.ZodString>;
|
|
50
60
|
expectedSize: z.ZodOptional<z.ZodNumber>;
|
|
51
61
|
sha256Checksum: z.ZodOptional<z.ZodString>;
|
|
52
|
-
addon: z.ZodOptional<z.ZodEnum<{
|
|
62
|
+
addon: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
63
|
+
"llamacpp-completion": "llamacpp-completion";
|
|
64
|
+
"whispercpp-transcription": "whispercpp-transcription";
|
|
65
|
+
"llamacpp-embedding": "llamacpp-embedding";
|
|
66
|
+
"nmtcpp-translation": "nmtcpp-translation";
|
|
67
|
+
"onnx-tts": "onnx-tts";
|
|
68
|
+
"onnx-ocr": "onnx-ocr";
|
|
53
69
|
llm: "llm";
|
|
54
70
|
whisper: "whisper";
|
|
55
71
|
embeddings: "embeddings";
|
|
56
72
|
nmt: "nmt";
|
|
57
73
|
tts: "tts";
|
|
58
|
-
|
|
59
|
-
}>>;
|
|
74
|
+
ocr: "ocr";
|
|
75
|
+
}>, z.ZodLiteral<"vad">]>>;
|
|
60
76
|
}, z.core.$strip>]>, z.ZodTransform<string, string | {
|
|
61
77
|
src: string;
|
|
62
78
|
name?: string | undefined;
|
|
@@ -65,7 +81,7 @@ export declare const modelInputToSrcSchema: z.ZodPipe<z.ZodUnion<readonly [z.Zod
|
|
|
65
81
|
hyperbeeKey?: string | undefined;
|
|
66
82
|
expectedSize?: number | undefined;
|
|
67
83
|
sha256Checksum?: string | undefined;
|
|
68
|
-
addon?: "llm" | "whisper" | "embeddings" | "nmt" | "tts" | "vad" | undefined;
|
|
84
|
+
addon?: "llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "onnx-ocr" | "llm" | "whisper" | "embeddings" | "nmt" | "tts" | "ocr" | "vad" | undefined;
|
|
69
85
|
}>>;
|
|
70
86
|
/**
|
|
71
87
|
* Schema that transforms ModelSrc to its optional name
|
|
@@ -79,14 +95,20 @@ export declare const modelInputToNameSchema: z.ZodPipe<z.ZodUnion<readonly [z.Zo
|
|
|
79
95
|
hyperbeeKey: z.ZodOptional<z.ZodString>;
|
|
80
96
|
expectedSize: z.ZodOptional<z.ZodNumber>;
|
|
81
97
|
sha256Checksum: z.ZodOptional<z.ZodString>;
|
|
82
|
-
addon: z.ZodOptional<z.ZodEnum<{
|
|
98
|
+
addon: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
99
|
+
"llamacpp-completion": "llamacpp-completion";
|
|
100
|
+
"whispercpp-transcription": "whispercpp-transcription";
|
|
101
|
+
"llamacpp-embedding": "llamacpp-embedding";
|
|
102
|
+
"nmtcpp-translation": "nmtcpp-translation";
|
|
103
|
+
"onnx-tts": "onnx-tts";
|
|
104
|
+
"onnx-ocr": "onnx-ocr";
|
|
83
105
|
llm: "llm";
|
|
84
106
|
whisper: "whisper";
|
|
85
107
|
embeddings: "embeddings";
|
|
86
108
|
nmt: "nmt";
|
|
87
109
|
tts: "tts";
|
|
88
|
-
|
|
89
|
-
}>>;
|
|
110
|
+
ocr: "ocr";
|
|
111
|
+
}>, z.ZodLiteral<"vad">]>>;
|
|
90
112
|
}, z.core.$strip>]>, z.ZodTransform<string | undefined, string | {
|
|
91
113
|
src: string;
|
|
92
114
|
name?: string | undefined;
|
|
@@ -95,6 +117,6 @@ export declare const modelInputToNameSchema: z.ZodPipe<z.ZodUnion<readonly [z.Zo
|
|
|
95
117
|
hyperbeeKey?: string | undefined;
|
|
96
118
|
expectedSize?: number | undefined;
|
|
97
119
|
sha256Checksum?: string | undefined;
|
|
98
|
-
addon?: "llm" | "whisper" | "embeddings" | "nmt" | "tts" | "vad" | undefined;
|
|
120
|
+
addon?: "llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "onnx-ocr" | "llm" | "whisper" | "embeddings" | "nmt" | "tts" | "ocr" | "vad" | undefined;
|
|
99
121
|
}>>;
|
|
100
122
|
//# sourceMappingURL=model-src-utils.d.ts.map
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"embeddings",
|
|
6
|
-
"nmt",
|
|
7
|
-
"tts",
|
|
8
|
-
];
|
|
2
|
+
import { modelTypeInputSchema } from "./model-types.js";
|
|
3
|
+
// Addon field accepts model type inputs plus "vad"
|
|
4
|
+
const addonSchema = z.union([modelTypeInputSchema, z.literal("vad")]);
|
|
9
5
|
export const modelDescriptorSchema = z.object({
|
|
10
6
|
src: z.string(),
|
|
11
7
|
name: z.string().optional(),
|
|
@@ -14,7 +10,7 @@ export const modelDescriptorSchema = z.object({
|
|
|
14
10
|
hyperbeeKey: z.string().optional(),
|
|
15
11
|
expectedSize: z.number().optional(),
|
|
16
12
|
sha256Checksum: z.string().optional(),
|
|
17
|
-
addon:
|
|
13
|
+
addon: addonSchema.optional(),
|
|
18
14
|
});
|
|
19
15
|
export const modelSrcInputSchema = z.union([z.string(), modelDescriptorSchema]);
|
|
20
16
|
/**
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical model type values for internal SDK use.
|
|
4
|
+
* Format: `engine-usecase` (e.g., "llamacpp-completion")
|
|
5
|
+
* Use dot-accessor syntax: `ModelType.llamacppCompletion`
|
|
6
|
+
*/
|
|
7
|
+
export declare const ModelType: {
|
|
8
|
+
readonly llamacppCompletion: "llamacpp-completion";
|
|
9
|
+
readonly whispercppTranscription: "whispercpp-transcription";
|
|
10
|
+
readonly llamacppEmbedding: "llamacpp-embedding";
|
|
11
|
+
readonly nmtcppTranslation: "nmtcpp-translation";
|
|
12
|
+
readonly onnxTts: "onnx-tts";
|
|
13
|
+
readonly onnxOcr: "onnx-ocr";
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Alias mappings for backward compatibility.
|
|
17
|
+
* Maps old names to canonical values.
|
|
18
|
+
*/
|
|
19
|
+
export declare const ModelTypeAliases: {
|
|
20
|
+
readonly llm: "llamacpp-completion";
|
|
21
|
+
readonly whisper: "whispercpp-transcription";
|
|
22
|
+
readonly embeddings: "llamacpp-embedding";
|
|
23
|
+
readonly nmt: "nmtcpp-translation";
|
|
24
|
+
readonly tts: "onnx-tts";
|
|
25
|
+
readonly ocr: "onnx-ocr";
|
|
26
|
+
};
|
|
27
|
+
export type CanonicalModelType = (typeof ModelType)[keyof typeof ModelType];
|
|
28
|
+
export type AliasKey = keyof typeof ModelTypeAliases;
|
|
29
|
+
export type ModelTypeInput = CanonicalModelType | AliasKey;
|
|
30
|
+
/**
|
|
31
|
+
* All valid model types: canonical names + aliases.
|
|
32
|
+
*
|
|
33
|
+
* Canonical names follow `engine-usecase` format (e.g., "llamacpp-completion").
|
|
34
|
+
* Aliases resolve to canonical names for backward compatibility.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* // Using alias (backward compatible)
|
|
39
|
+
* loadModel({ modelSrc: "...", modelType: MODEL_TYPES.nmt });
|
|
40
|
+
* // MODEL_TYPES.nmt resolves to "nmtcpp-translation"
|
|
41
|
+
*
|
|
42
|
+
* // Using canonical name directly
|
|
43
|
+
* loadModel({ modelSrc: "...", modelType: MODEL_TYPES.nmtcppTranslation });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare const PUBLIC_MODEL_TYPES: {
|
|
47
|
+
readonly llm: "llamacpp-completion";
|
|
48
|
+
readonly whisper: "whispercpp-transcription";
|
|
49
|
+
readonly embeddings: "llamacpp-embedding";
|
|
50
|
+
readonly nmt: "nmtcpp-translation";
|
|
51
|
+
readonly tts: "onnx-tts";
|
|
52
|
+
readonly ocr: "onnx-ocr";
|
|
53
|
+
readonly llamacppCompletion: "llamacpp-completion";
|
|
54
|
+
readonly whispercppTranscription: "whispercpp-transcription";
|
|
55
|
+
readonly llamacppEmbedding: "llamacpp-embedding";
|
|
56
|
+
readonly nmtcppTranslation: "nmtcpp-translation";
|
|
57
|
+
readonly onnxTts: "onnx-tts";
|
|
58
|
+
readonly onnxOcr: "onnx-ocr";
|
|
59
|
+
};
|
|
60
|
+
/** Schema accepting both canonical and alias model type inputs */
|
|
61
|
+
export declare const modelTypeInputSchema: z.ZodEnum<{
|
|
62
|
+
"llamacpp-completion": "llamacpp-completion";
|
|
63
|
+
"whispercpp-transcription": "whispercpp-transcription";
|
|
64
|
+
"llamacpp-embedding": "llamacpp-embedding";
|
|
65
|
+
"nmtcpp-translation": "nmtcpp-translation";
|
|
66
|
+
"onnx-tts": "onnx-tts";
|
|
67
|
+
"onnx-ocr": "onnx-ocr";
|
|
68
|
+
llm: "llm";
|
|
69
|
+
whisper: "whisper";
|
|
70
|
+
embeddings: "embeddings";
|
|
71
|
+
nmt: "nmt";
|
|
72
|
+
tts: "tts";
|
|
73
|
+
ocr: "ocr";
|
|
74
|
+
}>;
|
|
75
|
+
/** Schema that transforms input to canonical model type */
|
|
76
|
+
export declare const modelTypeSchema: z.ZodPipe<z.ZodEnum<{
|
|
77
|
+
"llamacpp-completion": "llamacpp-completion";
|
|
78
|
+
"whispercpp-transcription": "whispercpp-transcription";
|
|
79
|
+
"llamacpp-embedding": "llamacpp-embedding";
|
|
80
|
+
"nmtcpp-translation": "nmtcpp-translation";
|
|
81
|
+
"onnx-tts": "onnx-tts";
|
|
82
|
+
"onnx-ocr": "onnx-ocr";
|
|
83
|
+
llm: "llm";
|
|
84
|
+
whisper: "whisper";
|
|
85
|
+
embeddings: "embeddings";
|
|
86
|
+
nmt: "nmt";
|
|
87
|
+
tts: "tts";
|
|
88
|
+
ocr: "ocr";
|
|
89
|
+
}>, z.ZodTransform<"llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "onnx-ocr", "llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "onnx-ocr" | "llm" | "whisper" | "embeddings" | "nmt" | "tts" | "ocr">>;
|
|
90
|
+
/** Normalize model type input to canonical form */
|
|
91
|
+
export declare function normalizeModelType(input: ModelTypeInput): CanonicalModelType;
|
|
92
|
+
/** Check if input is an alias (not canonical) */
|
|
93
|
+
export declare function isModelTypeAlias(input: ModelTypeInput): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* LLM/Completion model type schema.
|
|
96
|
+
* - Alias: `"llm"` → resolves to `"llamacpp-completion"`
|
|
97
|
+
* - Canonical: `"llamacpp-completion"`
|
|
98
|
+
*/
|
|
99
|
+
export declare const llmModelTypeSchema: z.ZodEnum<{
|
|
100
|
+
"llamacpp-completion": "llamacpp-completion";
|
|
101
|
+
llm: "llm";
|
|
102
|
+
}>;
|
|
103
|
+
export type LlmModelTypeInput = z.infer<typeof llmModelTypeSchema>;
|
|
104
|
+
/**
|
|
105
|
+
* Whisper/Transcription model type schema.
|
|
106
|
+
* - Alias: `"whisper"` → resolves to `"whispercpp-transcription"`
|
|
107
|
+
* - Canonical: `"whispercpp-transcription"`
|
|
108
|
+
*/
|
|
109
|
+
export declare const whisperModelTypeSchema: z.ZodEnum<{
|
|
110
|
+
"whispercpp-transcription": "whispercpp-transcription";
|
|
111
|
+
whisper: "whisper";
|
|
112
|
+
}>;
|
|
113
|
+
export type WhisperModelTypeInput = z.infer<typeof whisperModelTypeSchema>;
|
|
114
|
+
/**
|
|
115
|
+
* Embeddings model type schema.
|
|
116
|
+
* - Alias: `"embeddings"` → resolves to `"llamacpp-embedding"`
|
|
117
|
+
* - Canonical: `"llamacpp-embedding"`
|
|
118
|
+
*/
|
|
119
|
+
export declare const embeddingsModelTypeSchema: z.ZodEnum<{
|
|
120
|
+
"llamacpp-embedding": "llamacpp-embedding";
|
|
121
|
+
embeddings: "embeddings";
|
|
122
|
+
}>;
|
|
123
|
+
export type EmbeddingsModelTypeInput = z.infer<typeof embeddingsModelTypeSchema>;
|
|
124
|
+
/**
|
|
125
|
+
* NMT/Translation model type schema.
|
|
126
|
+
* - Alias: `"nmt"` → resolves to `"nmtcpp-translation"`
|
|
127
|
+
* - Canonical: `"nmtcpp-translation"`
|
|
128
|
+
*/
|
|
129
|
+
export declare const nmtModelTypeSchema: z.ZodEnum<{
|
|
130
|
+
"nmtcpp-translation": "nmtcpp-translation";
|
|
131
|
+
nmt: "nmt";
|
|
132
|
+
}>;
|
|
133
|
+
export type NmtModelTypeInput = z.infer<typeof nmtModelTypeSchema>;
|
|
134
|
+
/**
|
|
135
|
+
* TTS model type schema.
|
|
136
|
+
* - Alias: `"tts"` → resolves to `"onnx-tts"`
|
|
137
|
+
* - Canonical: `"onnx-tts"`
|
|
138
|
+
*/
|
|
139
|
+
export declare const ttsModelTypeSchema: z.ZodEnum<{
|
|
140
|
+
"onnx-tts": "onnx-tts";
|
|
141
|
+
tts: "tts";
|
|
142
|
+
}>;
|
|
143
|
+
export type TtsModelTypeInput = z.infer<typeof ttsModelTypeSchema>;
|
|
144
|
+
/**
|
|
145
|
+
* OCR model type schema.
|
|
146
|
+
* - Alias: `"ocr"` → resolves to `"onnx-ocr"`
|
|
147
|
+
* - Canonical: `"onnx-ocr"`
|
|
148
|
+
*/
|
|
149
|
+
export declare const ocrModelTypeSchema: z.ZodEnum<{
|
|
150
|
+
"onnx-ocr": "onnx-ocr";
|
|
151
|
+
ocr: "ocr";
|
|
152
|
+
}>;
|
|
153
|
+
export type OcrModelTypeInput = z.infer<typeof ocrModelTypeSchema>;
|
|
154
|
+
//# sourceMappingURL=model-types.d.ts.map
|