@qvac/inference 0.19.0 → 0.20.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 +95 -39
- package/dist/api/audio-gen.d.ts +42 -1
- package/dist/api/audio-gen.js +137 -51
- package/dist/api/delete-cache.d.ts +7 -1
- package/dist/api/delete-cache.js +11 -1
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.js +2 -1
- package/dist/api/text-to-speech.d.ts +31 -4
- package/dist/api/text-to-speech.js +117 -21
- package/dist/api/vector-index.d.ts +142 -0
- package/dist/api/vector-index.js +168 -0
- package/dist/api/world.d.ts +2 -2
- package/dist/errors/index.d.ts +12 -0
- package/dist/errors/index.js +21 -0
- package/dist/handlers/delete-cache.js +3 -0
- package/dist/handlers/vector-index.d.ts +2 -0
- package/dist/handlers/vector-index.js +40 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/models/registry/models.d.ts +351 -12
- package/dist/models/registry/models.js +2271 -1957
- package/dist/models/registry/resource-profiles.js +135 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.d.ts +2 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.js +65 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-input.d.ts +9 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-input.js +24 -7
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-run.d.ts +46 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-run.js +218 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.d.ts +1 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +56 -225
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.d.ts +8 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.js +28 -0
- package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +248 -0
- package/dist/plugins/builtin/audiogen-ggml/plugin.js +17 -1
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +5 -2
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +1 -2
- package/dist/plugins/builtin/ggml-ocr/plugin.d.ts +1 -1
- package/dist/plugins/builtin/ggml-ocr/plugin.js +1 -2
- package/dist/plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js +6 -4
- package/dist/plugins/builtin/llamacpp-completion/ops/cache-logger.d.ts +1 -2
- package/dist/plugins/builtin/llamacpp-completion/ops/cache-logger.js +0 -4
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.d.ts +2 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.js +6 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.d.ts +9 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +96 -89
- package/dist/plugins/builtin/llamacpp-completion/ops/context-overflow.d.ts +0 -1
- package/dist/plugins/builtin/llamacpp-completion/ops/context-overflow.js +0 -31
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.d.ts +48 -27
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.js +239 -135
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-state.d.ts +11 -4
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-state.js +18 -16
- package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +11 -4
- package/dist/plugins/builtin/llamacpp-completion/plugin.js +1 -2
- package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +1 -2
- package/dist/plugins/builtin/llamacpp-embedding/plugin.js +2 -38
- package/dist/plugins/builtin/llamacpp-embedding/transform.d.ts +9 -0
- package/dist/plugins/builtin/llamacpp-embedding/transform.js +42 -0
- package/dist/plugins/builtin/nmtcpp-translation/plugin.d.ts +1 -1
- package/dist/plugins/builtin/nmtcpp-translation/plugin.js +1 -2
- package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +1 -1
- package/dist/plugins/builtin/parakeet-transcription/plugin.js +1 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/video.d.ts +1 -0
- package/dist/plugins/builtin/sdcpp-generation/ops/video.js +8 -2
- package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +9 -4
- package/dist/plugins/builtin/sdcpp-generation/plugin.js +51 -19
- package/dist/plugins/builtin/tts-ggml/ops/cancel-binding.d.ts +29 -0
- package/dist/plugins/builtin/tts-ggml/ops/cancel-binding.js +66 -0
- package/dist/plugins/builtin/tts-ggml/ops/parler-options.js +10 -0
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.d.ts +3 -5
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +143 -28
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.d.ts +5 -2
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +182 -66
- package/dist/plugins/builtin/tts-ggml/plugin.d.ts +267 -22
- package/dist/plugins/builtin/tts-ggml/plugin.js +94 -35
- package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +1 -1
- package/dist/plugins/builtin/whispercpp-transcription/plugin.js +1 -2
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/ops/load-model.js +22 -2
- package/dist/plugins/ops/translate.js +58 -12
- package/dist/plugins/ops/translatepsy-utils.d.ts +17 -0
- package/dist/plugins/ops/translatepsy-utils.js +32 -0
- package/dist/plugins/registry.d.ts +15 -0
- package/dist/plugins/registry.js +133 -15
- package/dist/plugins/turbovec-backend.d.ts +17 -0
- package/dist/plugins/turbovec-backend.js +99 -0
- package/dist/registry.js +4 -0
- package/dist/resources/model-fit/assess.js +169 -68
- package/dist/resources/model-fit/estimators/llm.d.ts +1 -0
- package/dist/resources/model-fit/estimators/llm.js +3 -1
- package/dist/resources/model-fit/floor.d.ts +31 -0
- package/dist/resources/model-fit/floor.js +65 -0
- package/dist/resources/model-fit/native-probe/advisory-fit.d.ts +46 -0
- package/dist/resources/model-fit/native-probe/advisory-fit.js +214 -0
- package/dist/resources/model-fit/native-probe/create-llama-fit-request.d.ts +26 -0
- package/dist/resources/model-fit/native-probe/create-llama-fit-request.js +171 -0
- package/dist/resources/model-fit/native-probe/run-in-process-fit.d.ts +42 -0
- package/dist/resources/model-fit/native-probe/run-in-process-fit.js +192 -0
- package/dist/resources/model-fit/native-probe/run-isolated-fit.d.ts +70 -0
- package/dist/resources/model-fit/native-probe/run-isolated-fit.js +372 -0
- package/dist/resources/native.js +5 -4
- package/dist/resources/types.d.ts +1 -3
- package/dist/runtime/env.d.ts +2 -0
- package/dist/runtime/env.js +9 -2
- package/dist/runtime/lifecycle.js +2 -0
- package/dist/runtime/model-registry.d.ts +3 -1
- package/dist/runtime/model-registry.js +2 -1
- package/dist/runtime/request-context.js +17 -0
- package/dist/runtime/vector-index-backend.d.ts +25 -0
- package/dist/runtime/vector-index-backend.js +1 -0
- package/dist/runtime/vector-index-registry.d.ts +76 -0
- package/dist/runtime/vector-index-registry.js +161 -0
- package/dist/schemas/assess-model-fit.d.ts +84 -0
- package/dist/schemas/assess-model-fit.js +72 -3
- package/dist/schemas/audio-gen.d.ts +482 -7
- package/dist/schemas/audio-gen.js +376 -17
- package/dist/schemas/batch-completion-stream.d.ts +10 -0
- package/dist/schemas/batch-completion-stream.js +5 -3
- package/dist/schemas/bci.d.ts +1 -1
- package/dist/schemas/common.d.ts +782 -19
- package/dist/schemas/common.js +8 -1
- package/dist/schemas/completion-event.d.ts +14 -1
- package/dist/schemas/completion-event.js +4 -0
- package/dist/schemas/completion-stream.d.ts +22 -0
- package/dist/schemas/completion-stream.js +41 -4
- package/dist/schemas/config.d.ts +48 -30
- package/dist/schemas/errors.d.ts +4 -0
- package/dist/schemas/errors.js +22 -0
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/llamacpp-config.d.ts +4 -8
- package/dist/schemas/llamacpp-config.js +4 -4
- package/dist/schemas/load-model.d.ts +2604 -180
- package/dist/schemas/model-config-schemas.d.ts +228 -5
- package/dist/schemas/model-ops.d.ts +3 -0
- package/dist/schemas/model-ops.js +6 -0
- package/dist/schemas/plugin.d.ts +21 -11
- package/dist/schemas/sdcpp-config.d.ts +221 -4
- package/dist/schemas/sdcpp-config.js +128 -22
- package/dist/schemas/text-to-speech.d.ts +780 -19
- package/dist/schemas/text-to-speech.js +298 -44
- package/dist/schemas/transcription-config.js +7 -4
- package/dist/schemas/vector-index.d.ts +194 -0
- package/dist/schemas/vector-index.js +185 -0
- package/dist/utils/addon-responses.d.ts +30 -3
- package/dist/utils/aggregate-events.d.ts +3 -1
- package/dist/utils/aggregate-events.js +7 -1
- package/dist/utils/tts-stats.d.ts +15 -11
- package/dist/utils/tts-stats.js +33 -11
- package/package.json +29 -26
|
@@ -20,15 +20,53 @@ export const AUDIOGEN_INPUT_CHANNELS = 2;
|
|
|
20
20
|
* 384 KB per second — so a request cannot exhaust the inference process.
|
|
21
21
|
*/
|
|
22
22
|
export const AUDIOGEN_INPUT_MAX_SECONDS = 600;
|
|
23
|
+
/**
|
|
24
|
+
* Semantic codes the ACE-Step LM emits per second of audio (the 5 Hz LM), so
|
|
25
|
+
* an `audioCodes` payload is bounded the same way PCM inputs are: a request
|
|
26
|
+
* cannot carry more codes than `AUDIOGEN_INPUT_MAX_SECONDS` of audio needs.
|
|
27
|
+
*/
|
|
28
|
+
const ACESTEP_CODES_PER_SECOND = 5;
|
|
29
|
+
/** Longest `audioCodes` array the SDK accepts (600 s at 5 codes per second). */
|
|
30
|
+
export const AUDIOGEN_MAX_AUDIO_CODES = AUDIOGEN_INPUT_MAX_SECONDS * ACESTEP_CODES_PER_SECOND;
|
|
31
|
+
const INT32_MIN = -2147483648;
|
|
32
|
+
const INT32_MAX = 2147483647;
|
|
33
|
+
/**
|
|
34
|
+
* Operations `audioEdit()` chains over a source recording, in the vocabulary
|
|
35
|
+
* of `@qvac/audiogen-ggml`'s `AudioEditOperationType` (ACE-Step only):
|
|
36
|
+
* `flow-edit` re-conditions the whole clip from a source prompt to a target
|
|
37
|
+
* prompt, `repaint` regenerates a time range against a new prompt.
|
|
38
|
+
*/
|
|
39
|
+
export const AUDIOGEN_EDIT_OPERATIONS = ['flow-edit', 'repaint'];
|
|
40
|
+
export const audioGenEditOperationTypeSchema = z.enum(AUDIOGEN_EDIT_OPERATIONS);
|
|
41
|
+
/** Repaint preservation modes; `balanced` is the default and honours `strength`. */
|
|
42
|
+
export const AUDIOGEN_REPAINT_MODES = ['conservative', 'balanced', 'aggressive'];
|
|
43
|
+
export const audioGenRepaintModeSchema = z.enum(AUDIOGEN_REPAINT_MODES);
|
|
23
44
|
/**
|
|
24
45
|
* ACE-Step task discriminators reachable through the SDK. `text2music` is the
|
|
25
46
|
* default caption-driven generation; `cover-nofsq` re-renders `sourceAudio`
|
|
26
|
-
* with a new caption while keeping its structure
|
|
27
|
-
*
|
|
28
|
-
*
|
|
47
|
+
* with a new caption while keeping its structure; `lego` regenerates a single
|
|
48
|
+
* instrument layer of `sourceAudio`, named by `track`. The engine also
|
|
49
|
+
* reserves an FSQ-roundtrip `cover` task that is not implemented yet, so it is
|
|
50
|
+
* not offered here.
|
|
29
51
|
*/
|
|
30
|
-
export const AUDIOGEN_TASK_TYPES = ['text2music', 'cover-nofsq'];
|
|
52
|
+
export const AUDIOGEN_TASK_TYPES = ['text2music', 'cover-nofsq', 'lego'];
|
|
31
53
|
export const audioGenTaskTypeSchema = z.enum(AUDIOGEN_TASK_TYPES);
|
|
54
|
+
/** Instrument layers the `lego` task can target, in the engine's vocabulary. */
|
|
55
|
+
export const AUDIOGEN_TRACKS = [
|
|
56
|
+
'vocals',
|
|
57
|
+
'backing_vocals',
|
|
58
|
+
'drums',
|
|
59
|
+
'bass',
|
|
60
|
+
'guitar',
|
|
61
|
+
'keyboard',
|
|
62
|
+
'percussion',
|
|
63
|
+
'strings',
|
|
64
|
+
'synth',
|
|
65
|
+
'fx',
|
|
66
|
+
'brass',
|
|
67
|
+
'woodwinds'
|
|
68
|
+
];
|
|
69
|
+
export const audioGenTrackSchema = z.enum(AUDIOGEN_TRACKS);
|
|
32
70
|
const commonAudioGenRuntimeConfigShape = {
|
|
33
71
|
useGPU: z
|
|
34
72
|
.boolean()
|
|
@@ -120,6 +158,13 @@ export const audioGenConfigSchema = z.discriminatedUnion('engine', [
|
|
|
120
158
|
minimaxAudioGenConfigSchema
|
|
121
159
|
]);
|
|
122
160
|
const unitIntervalSchema = z.number().min(0).max(1);
|
|
161
|
+
/**
|
|
162
|
+
* LM sampling knobs. Generation and understanding drive the same sampler, so
|
|
163
|
+
* both paths share one definition: the addon accepts any finite value here and
|
|
164
|
+
* reads `lmTopK: 0` as "top-k off", which a `positive()` bound would reject.
|
|
165
|
+
*/
|
|
166
|
+
const lmTemperatureSchema = z.number().nonnegative();
|
|
167
|
+
const lmTopKSchema = z.number().int().nonnegative();
|
|
123
168
|
/**
|
|
124
169
|
* Wire form of a reference/source audio input. `filePath` inputs are decoded
|
|
125
170
|
* server-side (any format the SDK's audio decoder supports, plus raw PCM);
|
|
@@ -143,6 +188,25 @@ function bytesToBase64(bytes) {
|
|
|
143
188
|
}
|
|
144
189
|
return encodeBase64(bytes);
|
|
145
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Wire form of frozen ACE-Step semantic codes: a plain int32 array, so it
|
|
193
|
+
* survives JSON transport and reaches non-JS clients as a list of integers.
|
|
194
|
+
*/
|
|
195
|
+
const audioCodesWireSchema = z
|
|
196
|
+
.array(z.number().int().min(INT32_MIN).max(INT32_MAX))
|
|
197
|
+
.min(1)
|
|
198
|
+
.max(AUDIOGEN_MAX_AUDIO_CODES)
|
|
199
|
+
.describe('Frozen ACE-Step semantic codes (int32) to synthesize instead of running the LM, e.g. codes recovered from an earlier run. ACE-Step only; rejected by MiniMax.');
|
|
200
|
+
/**
|
|
201
|
+
* Client form of `audioCodes`: the `Int32Array` the addon works with, or a
|
|
202
|
+
* plain number array. Normalized to the wire form.
|
|
203
|
+
*/
|
|
204
|
+
export const audioGenClientAudioCodesSchema = z
|
|
205
|
+
.union([
|
|
206
|
+
z.instanceof(Int32Array).transform((codes) => Array.from(codes)),
|
|
207
|
+
z.array(z.number())
|
|
208
|
+
])
|
|
209
|
+
.pipe(audioCodesWireSchema);
|
|
146
210
|
const audioGenGenerationShape = {
|
|
147
211
|
modelId: z.string().min(1),
|
|
148
212
|
caption: z.string().trim().min(1, 'caption must not be empty or whitespace-only'),
|
|
@@ -152,6 +216,38 @@ const audioGenGenerationShape = {
|
|
|
152
216
|
bpm: z.number().int().positive().optional(),
|
|
153
217
|
keyscale: z.string().min(1).optional(),
|
|
154
218
|
timesignature: z.string().min(1).optional(),
|
|
219
|
+
augmentCaptionWithMetadata: z
|
|
220
|
+
.boolean()
|
|
221
|
+
.optional()
|
|
222
|
+
.describe('Append BPM/tempo, time signature, and key guidance to the internal conditioning caption while the result metadata keeps the original caption (default: false). ACE-Step only; rejected by MiniMax.'),
|
|
223
|
+
simpleMode: z
|
|
224
|
+
.boolean()
|
|
225
|
+
.optional()
|
|
226
|
+
.describe("Treat `caption` as a short natural-language query and let the LM compose the full request before synthesis: a detailed caption, lyrics, and any metadata left unset. Options you set are kept. Requires `taskType: 'text2music'` and no `audioCodes`; leave `lyrics` unset for LM-written vocals or pass '[Instrumental]' for an instrumental. Mutually exclusive with `rewriteQuery`. ACE-Step only."),
|
|
227
|
+
rewriteQuery: z
|
|
228
|
+
.boolean()
|
|
229
|
+
.optional()
|
|
230
|
+
.describe("Query Rewriting: the LM rewrites `caption` into a detailed musical description before synthesis, preserving the lyric content and filling metadata left unset. Takes caption AND lyrics as input, so real `lyrics` are required ('[Instrumental]' belongs to Simple Mode). Requires `taskType: 'text2music'`; mutually exclusive with `simpleMode`. Faithful rewriting needs the 1.7B LM. ACE-Step only."),
|
|
231
|
+
generateLrc: z
|
|
232
|
+
.boolean()
|
|
233
|
+
.optional()
|
|
234
|
+
.describe("Align the lyrics with the generated audio and return karaoke-style LRC text in `stats.lrc`, with an alignment confidence in `stats.lyricsScore`. Needs lyrics to align — pass `lyrics` or let Simple Mode write them; instrumental requests are rejected. Requires `taskType: 'text2music'`. ACE-Step only."),
|
|
235
|
+
computeQualityScore: z
|
|
236
|
+
.boolean()
|
|
237
|
+
.optional()
|
|
238
|
+
.describe("Teacher-force the generated audio codes back through the LM and report a weighted [0, 1] match against the request in `stats.qualityScore` (caption/lyrics PMI plus metadata recall). Costs extra LM forwards after code generation; made for ranking a batch of takes. Requires `taskType: 'text2music'`. ACE-Step only."),
|
|
239
|
+
normalizeLoudness: z
|
|
240
|
+
.boolean()
|
|
241
|
+
.optional()
|
|
242
|
+
.describe('Percentile loudness normalization on the generated audio (default: true): the 99.999th-percentile sample scales to full scale and the tiny tail above it clips. Set false for the raw engine output. Audio edits are never normalized. ACE-Step only.'),
|
|
243
|
+
guidanceScale: z
|
|
244
|
+
.number()
|
|
245
|
+
.nonnegative()
|
|
246
|
+
.optional()
|
|
247
|
+
.describe('DiT classifier-free guidance scale. 0 (the default) resolves automatically: 1.0 on turbo variants, which disables CFG, and 7.0 on base/sft. Values above 1 run CFG via APG and double the DiT cost per step. ACE-Step only.'),
|
|
248
|
+
track: audioGenTrackSchema
|
|
249
|
+
.optional()
|
|
250
|
+
.describe("Instrument layer the `lego` task regenerates. Required when `taskType` is 'lego' and rejected otherwise. ACE-Step only."),
|
|
155
251
|
duration: z
|
|
156
252
|
.number()
|
|
157
253
|
.positive()
|
|
@@ -174,20 +270,13 @@ const audioGenGenerationShape = {
|
|
|
174
270
|
cfgScale: minimaxCfgScaleSchema
|
|
175
271
|
.optional()
|
|
176
272
|
.describe('MiniMax flow classifier-free guidance scale for this generation. MiniMax only; rejected by ACE-Step.'),
|
|
177
|
-
lmTemperature:
|
|
178
|
-
.number()
|
|
179
|
-
.nonnegative()
|
|
273
|
+
lmTemperature: lmTemperatureSchema
|
|
180
274
|
.optional()
|
|
181
275
|
.describe('LM sampling temperature (ACE-Step default: 0.85).'),
|
|
182
276
|
lmTopP: unitIntervalSchema
|
|
183
277
|
.optional()
|
|
184
278
|
.describe('LM nucleus-sampling probability (ACE-Step default: 0.9).'),
|
|
185
|
-
lmTopK:
|
|
186
|
-
.number()
|
|
187
|
-
.int()
|
|
188
|
-
.nonnegative()
|
|
189
|
-
.optional()
|
|
190
|
-
.describe('LM top-k cutoff; 0 disables top-k filtering.'),
|
|
279
|
+
lmTopK: lmTopKSchema.optional().describe('LM top-k cutoff; 0 disables top-k filtering.'),
|
|
191
280
|
lmCfgScale: z
|
|
192
281
|
.number()
|
|
193
282
|
.nonnegative()
|
|
@@ -213,7 +302,7 @@ const audioGenGenerationShape = {
|
|
|
213
302
|
.describe('DCW high-frequency correction strength (official default: 0.02).'),
|
|
214
303
|
taskType: audioGenTaskTypeSchema
|
|
215
304
|
.optional()
|
|
216
|
-
.describe('Generation task: text2music (default)
|
|
305
|
+
.describe('Generation task: text2music (default), cover-nofsq (requires sourceAudio), or lego (requires track).'),
|
|
217
306
|
audioCoverStrength: unitIntervalSchema
|
|
218
307
|
.optional()
|
|
219
308
|
.describe('Fraction of DiT steps that keep the source context (0..1, default 1). cover-nofsq currently requires 1.'),
|
|
@@ -223,6 +312,7 @@ const audioGenGenerationShape = {
|
|
|
223
312
|
};
|
|
224
313
|
const audioGenParamsShape = {
|
|
225
314
|
...audioGenGenerationShape,
|
|
315
|
+
audioCodes: audioCodesWireSchema.optional(),
|
|
226
316
|
referenceAudio: audioGenAudioInputSchema
|
|
227
317
|
.optional()
|
|
228
318
|
.describe('Optional timbre reference audio; omit to keep the engine default.'),
|
|
@@ -253,8 +343,80 @@ function validateCoverTask(value, ctx) {
|
|
|
253
343
|
});
|
|
254
344
|
}
|
|
255
345
|
}
|
|
346
|
+
/**
|
|
347
|
+
* `track` names the layer the `lego` task regenerates, so the two are bound
|
|
348
|
+
* together: `lego` without a layer has nothing to rebuild, and a layer without
|
|
349
|
+
* `lego` is silently ignored by the engine.
|
|
350
|
+
*/
|
|
351
|
+
function validateLegoTask(value, ctx) {
|
|
352
|
+
if (value.taskType === 'lego' && value.track === undefined) {
|
|
353
|
+
ctx.addIssue({
|
|
354
|
+
code: 'custom',
|
|
355
|
+
path: ['track'],
|
|
356
|
+
message: "taskType 'lego' requires track"
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
if (value.taskType === 'lego' && value.sourceAudio === undefined) {
|
|
360
|
+
ctx.addIssue({
|
|
361
|
+
code: 'custom',
|
|
362
|
+
path: ['sourceAudio'],
|
|
363
|
+
message: "taskType 'lego' requires sourceAudio"
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
if (value.track !== undefined && value.taskType !== 'lego') {
|
|
367
|
+
ctx.addIssue({
|
|
368
|
+
code: 'custom',
|
|
369
|
+
path: ['track'],
|
|
370
|
+
message: "track is only valid with taskType 'lego'"
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* The four LM-driven controls only run on the `text2music` path. An unset
|
|
376
|
+
* `taskType` is that path, so only an explicit other task rejects them.
|
|
377
|
+
*
|
|
378
|
+
* Simple Mode and Query Rewriting additionally need the LM to produce the
|
|
379
|
+
* codes, so neither combines with pre-supplied `audioCodes` on any task.
|
|
380
|
+
*/
|
|
381
|
+
const TEXT_TO_MUSIC_ONLY_CONTROLS = [
|
|
382
|
+
'simpleMode',
|
|
383
|
+
'rewriteQuery',
|
|
384
|
+
'generateLrc',
|
|
385
|
+
'computeQualityScore'
|
|
386
|
+
];
|
|
387
|
+
function validateTextToMusicControls(value, ctx) {
|
|
388
|
+
if (value.simpleMode === true && value.rewriteQuery === true) {
|
|
389
|
+
ctx.addIssue({
|
|
390
|
+
code: 'custom',
|
|
391
|
+
path: ['rewriteQuery'],
|
|
392
|
+
message: 'simpleMode and rewriteQuery cannot be combined: Simple Mode writes the lyrics, Query Rewriting rewrites around existing ones'
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
for (const control of ['simpleMode', 'rewriteQuery']) {
|
|
396
|
+
if (value[control] === true && value.audioCodes !== undefined) {
|
|
397
|
+
ctx.addIssue({
|
|
398
|
+
code: 'custom',
|
|
399
|
+
path: [control],
|
|
400
|
+
message: `${control} cannot take pre-supplied audioCodes`
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (value.taskType === undefined || value.taskType === 'text2music')
|
|
405
|
+
return;
|
|
406
|
+
for (const control of TEXT_TO_MUSIC_ONLY_CONTROLS) {
|
|
407
|
+
if (value[control] === true) {
|
|
408
|
+
ctx.addIssue({
|
|
409
|
+
code: 'custom',
|
|
410
|
+
path: [control],
|
|
411
|
+
message: `${control} requires taskType 'text2music'`
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
256
416
|
function validateAudioGenRequest(value, ctx) {
|
|
257
417
|
validateCoverTask(value, ctx);
|
|
418
|
+
validateLegoTask(value, ctx);
|
|
419
|
+
validateTextToMusicControls(value, ctx);
|
|
258
420
|
if (value.duration !== undefined && value.maxFrames !== undefined) {
|
|
259
421
|
ctx.addIssue({
|
|
260
422
|
code: 'custom',
|
|
@@ -266,6 +428,7 @@ function validateAudioGenRequest(value, ctx) {
|
|
|
266
428
|
export const audioGenClientParamsSchema = z
|
|
267
429
|
.object({
|
|
268
430
|
...audioGenGenerationShape,
|
|
431
|
+
audioCodes: audioGenClientAudioCodesSchema.optional(),
|
|
269
432
|
referenceAudio: audioGenClientAudioInputSchema.optional(),
|
|
270
433
|
sourceAudio: audioGenClientAudioInputSchema.optional()
|
|
271
434
|
})
|
|
@@ -279,6 +442,117 @@ export const audioGenStreamRequestSchema = z
|
|
|
279
442
|
})
|
|
280
443
|
.strict()
|
|
281
444
|
.superRefine(validateAudioGenRequest);
|
|
445
|
+
// ---------------------------------------------------------------------------
|
|
446
|
+
// Source-driven editing (`audioEdit()`): the addon's ordered Flow-Edit /
|
|
447
|
+
// Repaint pipeline over one source recording. ACE-Step only.
|
|
448
|
+
// ---------------------------------------------------------------------------
|
|
449
|
+
const audioEditPromptSchema = z
|
|
450
|
+
.object({
|
|
451
|
+
caption: z.string().trim().min(1, 'caption must not be empty or whitespace-only'),
|
|
452
|
+
lyrics: z.string().optional().describe('Lyrics for this prompt; omit for `[Instrumental]`.')
|
|
453
|
+
})
|
|
454
|
+
.strict();
|
|
455
|
+
export const audioEditFlowEditOperationSchema = z
|
|
456
|
+
.object({
|
|
457
|
+
type: z.literal('flow-edit'),
|
|
458
|
+
from: audioEditPromptSchema.describe('Description of the unedited source audio.'),
|
|
459
|
+
to: audioEditPromptSchema.describe('Description of the desired audio.'),
|
|
460
|
+
nMin: unitIntervalSchema
|
|
461
|
+
.optional()
|
|
462
|
+
.describe('Start of the Flow-Edit diffusion window (0..1, default 0).'),
|
|
463
|
+
nMax: unitIntervalSchema
|
|
464
|
+
.optional()
|
|
465
|
+
.describe('End of the Flow-Edit diffusion window (0..1, default 1).'),
|
|
466
|
+
nAvg: z
|
|
467
|
+
.number()
|
|
468
|
+
.int()
|
|
469
|
+
.min(1)
|
|
470
|
+
.optional()
|
|
471
|
+
.describe('Forward-noise samples averaged per active step (default 1).')
|
|
472
|
+
})
|
|
473
|
+
.strict();
|
|
474
|
+
export const audioEditRepaintOperationSchema = z
|
|
475
|
+
.object({
|
|
476
|
+
type: z.literal('repaint'),
|
|
477
|
+
caption: z.string().trim().min(1, 'caption must not be empty or whitespace-only'),
|
|
478
|
+
lyrics: z
|
|
479
|
+
.string()
|
|
480
|
+
.optional()
|
|
481
|
+
.describe('Lyrics for the repainted region; omit for `[Instrumental]`.'),
|
|
482
|
+
start: z
|
|
483
|
+
.number()
|
|
484
|
+
.nonnegative()
|
|
485
|
+
.describe('Region start in seconds; must lie inside the source recording.'),
|
|
486
|
+
end: z
|
|
487
|
+
.number()
|
|
488
|
+
.positive()
|
|
489
|
+
.optional()
|
|
490
|
+
.describe('Region end in seconds; omit to repaint through the end of the source. The range must span at least one latent frame (1/25 s).'),
|
|
491
|
+
mode: audioGenRepaintModeSchema
|
|
492
|
+
.optional()
|
|
493
|
+
.describe('Preservation mode outside the repainted region (default balanced).'),
|
|
494
|
+
strength: unitIntervalSchema
|
|
495
|
+
.optional()
|
|
496
|
+
.describe('Balanced-mode preservation strength (0..1, default 0.5).')
|
|
497
|
+
})
|
|
498
|
+
.strict();
|
|
499
|
+
export const audioEditOperationSchema = z.discriminatedUnion('type', [
|
|
500
|
+
audioEditFlowEditOperationSchema,
|
|
501
|
+
audioEditRepaintOperationSchema
|
|
502
|
+
]);
|
|
503
|
+
const audioEditShape = {
|
|
504
|
+
modelId: z.string().min(1),
|
|
505
|
+
operations: z
|
|
506
|
+
.array(audioEditOperationSchema)
|
|
507
|
+
.min(1)
|
|
508
|
+
.describe('Ordered edit pipeline: operations run in array order and may repeat or mix. Flow-Edit is supported on turbo DiT variants only.'),
|
|
509
|
+
seed: z
|
|
510
|
+
.number()
|
|
511
|
+
.int()
|
|
512
|
+
.optional()
|
|
513
|
+
.describe('Seeds the first operation; each following operation uses seed + its index.')
|
|
514
|
+
};
|
|
515
|
+
/**
|
|
516
|
+
* Cross-field rules the addon enforces per operation, checked up front so a
|
|
517
|
+
* bad pipeline fails before any audio is decoded or the model slot is taken.
|
|
518
|
+
*/
|
|
519
|
+
function validateAudioEditOperations(value, ctx) {
|
|
520
|
+
value.operations.forEach((operation, index) => {
|
|
521
|
+
if (operation.type === 'flow-edit') {
|
|
522
|
+
if ((operation.nMin ?? 0) > (operation.nMax ?? 1)) {
|
|
523
|
+
ctx.addIssue({
|
|
524
|
+
code: 'custom',
|
|
525
|
+
path: ['operations', index, 'nMin'],
|
|
526
|
+
message: 'flow-edit requires nMin <= nMax'
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
if (operation.end !== undefined && operation.end <= operation.start) {
|
|
532
|
+
ctx.addIssue({
|
|
533
|
+
code: 'custom',
|
|
534
|
+
path: ['operations', index, 'end'],
|
|
535
|
+
message: 'repaint requires end > start'
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
export const audioEditClientParamsSchema = z
|
|
541
|
+
.object({
|
|
542
|
+
...audioEditShape,
|
|
543
|
+
sourceAudio: audioGenClientAudioInputSchema
|
|
544
|
+
})
|
|
545
|
+
.strict()
|
|
546
|
+
.superRefine(validateAudioEditOperations);
|
|
547
|
+
export const audioEditStreamRequestSchema = z
|
|
548
|
+
.object({
|
|
549
|
+
...audioEditShape,
|
|
550
|
+
sourceAudio: audioGenAudioInputSchema.describe('Recording to edit: a file path decoded server-side, or raw interleaved stereo 48 kHz Float32 LE PCM in [-1, 1].'),
|
|
551
|
+
type: z.literal('audioEditStream'),
|
|
552
|
+
requestId: z.string().min(1).optional()
|
|
553
|
+
})
|
|
554
|
+
.strict()
|
|
555
|
+
.superRefine(validateAudioEditOperations);
|
|
282
556
|
export const audioGenProgressSchema = z.object({
|
|
283
557
|
stage: z.string(),
|
|
284
558
|
step: z.number().int().nonnegative(),
|
|
@@ -287,16 +561,90 @@ export const audioGenProgressSchema = z.object({
|
|
|
287
561
|
.int()
|
|
288
562
|
.describe('Total number of steps when greater than zero. Values less than or equal to zero mean indeterminate progress and must not be rendered as a step / total determinate progress value.')
|
|
289
563
|
});
|
|
564
|
+
/**
|
|
565
|
+
* The LM's description of a clip, returned by `audioUnderstand()`. `audioCodes`
|
|
566
|
+
* are the recovered FSQ codes, reusable as a generation's `audioCodes` input.
|
|
567
|
+
*/
|
|
568
|
+
export const audioGenUnderstandResultSchema = z.object({
|
|
569
|
+
caption: z.string(),
|
|
570
|
+
bpm: z.number(),
|
|
571
|
+
duration: z.number().describe('LM estimate in seconds. The recovered codes fix the true length.'),
|
|
572
|
+
keyscale: z.string(),
|
|
573
|
+
timesignature: z.string(),
|
|
574
|
+
vocalLanguage: z.string(),
|
|
575
|
+
audioCodes: z
|
|
576
|
+
.array(z.number().int().min(INT32_MIN).max(INT32_MAX))
|
|
577
|
+
.max(AUDIOGEN_MAX_AUDIO_CODES)
|
|
578
|
+
.describe("FSQ semantic codes recovered from the clip, reusable as a generation's `audioCodes` input.")
|
|
579
|
+
});
|
|
290
580
|
export const audioGenStatsSchema = z.object({
|
|
291
581
|
audioDurationMs: z.number().optional(),
|
|
292
582
|
totalTimeMs: z.number().optional(),
|
|
293
583
|
realTimeFactor: z.number().optional(),
|
|
294
584
|
backendDevice: z.number().optional(),
|
|
295
|
-
backendId: z.number().optional()
|
|
585
|
+
backendId: z.number().optional(),
|
|
586
|
+
lyricsScore: z
|
|
587
|
+
.number()
|
|
588
|
+
.optional()
|
|
589
|
+
.describe('Lyric-to-audio alignment confidence in [0, 1]. Present only when the run set `generateLrc`.'),
|
|
590
|
+
lrc: z
|
|
591
|
+
.string()
|
|
592
|
+
.optional()
|
|
593
|
+
.describe('LRC-formatted lyric timestamps. Present only when the run set `generateLrc`.'),
|
|
594
|
+
qualityScore: z
|
|
595
|
+
.number()
|
|
596
|
+
.optional()
|
|
597
|
+
.describe('Weighted quality of the generated codes against the request, in [0, 1]. Present only when the run set `computeQualityScore`.'),
|
|
598
|
+
understand: audioGenUnderstandResultSchema
|
|
599
|
+
.optional()
|
|
600
|
+
.describe("The LM's description of the analysed clip. Present only on stats resolved by an `audioUnderstand()` response; also streamed as an output item.")
|
|
296
601
|
});
|
|
297
|
-
|
|
602
|
+
/**
|
|
603
|
+
* `audioUnderstand()` runs ACE-Step's reverse pipeline over a recording: the
|
|
604
|
+
* engine encodes the PCM, recovers the FSQ semantic codes, and the LM reports
|
|
605
|
+
* the clip's metadata and a caption. Sampling knobs mirror the LM controls on
|
|
606
|
+
* a generation.
|
|
607
|
+
*/
|
|
608
|
+
const audioUnderstandShape = {
|
|
609
|
+
modelId: z.string().min(1),
|
|
610
|
+
seed: z.number().int().optional().describe('RNG seed for the LM decode; omit for a random seed.'),
|
|
611
|
+
vocalLanguage: z
|
|
612
|
+
.string()
|
|
613
|
+
.min(1)
|
|
614
|
+
.optional()
|
|
615
|
+
.describe("Language hint (e.g. 'es') forced into the result instead of the LM's guess."),
|
|
616
|
+
lmTemperature: lmTemperatureSchema.optional().describe('LM sampling temperature (default 0.85).'),
|
|
617
|
+
lmTopP: unitIntervalSchema.optional().describe('LM nucleus-sampling probability (default 0.9).'),
|
|
618
|
+
lmTopK: lmTopKSchema.optional().describe('LM top-k cutoff; 0 disables top-k filtering.')
|
|
619
|
+
};
|
|
620
|
+
export const audioUnderstandClientParamsSchema = z
|
|
298
621
|
.object({
|
|
299
|
-
|
|
622
|
+
...audioUnderstandShape,
|
|
623
|
+
sourceAudio: audioGenClientAudioInputSchema
|
|
624
|
+
})
|
|
625
|
+
.strict();
|
|
626
|
+
export const audioUnderstandRequestSchema = z
|
|
627
|
+
.object({
|
|
628
|
+
...audioUnderstandShape,
|
|
629
|
+
sourceAudio: audioGenAudioInputSchema.describe('Recording to analyse: a file path decoded server-side, or raw interleaved stereo 48 kHz Float32 LE PCM in [-1, 1].'),
|
|
630
|
+
type: z.literal('audioUnderstand'),
|
|
631
|
+
requestId: z.string().min(1).optional()
|
|
632
|
+
})
|
|
633
|
+
.strict();
|
|
634
|
+
export const audioUnderstandResponseSchema = z
|
|
635
|
+
.object({
|
|
636
|
+
type: z.literal('audioUnderstand'),
|
|
637
|
+
progress: audioGenProgressSchema.optional(),
|
|
638
|
+
understand: audioGenUnderstandResultSchema.optional(),
|
|
639
|
+
done: z.boolean().default(false),
|
|
640
|
+
stopReason: z.enum(['completed', 'cancelled']).optional(),
|
|
641
|
+
stats: audioGenStatsSchema.optional(),
|
|
642
|
+
diagnostics: inferenceBackendDiagnosticsSchema.optional()
|
|
643
|
+
})
|
|
644
|
+
.strict();
|
|
645
|
+
// Generation and editing stream the same frames — progress ticks, PCM chunks,
|
|
646
|
+
// one terminal frame — and differ only in the wire `type` that routes them.
|
|
647
|
+
const audioGenStreamFrameShape = {
|
|
300
648
|
progress: audioGenProgressSchema.optional(),
|
|
301
649
|
data: base64Schema.optional(),
|
|
302
650
|
sampleRate: z.number().int().positive().optional(),
|
|
@@ -308,5 +656,16 @@ export const audioGenStreamResponseSchema = z
|
|
|
308
656
|
diagnostics: inferenceBackendDiagnosticsSchema
|
|
309
657
|
.optional()
|
|
310
658
|
.describe('Backend selection detail for the completed run. Carries the same payload the engine attaches to the internal diagnostics symbol, so an RPC client can read it.')
|
|
659
|
+
};
|
|
660
|
+
export const audioGenStreamResponseSchema = z
|
|
661
|
+
.object({
|
|
662
|
+
type: z.literal('audioGenStream'),
|
|
663
|
+
...audioGenStreamFrameShape
|
|
664
|
+
})
|
|
665
|
+
.strict();
|
|
666
|
+
export const audioEditStreamResponseSchema = z
|
|
667
|
+
.object({
|
|
668
|
+
type: z.literal('audioEditStream'),
|
|
669
|
+
...audioGenStreamFrameShape
|
|
311
670
|
})
|
|
312
671
|
.strict();
|
|
@@ -21,6 +21,7 @@ export declare const batchPromptSchema: z.ZodObject<{
|
|
|
21
21
|
repeat_penalty: z.ZodOptional<z.ZodNumber>;
|
|
22
22
|
reasoning_budget: z.ZodOptional<z.ZodNumber>;
|
|
23
23
|
remove_thinking_from_context: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
tool_choice: z.ZodOptional<z.ZodString>;
|
|
24
25
|
}, z.core.$strict>>;
|
|
25
26
|
responseFormat: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
26
27
|
type: z.ZodLiteral<"text">;
|
|
@@ -78,6 +79,7 @@ declare const batchPromptStreamSchema: z.ZodObject<{
|
|
|
78
79
|
repeat_penalty: z.ZodOptional<z.ZodNumber>;
|
|
79
80
|
reasoning_budget: z.ZodOptional<z.ZodNumber>;
|
|
80
81
|
remove_thinking_from_context: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
tool_choice: z.ZodOptional<z.ZodString>;
|
|
81
83
|
}, z.core.$strict>>;
|
|
82
84
|
responseFormat: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
83
85
|
type: z.ZodLiteral<"text">;
|
|
@@ -136,6 +138,7 @@ export declare const batchCompletionClientParamsSchema: z.ZodObject<{
|
|
|
136
138
|
repeat_penalty: z.ZodOptional<z.ZodNumber>;
|
|
137
139
|
reasoning_budget: z.ZodOptional<z.ZodNumber>;
|
|
138
140
|
remove_thinking_from_context: z.ZodOptional<z.ZodBoolean>;
|
|
141
|
+
tool_choice: z.ZodOptional<z.ZodString>;
|
|
139
142
|
}, z.core.$strict>>;
|
|
140
143
|
responseFormat: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
141
144
|
type: z.ZodLiteral<"text">;
|
|
@@ -222,6 +225,7 @@ export declare const batchCompletionStreamRequestSchema: z.ZodObject<{
|
|
|
222
225
|
repeat_penalty: z.ZodOptional<z.ZodNumber>;
|
|
223
226
|
reasoning_budget: z.ZodOptional<z.ZodNumber>;
|
|
224
227
|
remove_thinking_from_context: z.ZodOptional<z.ZodBoolean>;
|
|
228
|
+
tool_choice: z.ZodOptional<z.ZodString>;
|
|
225
229
|
}, z.core.$strict>>;
|
|
226
230
|
responseFormat: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
227
231
|
type: z.ZodLiteral<"text">;
|
|
@@ -301,11 +305,13 @@ export declare const batchCompletionEventSchema: z.ZodObject<{
|
|
|
301
305
|
stats: z.ZodObject<{
|
|
302
306
|
timeToFirstToken: z.ZodOptional<z.ZodNumber>;
|
|
303
307
|
tokensPerSecond: z.ZodOptional<z.ZodNumber>;
|
|
308
|
+
promptTokensPerSecond: z.ZodOptional<z.ZodNumber>;
|
|
304
309
|
cacheTokens: z.ZodOptional<z.ZodNumber>;
|
|
305
310
|
promptTokens: z.ZodOptional<z.ZodNumber>;
|
|
306
311
|
generatedTokens: z.ZodOptional<z.ZodNumber>;
|
|
307
312
|
emittedTokens: z.ZodOptional<z.ZodNumber>;
|
|
308
313
|
avgConcurrentSeq: z.ZodOptional<z.ZodNumber>;
|
|
314
|
+
toolDefinitionsDropped: z.ZodOptional<z.ZodNumber>;
|
|
309
315
|
backendDevice: z.ZodOptional<z.ZodEnum<{
|
|
310
316
|
gpu: "gpu";
|
|
311
317
|
cpu: "cpu";
|
|
@@ -380,11 +386,13 @@ export declare const batchCompletionStreamResponseSchema: z.ZodObject<{
|
|
|
380
386
|
stats: z.ZodObject<{
|
|
381
387
|
timeToFirstToken: z.ZodOptional<z.ZodNumber>;
|
|
382
388
|
tokensPerSecond: z.ZodOptional<z.ZodNumber>;
|
|
389
|
+
promptTokensPerSecond: z.ZodOptional<z.ZodNumber>;
|
|
383
390
|
cacheTokens: z.ZodOptional<z.ZodNumber>;
|
|
384
391
|
promptTokens: z.ZodOptional<z.ZodNumber>;
|
|
385
392
|
generatedTokens: z.ZodOptional<z.ZodNumber>;
|
|
386
393
|
emittedTokens: z.ZodOptional<z.ZodNumber>;
|
|
387
394
|
avgConcurrentSeq: z.ZodOptional<z.ZodNumber>;
|
|
395
|
+
toolDefinitionsDropped: z.ZodOptional<z.ZodNumber>;
|
|
388
396
|
backendDevice: z.ZodOptional<z.ZodEnum<{
|
|
389
397
|
gpu: "gpu";
|
|
390
398
|
cpu: "cpu";
|
|
@@ -417,11 +425,13 @@ export declare const batchCompletionStreamResponseSchema: z.ZodObject<{
|
|
|
417
425
|
stats: z.ZodOptional<z.ZodObject<{
|
|
418
426
|
timeToFirstToken: z.ZodOptional<z.ZodNumber>;
|
|
419
427
|
tokensPerSecond: z.ZodOptional<z.ZodNumber>;
|
|
428
|
+
promptTokensPerSecond: z.ZodOptional<z.ZodNumber>;
|
|
420
429
|
cacheTokens: z.ZodOptional<z.ZodNumber>;
|
|
421
430
|
promptTokens: z.ZodOptional<z.ZodNumber>;
|
|
422
431
|
generatedTokens: z.ZodOptional<z.ZodNumber>;
|
|
423
432
|
emittedTokens: z.ZodOptional<z.ZodNumber>;
|
|
424
433
|
avgConcurrentSeq: z.ZodOptional<z.ZodNumber>;
|
|
434
|
+
toolDefinitionsDropped: z.ZodOptional<z.ZodNumber>;
|
|
425
435
|
backendDevice: z.ZodOptional<z.ZodEnum<{
|
|
426
436
|
gpu: "gpu";
|
|
427
437
|
cpu: "cpu";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { completionEventSchema, completionStatsSchema } from './completion-event.js';
|
|
3
|
-
import { completionParamsSchema, generationParamsSchema, responseFormatSchema, toolDialectSchema } from './completion-stream.js';
|
|
3
|
+
import { completionParamsSchema, generationParamsSchema, refineToolChoiceMatchesTools, responseFormatSchema, toolDialectSchema } from './completion-stream.js';
|
|
4
4
|
import { toolSchema } from './tools.js';
|
|
5
5
|
const mcpClientInputSchema = z.custom();
|
|
6
6
|
const batchPromptBaseSchema = z
|
|
@@ -39,13 +39,15 @@ export const batchPromptSchema = batchPromptBaseSchema
|
|
|
39
39
|
.describe('Optional per-prompt MCP clients used to source tools.')
|
|
40
40
|
})
|
|
41
41
|
.strict()
|
|
42
|
-
.superRefine(refineNoToolsWithStructuredOutput)
|
|
42
|
+
.superRefine(refineNoToolsWithStructuredOutput)
|
|
43
|
+
.superRefine(refineToolChoiceMatchesTools);
|
|
43
44
|
const batchPromptStreamSchema = batchPromptBaseSchema
|
|
44
45
|
.extend({
|
|
45
46
|
tools: z.array(toolSchema).optional().describe('Resolved per-prompt tools the model can call.')
|
|
46
47
|
})
|
|
47
48
|
.strict()
|
|
48
|
-
.superRefine(refineNoToolsWithStructuredOutput)
|
|
49
|
+
.superRefine(refineNoToolsWithStructuredOutput)
|
|
50
|
+
.superRefine(refineToolChoiceMatchesTools);
|
|
49
51
|
const batchCompletionClientParamsBaseSchema = z
|
|
50
52
|
.object({
|
|
51
53
|
modelId: z.string().describe('The identifier of the model to use for batch completion.'),
|
package/dist/schemas/bci.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare const bciTranscribeParamsSchema: z.ZodObject<{
|
|
|
21
21
|
export declare const bciTranscribeClientParamsSchema: z.ZodObject<{
|
|
22
22
|
modelId: z.ZodString;
|
|
23
23
|
metadata: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
-
neuralData: z.ZodUnion<readonly [z.ZodString, z.
|
|
24
|
+
neuralData: z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<Uint8Array<ArrayBuffer>>]>;
|
|
25
25
|
}, z.core.$strip>;
|
|
26
26
|
export declare const bciTranscribeRequestSchema: z.ZodObject<{
|
|
27
27
|
modelId: z.ZodString;
|