@qvac/sdk 0.3.0 → 0.4.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 +22 -0
- package/dist/client/api/cancel.d.ts +1 -1
- package/dist/client/api/cancel.js +4 -3
- package/dist/client/api/completion-stream.d.ts +24 -32
- package/dist/client/api/completion-stream.js +142 -50
- package/dist/client/api/delete-cache.js +3 -2
- package/dist/client/api/download-asset.d.ts +3 -3
- package/dist/client/api/download-asset.js +12 -17
- package/dist/client/api/embed.d.ts +1 -1
- package/dist/client/api/embed.js +4 -3
- package/dist/client/api/get-model-info.d.ts +29 -0
- package/dist/client/api/get-model-info.js +14 -0
- package/dist/client/api/index.d.ts +3 -0
- package/dist/client/api/index.js +3 -0
- package/dist/client/api/load-model.d.ts +3 -3
- package/dist/client/api/load-model.js +13 -22
- package/dist/client/api/logging-stream.d.ts +1 -1
- package/dist/client/api/logging-stream.js +3 -2
- package/dist/client/api/ping.d.ts +1 -1
- package/dist/client/api/ping.js +3 -2
- package/dist/client/api/provide.d.ts +1 -1
- package/dist/client/api/provide.js +4 -3
- package/dist/client/api/rag.d.ts +3 -3
- package/dist/client/api/rag.js +13 -12
- package/dist/client/api/set-config.d.ts +7 -0
- package/dist/client/api/set-config.js +20 -0
- package/dist/client/api/stop-provider.d.ts +1 -1
- package/dist/client/api/stop-provider.js +4 -3
- package/dist/client/api/text-to-speech.d.ts +7 -0
- package/dist/client/api/text-to-speech.js +58 -0
- package/dist/client/api/transcribe.d.ts +4 -2
- package/dist/client/api/transcribe.js +9 -5
- package/dist/client/api/translate.d.ts +1 -1
- package/dist/client/api/translate.js +3 -2
- package/dist/client/api/unload-model.d.ts +5 -1
- package/dist/client/api/unload-model.js +14 -4
- package/dist/client/config-manager.d.ts +4 -0
- package/dist/client/config-manager.js +8 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/init-hooks.d.ts +6 -0
- package/dist/client/init-hooks.js +37 -0
- package/dist/client/rpc/bare-client.d.ts +69 -0
- package/dist/client/rpc/bare-client.js +5 -4
- package/dist/client/rpc/bare-rpc-client.js +7 -3
- package/dist/client/rpc/expo-rpc-client.d.ts +1 -0
- package/dist/client/rpc/expo-rpc-client.js +9 -1
- package/dist/client/rpc/node-rpc-client.d.ts +1 -1
- package/dist/client/rpc/node-rpc-client.js +22 -9
- package/dist/client/rpc/rpc-client.d.ts +1 -0
- package/dist/client/rpc/rpc-client.js +20 -1
- package/dist/examples/cache-management.d.ts +2 -0
- package/dist/examples/cache-management.js +97 -0
- package/dist/examples/delegated-inference/consumer.js +2 -2
- package/dist/examples/download-with-blind-relays.d.ts +2 -0
- package/dist/examples/download-with-blind-relays.js +48 -0
- package/dist/examples/download-with-cancel.js +3 -4
- package/dist/examples/embed-hyperdrive.js +0 -1
- 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 +0 -1
- package/dist/examples/llamacpp-file-logging.js +0 -1
- package/dist/examples/llamacpp-filesystem.js +2 -2
- package/dist/examples/llamacpp-http.js +0 -1
- package/dist/examples/llamacpp-hyperdrive.js +0 -1
- package/dist/examples/llamacpp-multimodal.js +0 -1
- package/dist/examples/llamacpp-native-tools.js +118 -36
- package/dist/examples/llamacpp-sharded.d.ts +2 -0
- package/dist/examples/llamacpp-sharded.js +44 -0
- package/dist/examples/multi-model-demo.js +0 -1
- package/dist/examples/parallel-download.js +2 -2
- package/dist/examples/rag/rag-chromadb.js +0 -1
- package/dist/examples/rag/rag-hyperdb-workspaces.js +0 -1
- package/dist/examples/rag/rag-hyperdb.js +0 -1
- package/dist/examples/rag/rag-lancedb.js +0 -1
- package/dist/examples/rag/rag-sqlite.js +0 -1
- package/dist/examples/text-to-speech.d.ts +3 -0
- package/dist/examples/text-to-speech.js +137 -0
- package/dist/examples/translation/translation-indic.js +3 -1
- package/dist/examples/translation/translation-llm-context.js +0 -1
- package/dist/examples/translation/translation-llm.js +2 -2
- package/dist/examples/translation/translation-opus.js +3 -1
- package/dist/examples/translation/translation-stream.js +0 -1
- package/dist/examples/whispercpp-filesystem.js +32 -5
- package/dist/examples/whispercpp-microphone-record.js +9 -9
- package/dist/examples/whispercpp-prompt.d.ts +2 -0
- package/dist/examples/whispercpp-prompt.js +68 -0
- package/dist/expo/plugins/withMobileBundle.js +9 -3
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/models/hyperdrive/models.d.ts +1916 -100
- package/dist/models/hyperdrive/models.js +2042 -102
- package/dist/schemas/common.d.ts +413 -58
- package/dist/schemas/common.js +9 -0
- package/dist/schemas/completion-stream.d.ts +26 -22
- package/dist/schemas/completion-stream.js +9 -23
- package/dist/schemas/download-asset.d.ts +77 -2
- package/dist/schemas/download-asset.js +15 -4
- package/dist/schemas/get-model-info.d.ts +100 -0
- package/dist/schemas/get-model-info.js +40 -0
- package/dist/schemas/index.d.ts +7 -0
- package/dist/schemas/index.js +7 -0
- package/dist/schemas/llamacpp-config.d.ts +2 -1
- package/dist/schemas/llamacpp-config.js +3 -4
- package/dist/schemas/load-model.d.ts +2316 -266
- package/dist/schemas/load-model.js +157 -10
- package/dist/schemas/model-src-utils.d.ts +98 -0
- package/dist/schemas/model-src-utils.js +31 -0
- package/dist/schemas/sdk-errors-client.d.ts +25 -0
- package/dist/schemas/sdk-errors-client.js +111 -0
- package/dist/schemas/sdk-errors-server.d.ts +55 -0
- package/dist/schemas/sdk-errors-server.js +271 -0
- package/dist/schemas/set-config.d.ts +21 -0
- package/dist/schemas/set-config.js +14 -0
- package/dist/schemas/text-to-speech.d.ts +34 -0
- package/dist/schemas/text-to-speech.js +25 -0
- package/dist/schemas/tools.d.ts +62 -0
- package/dist/schemas/tools.js +43 -0
- package/dist/schemas/transcription.d.ts +25 -2
- package/dist/schemas/transcription.js +12 -1
- package/dist/schemas/translation-config.d.ts +33 -5
- package/dist/schemas/translation-config.js +18 -1
- package/dist/schemas/unload-model.d.ts +2 -0
- package/dist/schemas/unload-model.js +2 -0
- package/dist/schemas/whispercpp-config.d.ts +55 -18
- package/dist/schemas/whispercpp-config.js +63 -15
- package/dist/server/bare/addons/cancel.js +2 -1
- package/dist/server/bare/addons/llamacpp/create-model.d.ts +9 -2
- package/dist/server/bare/addons/llamacpp/create-model.js +23 -23
- package/dist/server/bare/addons/llamacpp/handlers/completion-stream.d.ts +10 -2
- package/dist/server/bare/addons/llamacpp/handlers/completion-stream.js +62 -43
- package/dist/server/bare/addons/llamacpp/handlers/embed.js +3 -2
- package/dist/server/bare/addons/llamacpp/kv-cache-utils.d.ts +1 -1
- package/dist/server/bare/addons/llamacpp/kv-cache-utils.js +6 -2
- package/dist/server/bare/addons/load-model.js +59 -28
- package/dist/server/bare/addons/translation/create-model.d.ts +5 -1
- package/dist/server/bare/addons/translation/create-model.js +17 -25
- package/dist/server/bare/addons/translation/handlers/translate.js +10 -1
- package/dist/server/bare/addons/tts/create-model.d.ts +10 -0
- package/dist/server/bare/addons/tts/create-model.js +25 -0
- package/dist/server/bare/addons/tts/handlers/text-to-speech.d.ts +3 -0
- package/dist/server/bare/addons/tts/handlers/text-to-speech.js +87 -0
- package/dist/server/bare/addons/tts/index.d.ts +3 -0
- package/dist/server/bare/addons/tts/index.js +2 -0
- package/dist/server/bare/addons/unload-model.js +21 -3
- package/dist/server/bare/addons/whispercpp/create-model.d.ts +5 -1
- package/dist/server/bare/addons/whispercpp/create-model.js +13 -32
- package/dist/server/bare/addons/whispercpp/handlers/transcribe-stream.js +41 -20
- package/dist/server/bare/delegate-rpc-client.js +3 -2
- package/dist/server/bare/hyperswarm.d.ts +3 -0
- package/dist/server/bare/hyperswarm.js +22 -1
- package/dist/server/bare/rag-hyperdb/rag-manager.js +2 -3
- package/dist/server/bare/registry/config-registry.d.ts +5 -0
- package/dist/server/bare/registry/config-registry.js +39 -0
- package/dist/server/bare/registry/model-registry.d.ts +13 -0
- package/dist/server/bare/registry/model-registry.js +24 -7
- package/dist/server/rpc/handle-request.js +42 -3
- package/dist/server/rpc/handlers/completion-stream-delegated.js +2 -1
- package/dist/server/rpc/handlers/completion-stream.js +11 -4
- package/dist/server/rpc/handlers/download-asset.js +2 -3
- package/dist/server/rpc/handlers/get-model-info.d.ts +3 -0
- package/dist/server/rpc/handlers/get-model-info.js +148 -0
- package/dist/server/rpc/handlers/index.d.ts +4 -0
- package/dist/server/rpc/handlers/index.js +6 -0
- package/dist/server/rpc/handlers/load-model/http.js +51 -10
- package/dist/server/rpc/handlers/load-model/hyperdrive.js +336 -156
- package/dist/server/rpc/handlers/load-model/index.js +1 -1
- package/dist/server/rpc/handlers/load-model/resolve.d.ts +1 -1
- package/dist/server/rpc/handlers/load-model/resolve.js +10 -6
- package/dist/server/rpc/handlers/load-model-delegated.js +7 -4
- package/dist/server/rpc/handlers/load-model.js +19 -1
- package/dist/server/rpc/handlers/provideHandler/handler.js +2 -1
- package/dist/server/rpc/handlers/rag.js +0 -3
- package/dist/server/rpc/handlers/set-config.d.ts +3 -0
- package/dist/server/rpc/handlers/set-config.js +18 -0
- package/dist/server/rpc/handlers/stopProvideHandler.js +3 -1
- package/dist/server/rpc/handlers/text-to-speech.d.ts +3 -0
- package/dist/server/rpc/handlers/text-to-speech.js +7 -0
- package/dist/server/rpc/handlers/transcribe-stream.js +6 -2
- package/dist/server/rpc/handlers/unload-model.js +7 -0
- package/dist/server/utils/cache.d.ts +13 -8
- package/dist/server/utils/cache.js +69 -14
- package/dist/server/utils/checksum.d.ts +2 -0
- package/dist/server/utils/checksum.js +24 -0
- package/dist/server/utils/index.d.ts +2 -0
- package/dist/server/utils/index.js +2 -0
- package/dist/server/utils/shard-utils.d.ts +22 -0
- package/dist/server/utils/shard-utils.js +37 -0
- package/dist/server/utils/tool-integration.d.ts +13 -0
- package/dist/server/utils/tool-integration.js +43 -0
- package/dist/server/utils/tool-parser.d.ts +7 -0
- package/dist/server/utils/tool-parser.js +244 -0
- package/dist/utils/errors-base.d.ts +3 -0
- package/dist/utils/errors-base.js +13 -0
- package/dist/utils/errors-client.d.ts +107 -0
- package/dist/utils/errors-client.js +186 -0
- package/dist/utils/errors-server.d.ts +146 -0
- package/dist/utils/errors-server.js +253 -0
- package/dist/utils/tool-helpers.d.ts +17 -0
- package/dist/utils/tool-helpers.js +99 -0
- package/package.json +12 -8
- package/dist/examples/llamacpp-tools-routing.d.ts +0 -2
- package/dist/examples/llamacpp-tools-routing.js +0 -364
- package/dist/examples/llamacpp-tools.d.ts +0 -2
- package/dist/examples/llamacpp-tools.js +0 -81
- package/dist/server/http-server.d.ts +0 -2
- package/dist/server/http-server.js +0 -189
package/dist/schemas/common.js
CHANGED
|
@@ -11,9 +11,12 @@ import { provideRequestSchema, provideResponseSchema } from "./provide.js";
|
|
|
11
11
|
import { stopProvideRequestSchema, stopProvideResponseSchema, } from "./stop-provide.js";
|
|
12
12
|
import { translateRequestSchema, translateResponseSchema } from "./translate.js";
|
|
13
13
|
import { loggingStreamRequestSchema, loggingStreamResponseSchema, } from "./logging-stream.js";
|
|
14
|
+
import { ttsRequestSchema, ttsResponseSchema } from "./text-to-speech.js";
|
|
14
15
|
import { errorResponseSchema } from "./error.js";
|
|
15
16
|
import { ragRequestSchema, ragResponseSchema } from "./rag.js";
|
|
16
17
|
import { deleteCacheRequestSchema, deleteCacheResponseSchema, } from "./delete-cache.js";
|
|
18
|
+
import { setConfigRequestSchema, setConfigResponseSchema } from "./set-config.js";
|
|
19
|
+
import { getModelInfoRequestSchema, getModelInfoResponseSchema, } from "./get-model-info.js";
|
|
17
20
|
export const requestSchema = z.union([
|
|
18
21
|
pingRequestSchema,
|
|
19
22
|
loadModelRequestSchema,
|
|
@@ -24,11 +27,14 @@ export const requestSchema = z.union([
|
|
|
24
27
|
loggingStreamRequestSchema,
|
|
25
28
|
embedRequestSchema,
|
|
26
29
|
translateRequestSchema,
|
|
30
|
+
ttsRequestSchema,
|
|
27
31
|
cancelRequestSchema,
|
|
28
32
|
provideRequestSchema,
|
|
29
33
|
stopProvideRequestSchema,
|
|
30
34
|
ragRequestSchema,
|
|
31
35
|
deleteCacheRequestSchema,
|
|
36
|
+
setConfigRequestSchema,
|
|
37
|
+
getModelInfoRequestSchema,
|
|
32
38
|
]);
|
|
33
39
|
export const responseSchema = z.discriminatedUnion("type", [
|
|
34
40
|
pingResponseSchema,
|
|
@@ -41,12 +47,15 @@ export const responseSchema = z.discriminatedUnion("type", [
|
|
|
41
47
|
loggingStreamResponseSchema,
|
|
42
48
|
embedResponseSchema,
|
|
43
49
|
translateResponseSchema,
|
|
50
|
+
ttsResponseSchema,
|
|
44
51
|
cancelResponseSchema,
|
|
45
52
|
provideResponseSchema,
|
|
46
53
|
stopProvideResponseSchema,
|
|
47
54
|
errorResponseSchema,
|
|
48
55
|
ragResponseSchema,
|
|
49
56
|
deleteCacheResponseSchema,
|
|
57
|
+
setConfigResponseSchema,
|
|
58
|
+
getModelInfoResponseSchema,
|
|
50
59
|
]);
|
|
51
60
|
export const rpcOptionsSchema = z.object({
|
|
52
61
|
timeout: z.number().min(100).optional(),
|
|
@@ -1,25 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const toolSchema: z.ZodObject<{
|
|
3
|
-
type: z.ZodLiteral<"function">;
|
|
4
|
-
name: z.ZodString;
|
|
5
|
-
description: z.ZodString;
|
|
6
|
-
parameters: z.ZodObject<{
|
|
7
|
-
type: z.ZodLiteral<"object">;
|
|
8
|
-
properties: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
9
|
-
type: z.ZodEnum<{
|
|
10
|
-
string: "string";
|
|
11
|
-
number: "number";
|
|
12
|
-
boolean: "boolean";
|
|
13
|
-
object: "object";
|
|
14
|
-
array: "array";
|
|
15
|
-
integer: "integer";
|
|
16
|
-
}>;
|
|
17
|
-
description: z.ZodOptional<z.ZodString>;
|
|
18
|
-
enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19
|
-
}, z.core.$strip>>;
|
|
20
|
-
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
21
|
-
}, z.core.$strip>;
|
|
22
|
-
}, z.core.$strip>;
|
|
23
2
|
export declare const attachmentSchema: z.ZodObject<{
|
|
24
3
|
path: z.ZodString;
|
|
25
4
|
}, z.core.$strip>;
|
|
@@ -115,6 +94,32 @@ export declare const completionStreamResponseSchema: z.ZodObject<{
|
|
|
115
94
|
tokensPerSecond: z.ZodNumber;
|
|
116
95
|
cacheTokens: z.ZodNumber;
|
|
117
96
|
}, z.core.$strip>>;
|
|
97
|
+
toolCallEvent: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
98
|
+
type: z.ZodLiteral<"toolCall">;
|
|
99
|
+
call: z.ZodObject<{
|
|
100
|
+
id: z.ZodString;
|
|
101
|
+
name: z.ZodString;
|
|
102
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
103
|
+
raw: z.ZodOptional<z.ZodString>;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
106
|
+
type: z.ZodLiteral<"toolCallError">;
|
|
107
|
+
error: z.ZodObject<{
|
|
108
|
+
code: z.ZodEnum<{
|
|
109
|
+
PARSE_ERROR: "PARSE_ERROR";
|
|
110
|
+
VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
111
|
+
UNKNOWN_TOOL: "UNKNOWN_TOOL";
|
|
112
|
+
}>;
|
|
113
|
+
message: z.ZodString;
|
|
114
|
+
raw: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
}, z.core.$strip>]>>;
|
|
117
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
118
|
+
id: z.ZodString;
|
|
119
|
+
name: z.ZodString;
|
|
120
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
121
|
+
raw: z.ZodOptional<z.ZodString>;
|
|
122
|
+
}, z.core.$strip>>>;
|
|
118
123
|
error: z.ZodOptional<z.ZodString>;
|
|
119
124
|
}, z.core.$strip>;
|
|
120
125
|
export type CompletionParams = z.infer<typeof completionParamsSchema>;
|
|
@@ -122,6 +127,5 @@ export type CompletionClientParams = z.input<typeof completionClientParamsSchema
|
|
|
122
127
|
export type CompletionStreamRequest = z.infer<typeof completionStreamRequestSchema>;
|
|
123
128
|
export type CompletionStreamResponse = z.infer<typeof completionStreamResponseSchema>;
|
|
124
129
|
export type Attachment = z.infer<typeof attachmentSchema>;
|
|
125
|
-
export type Tool = z.infer<typeof toolSchema>;
|
|
126
130
|
export type CompletionStats = z.infer<typeof completionStatsSchema>;
|
|
127
131
|
//# sourceMappingURL=completion-stream.d.ts.map
|
|
@@ -1,28 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
type: z.literal("function"),
|
|
4
|
-
name: z.string(),
|
|
5
|
-
description: z.string(),
|
|
6
|
-
parameters: z.object({
|
|
7
|
-
type: z.literal("object"),
|
|
8
|
-
properties: z.record(z.string(), z.object({
|
|
9
|
-
type: z.enum([
|
|
10
|
-
"string",
|
|
11
|
-
"number",
|
|
12
|
-
"integer",
|
|
13
|
-
"boolean",
|
|
14
|
-
"object",
|
|
15
|
-
"array",
|
|
16
|
-
]),
|
|
17
|
-
description: z.string().optional(),
|
|
18
|
-
enum: z.array(z.string()).optional(),
|
|
19
|
-
})),
|
|
20
|
-
required: z.array(z.string()).optional(),
|
|
21
|
-
}),
|
|
22
|
-
});
|
|
2
|
+
import { toolSchema, toolCallSchema, toolCallEventSchema } from "./tools.js";
|
|
23
3
|
export const attachmentSchema = z.object({
|
|
24
4
|
path: z.string(),
|
|
25
5
|
});
|
|
6
|
+
const kvCacheSchema = z.union([
|
|
7
|
+
z.boolean(),
|
|
8
|
+
z.string().min(1, "KV cache key cannot be empty string"),
|
|
9
|
+
]);
|
|
26
10
|
export const completionParamsSchema = z.object({
|
|
27
11
|
history: z.array(z.object({
|
|
28
12
|
role: z.string(),
|
|
@@ -30,12 +14,12 @@ export const completionParamsSchema = z.object({
|
|
|
30
14
|
attachments: z.array(attachmentSchema).optional(),
|
|
31
15
|
})),
|
|
32
16
|
modelId: z.string(),
|
|
33
|
-
kvCache:
|
|
17
|
+
kvCache: kvCacheSchema.optional(),
|
|
34
18
|
});
|
|
35
19
|
export const completionClientParamsSchema = completionParamsSchema.extend({
|
|
36
20
|
tools: z.array(toolSchema).optional(),
|
|
37
21
|
stream: z.boolean(),
|
|
38
|
-
kvCache:
|
|
22
|
+
kvCache: kvCacheSchema.optional(),
|
|
39
23
|
});
|
|
40
24
|
export const completionStreamRequestSchema = completionClientParamsSchema.extend({
|
|
41
25
|
type: z.literal("completionStream"),
|
|
@@ -50,5 +34,7 @@ export const completionStreamResponseSchema = z.object({
|
|
|
50
34
|
token: z.string(),
|
|
51
35
|
done: z.boolean().optional(),
|
|
52
36
|
stats: completionStatsSchema.optional(),
|
|
37
|
+
toolCallEvent: toolCallEventSchema.optional(),
|
|
38
|
+
toolCalls: z.array(toolCallSchema).optional(),
|
|
53
39
|
error: z.string().optional(),
|
|
54
40
|
});
|
|
@@ -1,14 +1,89 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { ModelProgressUpdate } from "./load-model";
|
|
3
3
|
export declare const downloadAssetOptionsSchema: z.ZodPipe<z.ZodObject<{
|
|
4
|
-
assetSrc: z.ZodString
|
|
4
|
+
assetSrc: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
5
|
+
src: z.ZodString;
|
|
6
|
+
name: z.ZodOptional<z.ZodString>;
|
|
7
|
+
modelId: z.ZodOptional<z.ZodString>;
|
|
8
|
+
hyperdriveKey: z.ZodOptional<z.ZodString>;
|
|
9
|
+
hyperbeeKey: z.ZodOptional<z.ZodString>;
|
|
10
|
+
expectedSize: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
sha256Checksum: z.ZodOptional<z.ZodString>;
|
|
12
|
+
addon: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
llm: "llm";
|
|
14
|
+
whisper: "whisper";
|
|
15
|
+
embeddings: "embeddings";
|
|
16
|
+
nmt: "nmt";
|
|
17
|
+
vad: "vad";
|
|
18
|
+
tts: "tts";
|
|
19
|
+
}>>;
|
|
20
|
+
}, z.core.$strip>]>;
|
|
5
21
|
seed: z.ZodOptional<z.ZodBoolean>;
|
|
6
22
|
}, z.core.$strip>, z.ZodTransform<{
|
|
7
23
|
seed: boolean;
|
|
8
|
-
assetSrc: string
|
|
24
|
+
assetSrc: string | {
|
|
25
|
+
src: string;
|
|
26
|
+
name?: string | undefined;
|
|
27
|
+
modelId?: string | undefined;
|
|
28
|
+
hyperdriveKey?: string | undefined;
|
|
29
|
+
hyperbeeKey?: string | undefined;
|
|
30
|
+
expectedSize?: number | undefined;
|
|
31
|
+
sha256Checksum?: string | undefined;
|
|
32
|
+
addon?: "llm" | "whisper" | "embeddings" | "nmt" | "vad" | "tts" | undefined;
|
|
33
|
+
};
|
|
9
34
|
}, {
|
|
35
|
+
assetSrc: string | {
|
|
36
|
+
src: string;
|
|
37
|
+
name?: string | undefined;
|
|
38
|
+
modelId?: string | undefined;
|
|
39
|
+
hyperdriveKey?: string | undefined;
|
|
40
|
+
hyperbeeKey?: string | undefined;
|
|
41
|
+
expectedSize?: number | undefined;
|
|
42
|
+
sha256Checksum?: string | undefined;
|
|
43
|
+
addon?: "llm" | "whisper" | "embeddings" | "nmt" | "vad" | "tts" | undefined;
|
|
44
|
+
};
|
|
45
|
+
seed?: boolean | undefined;
|
|
46
|
+
}>>;
|
|
47
|
+
export declare const downloadAssetOptionsToRequestSchema: z.ZodPipe<z.ZodObject<{
|
|
48
|
+
assetSrc: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
49
|
+
src: z.ZodString;
|
|
50
|
+
name: z.ZodOptional<z.ZodString>;
|
|
51
|
+
modelId: z.ZodOptional<z.ZodString>;
|
|
52
|
+
hyperdriveKey: z.ZodOptional<z.ZodString>;
|
|
53
|
+
hyperbeeKey: z.ZodOptional<z.ZodString>;
|
|
54
|
+
expectedSize: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
sha256Checksum: z.ZodOptional<z.ZodString>;
|
|
56
|
+
addon: z.ZodOptional<z.ZodEnum<{
|
|
57
|
+
llm: "llm";
|
|
58
|
+
whisper: "whisper";
|
|
59
|
+
embeddings: "embeddings";
|
|
60
|
+
nmt: "nmt";
|
|
61
|
+
vad: "vad";
|
|
62
|
+
tts: "tts";
|
|
63
|
+
}>>;
|
|
64
|
+
}, z.core.$strip>]>;
|
|
65
|
+
seed: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
+
onProgress: z.ZodOptional<z.ZodUnknown>;
|
|
67
|
+
withProgress: z.ZodOptional<z.ZodBoolean>;
|
|
68
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
69
|
+
type: "downloadAsset";
|
|
10
70
|
assetSrc: string;
|
|
71
|
+
withProgress: boolean;
|
|
72
|
+
seed: boolean;
|
|
73
|
+
}, {
|
|
74
|
+
assetSrc: string | {
|
|
75
|
+
src: string;
|
|
76
|
+
name?: string | undefined;
|
|
77
|
+
modelId?: string | undefined;
|
|
78
|
+
hyperdriveKey?: string | undefined;
|
|
79
|
+
hyperbeeKey?: string | undefined;
|
|
80
|
+
expectedSize?: number | undefined;
|
|
81
|
+
sha256Checksum?: string | undefined;
|
|
82
|
+
addon?: "llm" | "whisper" | "embeddings" | "nmt" | "vad" | "tts" | undefined;
|
|
83
|
+
};
|
|
11
84
|
seed?: boolean | undefined;
|
|
85
|
+
onProgress?: unknown;
|
|
86
|
+
withProgress?: boolean | undefined;
|
|
12
87
|
}>>;
|
|
13
88
|
export declare const downloadAssetRequestSchema: z.ZodPipe<z.ZodObject<{
|
|
14
89
|
type: z.ZodLiteral<"downloadAsset">;
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
assetSrc:
|
|
2
|
+
import { modelSrcInputSchema, modelInputToSrcSchema } from "./model-src-utils.js";
|
|
3
|
+
const downloadAssetOptionsBaseSchema = z.object({
|
|
4
|
+
assetSrc: modelSrcInputSchema,
|
|
5
5
|
seed: z.boolean().optional(),
|
|
6
|
+
});
|
|
7
|
+
export const downloadAssetOptionsSchema = downloadAssetOptionsBaseSchema.transform((data) => ({
|
|
8
|
+
...data,
|
|
9
|
+
seed: data.seed ?? false,
|
|
10
|
+
}));
|
|
11
|
+
export const downloadAssetOptionsToRequestSchema = downloadAssetOptionsBaseSchema
|
|
12
|
+
.extend({
|
|
13
|
+
onProgress: z.unknown().optional(),
|
|
14
|
+
withProgress: z.boolean().optional(),
|
|
6
15
|
})
|
|
7
16
|
.transform((data) => ({
|
|
8
|
-
|
|
17
|
+
type: "downloadAsset",
|
|
18
|
+
assetSrc: modelInputToSrcSchema.parse(data.assetSrc),
|
|
19
|
+
withProgress: data.withProgress ?? !!data.onProgress,
|
|
9
20
|
seed: data.seed ?? false,
|
|
10
21
|
}));
|
|
11
22
|
export const downloadAssetRequestSchema = z
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const getModelInfoParamsSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare const getModelInfoRequestSchema: z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
type: z.ZodLiteral<"getModelInfo">;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const loadedInstanceSchema: z.ZodObject<{
|
|
10
|
+
registryId: z.ZodString;
|
|
11
|
+
loadedAt: z.ZodCoercedDate<unknown>;
|
|
12
|
+
config: z.ZodOptional<z.ZodUnknown>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export declare const cacheFileInfoSchema: z.ZodObject<{
|
|
15
|
+
filename: z.ZodString;
|
|
16
|
+
path: z.ZodString;
|
|
17
|
+
expectedSize: z.ZodNumber;
|
|
18
|
+
sha256Checksum: z.ZodString;
|
|
19
|
+
isCached: z.ZodBoolean;
|
|
20
|
+
actualSize: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
cachedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export declare const modelInfoSchema: z.ZodObject<{
|
|
24
|
+
name: z.ZodString;
|
|
25
|
+
modelId: z.ZodString;
|
|
26
|
+
hyperdriveKey: z.ZodString;
|
|
27
|
+
hyperbeeKey: z.ZodString;
|
|
28
|
+
expectedSize: z.ZodNumber;
|
|
29
|
+
sha256Checksum: z.ZodString;
|
|
30
|
+
addon: z.ZodEnum<{
|
|
31
|
+
llm: "llm";
|
|
32
|
+
whisper: "whisper";
|
|
33
|
+
embeddings: "embeddings";
|
|
34
|
+
nmt: "nmt";
|
|
35
|
+
vad: "vad";
|
|
36
|
+
tts: "tts";
|
|
37
|
+
}>;
|
|
38
|
+
isCached: z.ZodBoolean;
|
|
39
|
+
isLoaded: z.ZodBoolean;
|
|
40
|
+
cacheFiles: z.ZodArray<z.ZodObject<{
|
|
41
|
+
filename: z.ZodString;
|
|
42
|
+
path: z.ZodString;
|
|
43
|
+
expectedSize: z.ZodNumber;
|
|
44
|
+
sha256Checksum: z.ZodString;
|
|
45
|
+
isCached: z.ZodBoolean;
|
|
46
|
+
actualSize: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
cachedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
actualSize: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
cachedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
51
|
+
loadedInstances: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
52
|
+
registryId: z.ZodString;
|
|
53
|
+
loadedAt: z.ZodCoercedDate<unknown>;
|
|
54
|
+
config: z.ZodOptional<z.ZodUnknown>;
|
|
55
|
+
}, z.core.$strip>>>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
export declare const getModelInfoResponseSchema: z.ZodObject<{
|
|
58
|
+
type: z.ZodLiteral<"getModelInfo">;
|
|
59
|
+
modelInfo: z.ZodObject<{
|
|
60
|
+
name: z.ZodString;
|
|
61
|
+
modelId: z.ZodString;
|
|
62
|
+
hyperdriveKey: z.ZodString;
|
|
63
|
+
hyperbeeKey: z.ZodString;
|
|
64
|
+
expectedSize: z.ZodNumber;
|
|
65
|
+
sha256Checksum: z.ZodString;
|
|
66
|
+
addon: z.ZodEnum<{
|
|
67
|
+
llm: "llm";
|
|
68
|
+
whisper: "whisper";
|
|
69
|
+
embeddings: "embeddings";
|
|
70
|
+
nmt: "nmt";
|
|
71
|
+
vad: "vad";
|
|
72
|
+
tts: "tts";
|
|
73
|
+
}>;
|
|
74
|
+
isCached: z.ZodBoolean;
|
|
75
|
+
isLoaded: z.ZodBoolean;
|
|
76
|
+
cacheFiles: z.ZodArray<z.ZodObject<{
|
|
77
|
+
filename: z.ZodString;
|
|
78
|
+
path: z.ZodString;
|
|
79
|
+
expectedSize: z.ZodNumber;
|
|
80
|
+
sha256Checksum: z.ZodString;
|
|
81
|
+
isCached: z.ZodBoolean;
|
|
82
|
+
actualSize: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
cachedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
84
|
+
}, z.core.$strip>>;
|
|
85
|
+
actualSize: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
cachedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
87
|
+
loadedInstances: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
88
|
+
registryId: z.ZodString;
|
|
89
|
+
loadedAt: z.ZodCoercedDate<unknown>;
|
|
90
|
+
config: z.ZodOptional<z.ZodUnknown>;
|
|
91
|
+
}, z.core.$strip>>>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
export type GetModelInfoParams = z.input<typeof getModelInfoParamsSchema>;
|
|
95
|
+
export type GetModelInfoRequest = z.infer<typeof getModelInfoRequestSchema>;
|
|
96
|
+
export type LoadedInstance = z.infer<typeof loadedInstanceSchema>;
|
|
97
|
+
export type CacheFileInfo = z.infer<typeof cacheFileInfoSchema>;
|
|
98
|
+
export type ModelInfo = z.infer<typeof modelInfoSchema>;
|
|
99
|
+
export type GetModelInfoResponse = z.infer<typeof getModelInfoResponseSchema>;
|
|
100
|
+
//# sourceMappingURL=get-model-info.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const getModelInfoParamsSchema = z.object({
|
|
3
|
+
name: z.string(),
|
|
4
|
+
});
|
|
5
|
+
export const getModelInfoRequestSchema = getModelInfoParamsSchema.extend({
|
|
6
|
+
type: z.literal("getModelInfo"),
|
|
7
|
+
});
|
|
8
|
+
export const loadedInstanceSchema = z.object({
|
|
9
|
+
registryId: z.string(),
|
|
10
|
+
loadedAt: z.coerce.date(),
|
|
11
|
+
config: z.unknown().optional(),
|
|
12
|
+
});
|
|
13
|
+
export const cacheFileInfoSchema = z.object({
|
|
14
|
+
filename: z.string(),
|
|
15
|
+
path: z.string(),
|
|
16
|
+
expectedSize: z.number(),
|
|
17
|
+
sha256Checksum: z.string(),
|
|
18
|
+
isCached: z.boolean(),
|
|
19
|
+
actualSize: z.number().optional(),
|
|
20
|
+
cachedAt: z.coerce.date().optional(),
|
|
21
|
+
});
|
|
22
|
+
export const modelInfoSchema = z.object({
|
|
23
|
+
name: z.string(),
|
|
24
|
+
modelId: z.string(),
|
|
25
|
+
hyperdriveKey: z.string(),
|
|
26
|
+
hyperbeeKey: z.string(),
|
|
27
|
+
expectedSize: z.number(),
|
|
28
|
+
sha256Checksum: z.string(),
|
|
29
|
+
addon: z.enum(["llm", "whisper", "embeddings", "nmt", "vad", "tts"]),
|
|
30
|
+
isCached: z.boolean(),
|
|
31
|
+
isLoaded: z.boolean(),
|
|
32
|
+
cacheFiles: z.array(cacheFileInfoSchema),
|
|
33
|
+
actualSize: z.number().optional(),
|
|
34
|
+
cachedAt: z.coerce.date().optional(),
|
|
35
|
+
loadedInstances: z.array(loadedInstanceSchema).optional(),
|
|
36
|
+
});
|
|
37
|
+
export const getModelInfoResponseSchema = z.object({
|
|
38
|
+
type: z.literal("getModelInfo"),
|
|
39
|
+
modelInfo: modelInfoSchema,
|
|
40
|
+
});
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./cancel";
|
|
2
2
|
export * from "./completion-stream";
|
|
3
|
+
export * from "./tools";
|
|
3
4
|
export * from "./delegate";
|
|
4
5
|
export * from "./delete-cache";
|
|
5
6
|
export * from "./download-asset";
|
|
@@ -16,6 +17,12 @@ export * from "./translate";
|
|
|
16
17
|
export * from "./translation-config";
|
|
17
18
|
export * from "./llamacpp-config";
|
|
18
19
|
export * from "./whispercpp-config";
|
|
20
|
+
export * from "./text-to-speech";
|
|
19
21
|
export * from "./error";
|
|
20
22
|
export * from "./rag";
|
|
23
|
+
export { SDK_CLIENT_ERROR_CODES } from "./sdk-errors-client";
|
|
24
|
+
export { SDK_SERVER_ERROR_CODES } from "./sdk-errors-server";
|
|
25
|
+
export * from "./set-config";
|
|
26
|
+
export * from "./get-model-info";
|
|
27
|
+
export * from "./model-src-utils";
|
|
21
28
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/schemas/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Re-export all schemas and types
|
|
2
2
|
export * from "./cancel.js";
|
|
3
3
|
export * from "./completion-stream.js";
|
|
4
|
+
export * from "./tools.js";
|
|
4
5
|
export * from "./delegate.js";
|
|
5
6
|
export * from "./delete-cache.js";
|
|
6
7
|
export * from "./download-asset.js";
|
|
@@ -17,5 +18,11 @@ export * from "./translate.js";
|
|
|
17
18
|
export * from "./translation-config.js";
|
|
18
19
|
export * from "./llamacpp-config.js";
|
|
19
20
|
export * from "./whispercpp-config.js";
|
|
21
|
+
export * from "./text-to-speech.js";
|
|
20
22
|
export * from "./error.js";
|
|
21
23
|
export * from "./rag.js";
|
|
24
|
+
export { SDK_CLIENT_ERROR_CODES } from "./sdk-errors-client.js";
|
|
25
|
+
export { SDK_SERVER_ERROR_CODES } from "./sdk-errors-server.js";
|
|
26
|
+
export * from "./set-config.js";
|
|
27
|
+
export * from "./get-model-info.js";
|
|
28
|
+
export * from "./model-src-utils.js";
|
|
@@ -20,8 +20,9 @@ export declare const llmConfigSchema: z.ZodObject<{
|
|
|
20
20
|
presence_penalty: z.ZodOptional<z.ZodNumber>;
|
|
21
21
|
frequency_penalty: z.ZodOptional<z.ZodNumber>;
|
|
22
22
|
repeat_penalty: z.ZodOptional<z.ZodNumber>;
|
|
23
|
-
|
|
23
|
+
stop_sequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
24
24
|
n_discarded: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
tools: z.ZodOptional<z.ZodBoolean>;
|
|
25
26
|
}, z.core.$strip>;
|
|
26
27
|
export declare const embedConfigSchema: z.ZodObject<{
|
|
27
28
|
config: z.ZodDefault<z.ZodString>;
|
|
@@ -31,12 +31,11 @@ export const llmConfigSchema = z.object({
|
|
|
31
31
|
presence_penalty: z.number().optional(),
|
|
32
32
|
frequency_penalty: z.number().optional(),
|
|
33
33
|
repeat_penalty: z.number().optional(),
|
|
34
|
-
|
|
34
|
+
stop_sequences: z.array(z.string()).optional(),
|
|
35
35
|
n_discarded: z.number().optional(),
|
|
36
|
+
tools: z.boolean().optional(),
|
|
36
37
|
});
|
|
37
38
|
export const embedConfigSchema = z.object({
|
|
38
39
|
// https://github.com/tetherto/qvac-lib-infer-llamacpp-embed/tree/main?tab=readme-ov-file#4-create-config
|
|
39
|
-
config: z
|
|
40
|
-
.string()
|
|
41
|
-
.default("-ngl\t99\n-dev\tgpu\n--embd-separator\t⟪§§§EMBED_SEP§§§⟫\n-c\t512"),
|
|
40
|
+
config: z.string().default("-ngl\t99\n-dev\tgpu"),
|
|
42
41
|
});
|