@ai-sdk/bytedance 2.0.53 → 2.0.55
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/CHANGELOG.md +16 -0
- package/dist/index.d.ts +128 -120
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +478 -635
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1,663 +1,506 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
NoSuchModelError
|
|
4
|
-
} from "@ai-sdk/provider";
|
|
5
|
-
import {
|
|
6
|
-
loadApiKey,
|
|
7
|
-
withoutTrailingSlash
|
|
8
|
-
} from "@ai-sdk/provider-utils";
|
|
9
|
-
|
|
10
|
-
// src/bytedance-image-model.ts
|
|
11
|
-
import {
|
|
12
|
-
combineHeaders,
|
|
13
|
-
convertImageModelFileToDataUri,
|
|
14
|
-
createJsonErrorResponseHandler,
|
|
15
|
-
createJsonResponseHandler,
|
|
16
|
-
parseProviderOptions,
|
|
17
|
-
postJsonToApi,
|
|
18
|
-
resolve
|
|
19
|
-
} from "@ai-sdk/provider-utils";
|
|
20
|
-
import { z as z2 } from "zod/v4";
|
|
21
|
-
|
|
22
|
-
// src/bytedance-image-model-options.ts
|
|
23
|
-
import { lazySchema, zodSchema } from "@ai-sdk/provider-utils";
|
|
1
|
+
import { AISDKError, NoSuchModelError } from "@ai-sdk/provider";
|
|
2
|
+
import { combineHeaders, convertImageModelFileToDataUri, createJsonErrorResponseHandler, createJsonResponseHandler, getFromApi, getTopLevelMediaType, lazySchema, loadApiKey, parseProviderOptions, postJsonToApi, resolve, withoutTrailingSlash, zodSchema } from "@ai-sdk/provider-utils";
|
|
24
3
|
import { z } from "zod/v4";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"sequentialImageGeneration",
|
|
44
|
-
"maxImages",
|
|
45
|
-
"optimizePromptMode"
|
|
4
|
+
//#region src/bytedance-image-model-options.ts
|
|
5
|
+
const byteDanceImageModelOptionsSchema = lazySchema(() => zodSchema(z.looseObject({
|
|
6
|
+
watermark: z.boolean().nullish(),
|
|
7
|
+
outputFormat: z.enum(["png", "jpeg"]).nullish(),
|
|
8
|
+
size: z.string().nullish(),
|
|
9
|
+
sequentialImageGeneration: z.enum(["auto", "disabled"]).nullish(),
|
|
10
|
+
maxImages: z.number().int().positive().nullish(),
|
|
11
|
+
optimizePromptMode: z.enum(["standard", "fast"]).nullish()
|
|
12
|
+
})));
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/bytedance-image-model.ts
|
|
15
|
+
const HANDLED_PROVIDER_OPTIONS$1 = /* @__PURE__ */ new Set([
|
|
16
|
+
"watermark",
|
|
17
|
+
"outputFormat",
|
|
18
|
+
"size",
|
|
19
|
+
"sequentialImageGeneration",
|
|
20
|
+
"maxImages",
|
|
21
|
+
"optimizePromptMode"
|
|
46
22
|
]);
|
|
47
23
|
var ByteDanceImageModel = class {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (byteDanceOptions.sequentialImageGeneration != null) {
|
|
129
|
-
body.sequential_image_generation = byteDanceOptions.sequentialImageGeneration;
|
|
130
|
-
}
|
|
131
|
-
if (byteDanceOptions.maxImages != null) {
|
|
132
|
-
body.sequential_image_generation_options = {
|
|
133
|
-
max_images: byteDanceOptions.maxImages
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
if (byteDanceOptions.optimizePromptMode != null) {
|
|
137
|
-
body.optimize_prompt_options = {
|
|
138
|
-
mode: byteDanceOptions.optimizePromptMode
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
for (const [key, value] of Object.entries(byteDanceOptions)) {
|
|
142
|
-
if (!HANDLED_PROVIDER_OPTIONS.has(key)) {
|
|
143
|
-
body[key] = value;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
body.response_format = "b64_json";
|
|
148
|
-
const { value: response, responseHeaders } = await postJsonToApi({
|
|
149
|
-
url: `${this.config.baseURL}/images/generations`,
|
|
150
|
-
headers: combineHeaders(await resolve(this.config.headers), headers),
|
|
151
|
-
body,
|
|
152
|
-
failedResponseHandler: byteDanceFailedResponseHandler,
|
|
153
|
-
successfulResponseHandler: createJsonResponseHandler(
|
|
154
|
-
byteDanceImageResponseSchema
|
|
155
|
-
),
|
|
156
|
-
abortSignal,
|
|
157
|
-
fetch: this.config.fetch
|
|
158
|
-
});
|
|
159
|
-
return {
|
|
160
|
-
images: response.data.map((item) => item.b64_json),
|
|
161
|
-
warnings,
|
|
162
|
-
usage: mapImageUsage(response.usage),
|
|
163
|
-
response: {
|
|
164
|
-
timestamp: currentDate,
|
|
165
|
-
modelId: this.modelId,
|
|
166
|
-
headers: responseHeaders
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
}
|
|
24
|
+
get supportsFileInputs() {
|
|
25
|
+
return [
|
|
26
|
+
"dola-seedream-5-0-pro-260628",
|
|
27
|
+
"seedream-5-0-260128",
|
|
28
|
+
"seedream-5-0-lite-260128",
|
|
29
|
+
"seedream-4-5-251128",
|
|
30
|
+
"seedream-4-0-250828"
|
|
31
|
+
].includes(this.modelId) ? true : void 0;
|
|
32
|
+
}
|
|
33
|
+
get supportsMaskInputs() {
|
|
34
|
+
return this.supportsFileInputs === true ? false : void 0;
|
|
35
|
+
}
|
|
36
|
+
get provider() {
|
|
37
|
+
return this.config.provider;
|
|
38
|
+
}
|
|
39
|
+
constructor(modelId, config) {
|
|
40
|
+
this.modelId = modelId;
|
|
41
|
+
this.config = config;
|
|
42
|
+
this.specificationVersion = "v4";
|
|
43
|
+
this.maxImagesPerCall = 1;
|
|
44
|
+
}
|
|
45
|
+
async doGenerate({ prompt, size, aspectRatio, seed, providerOptions, headers, abortSignal, files, mask }) {
|
|
46
|
+
const warnings = [];
|
|
47
|
+
if (aspectRatio != null) warnings.push({
|
|
48
|
+
type: "unsupported",
|
|
49
|
+
feature: "aspectRatio",
|
|
50
|
+
details: "ByteDance does not support aspectRatio. Use `size` (e.g. \"2048x2048\" or a resolution level like \"2K\" via providerOptions) instead."
|
|
51
|
+
});
|
|
52
|
+
if (seed != null) warnings.push({
|
|
53
|
+
type: "unsupported",
|
|
54
|
+
feature: "seed"
|
|
55
|
+
});
|
|
56
|
+
if (mask != null) warnings.push({
|
|
57
|
+
type: "unsupported",
|
|
58
|
+
feature: "mask",
|
|
59
|
+
details: "ByteDance Seedream does not support a separate mask. Provide edit instructions in the prompt, optionally with markings on the input image."
|
|
60
|
+
});
|
|
61
|
+
const currentDate = this.config._internal?.currentDate?.() ?? /* @__PURE__ */ new Date();
|
|
62
|
+
const byteDanceOptions = await parseProviderOptions({
|
|
63
|
+
provider: "bytedance",
|
|
64
|
+
providerOptions,
|
|
65
|
+
schema: byteDanceImageModelOptionsSchema
|
|
66
|
+
});
|
|
67
|
+
const image = files != null && files.length > 0 ? files.length === 1 ? convertImageModelFileToDataUri(files[0]) : files.map(convertImageModelFileToDataUri) : void 0;
|
|
68
|
+
const body = {
|
|
69
|
+
model: this.modelId,
|
|
70
|
+
prompt
|
|
71
|
+
};
|
|
72
|
+
if (image != null) body.image = image;
|
|
73
|
+
if (size != null) body.size = size;
|
|
74
|
+
if (byteDanceOptions != null) {
|
|
75
|
+
if (byteDanceOptions.watermark != null) body.watermark = byteDanceOptions.watermark;
|
|
76
|
+
if (byteDanceOptions.outputFormat != null) body.output_format = byteDanceOptions.outputFormat;
|
|
77
|
+
if (byteDanceOptions.size != null) body.size = byteDanceOptions.size;
|
|
78
|
+
if (byteDanceOptions.sequentialImageGeneration != null) body.sequential_image_generation = byteDanceOptions.sequentialImageGeneration;
|
|
79
|
+
if (byteDanceOptions.maxImages != null) body.sequential_image_generation_options = { max_images: byteDanceOptions.maxImages };
|
|
80
|
+
if (byteDanceOptions.optimizePromptMode != null) body.optimize_prompt_options = { mode: byteDanceOptions.optimizePromptMode };
|
|
81
|
+
for (const [key, value] of Object.entries(byteDanceOptions)) if (!HANDLED_PROVIDER_OPTIONS$1.has(key)) body[key] = value;
|
|
82
|
+
}
|
|
83
|
+
body.response_format = "b64_json";
|
|
84
|
+
const { value: response, responseHeaders } = await postJsonToApi({
|
|
85
|
+
url: `${this.config.baseURL}/images/generations`,
|
|
86
|
+
headers: combineHeaders(await resolve(this.config.headers), headers),
|
|
87
|
+
body,
|
|
88
|
+
failedResponseHandler: byteDanceFailedResponseHandler$1,
|
|
89
|
+
successfulResponseHandler: createJsonResponseHandler(byteDanceImageResponseSchema),
|
|
90
|
+
abortSignal,
|
|
91
|
+
fetch: this.config.fetch
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
images: response.data.map((item) => item.b64_json),
|
|
95
|
+
warnings,
|
|
96
|
+
usage: mapImageUsage(response.usage),
|
|
97
|
+
response: {
|
|
98
|
+
timestamp: currentDate,
|
|
99
|
+
modelId: this.modelId,
|
|
100
|
+
headers: responseHeaders
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
170
104
|
};
|
|
171
105
|
function mapImageUsage(usage) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
106
|
+
return usage == null ? void 0 : {
|
|
107
|
+
inputTokens: void 0,
|
|
108
|
+
outputTokens: usage.output_tokens ?? void 0,
|
|
109
|
+
totalTokens: usage.total_tokens ?? void 0
|
|
110
|
+
};
|
|
177
111
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
112
|
+
const byteDanceImageResponseSchema = z.object({
|
|
113
|
+
data: z.array(z.object({ b64_json: z.string() })),
|
|
114
|
+
usage: z.object({
|
|
115
|
+
output_tokens: z.number().nullish(),
|
|
116
|
+
total_tokens: z.number().nullish()
|
|
117
|
+
}).nullish()
|
|
184
118
|
});
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
119
|
+
const byteDanceErrorSchema$1 = z.object({
|
|
120
|
+
error: z.object({
|
|
121
|
+
message: z.string(),
|
|
122
|
+
code: z.string().nullish()
|
|
123
|
+
}).nullish(),
|
|
124
|
+
message: z.string().nullish()
|
|
191
125
|
});
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
126
|
+
const byteDanceFailedResponseHandler$1 = createJsonErrorResponseHandler({
|
|
127
|
+
errorSchema: byteDanceErrorSchema$1,
|
|
128
|
+
errorToMessage: (data) => data.error?.message ?? data.message ?? "Unknown error"
|
|
195
129
|
});
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
referenceImages: z3.array(z3.string()).nullish(),
|
|
228
|
-
referenceVideos: z3.array(z3.string()).nullish(),
|
|
229
|
-
referenceAudio: z3.array(z3.string()).nullish(),
|
|
230
|
-
pollIntervalMs: z3.number().positive().nullish(),
|
|
231
|
-
pollTimeoutMs: z3.number().positive().nullish()
|
|
232
|
-
})
|
|
233
|
-
)
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
// src/bytedance-video-model.ts
|
|
237
|
-
var HANDLED_PROVIDER_OPTIONS2 = /* @__PURE__ */ new Set([
|
|
238
|
-
"watermark",
|
|
239
|
-
"generateAudio",
|
|
240
|
-
"cameraFixed",
|
|
241
|
-
"returnLastFrame",
|
|
242
|
-
"serviceTier",
|
|
243
|
-
"draft",
|
|
244
|
-
"lastFrameImage",
|
|
245
|
-
"referenceImages",
|
|
246
|
-
"referenceVideos",
|
|
247
|
-
"referenceAudio",
|
|
248
|
-
"pollIntervalMs",
|
|
249
|
-
"pollTimeoutMs"
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/bytedance-video-model-options.ts
|
|
132
|
+
const byteDanceVideoModelOptionsSchema = lazySchema(() => zodSchema(z.looseObject({
|
|
133
|
+
watermark: z.boolean().nullish(),
|
|
134
|
+
generateAudio: z.boolean().nullish(),
|
|
135
|
+
cameraFixed: z.boolean().nullish(),
|
|
136
|
+
returnLastFrame: z.boolean().nullish(),
|
|
137
|
+
serviceTier: z.enum(["default", "flex"]).nullish(),
|
|
138
|
+
draft: z.boolean().nullish(),
|
|
139
|
+
lastFrameImage: z.string().nullish(),
|
|
140
|
+
referenceImages: z.array(z.string()).nullish(),
|
|
141
|
+
referenceVideos: z.array(z.string()).nullish(),
|
|
142
|
+
referenceAudio: z.array(z.string()).nullish(),
|
|
143
|
+
pollIntervalMs: z.number().positive().nullish(),
|
|
144
|
+
pollTimeoutMs: z.number().positive().nullish()
|
|
145
|
+
})));
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/bytedance-video-model.ts
|
|
148
|
+
const HANDLED_PROVIDER_OPTIONS = /* @__PURE__ */ new Set([
|
|
149
|
+
"watermark",
|
|
150
|
+
"generateAudio",
|
|
151
|
+
"cameraFixed",
|
|
152
|
+
"returnLastFrame",
|
|
153
|
+
"serviceTier",
|
|
154
|
+
"draft",
|
|
155
|
+
"lastFrameImage",
|
|
156
|
+
"referenceImages",
|
|
157
|
+
"referenceVideos",
|
|
158
|
+
"referenceAudio",
|
|
159
|
+
"pollIntervalMs",
|
|
160
|
+
"pollTimeoutMs"
|
|
250
161
|
]);
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
162
|
+
const RESOLUTION_MAP = {
|
|
163
|
+
"864x496": "480p",
|
|
164
|
+
"496x864": "480p",
|
|
165
|
+
"752x560": "480p",
|
|
166
|
+
"560x752": "480p",
|
|
167
|
+
"640x640": "480p",
|
|
168
|
+
"992x432": "480p",
|
|
169
|
+
"432x992": "480p",
|
|
170
|
+
"864x480": "480p",
|
|
171
|
+
"480x864": "480p",
|
|
172
|
+
"736x544": "480p",
|
|
173
|
+
"544x736": "480p",
|
|
174
|
+
"960x416": "480p",
|
|
175
|
+
"416x960": "480p",
|
|
176
|
+
"832x480": "480p",
|
|
177
|
+
"480x832": "480p",
|
|
178
|
+
"624x624": "480p",
|
|
179
|
+
"1280x720": "720p",
|
|
180
|
+
"720x1280": "720p",
|
|
181
|
+
"1112x834": "720p",
|
|
182
|
+
"834x1112": "720p",
|
|
183
|
+
"960x960": "720p",
|
|
184
|
+
"1470x630": "720p",
|
|
185
|
+
"630x1470": "720p",
|
|
186
|
+
"1248x704": "720p",
|
|
187
|
+
"704x1248": "720p",
|
|
188
|
+
"1120x832": "720p",
|
|
189
|
+
"832x1120": "720p",
|
|
190
|
+
"1504x640": "720p",
|
|
191
|
+
"640x1504": "720p",
|
|
192
|
+
"1920x1080": "1080p",
|
|
193
|
+
"1080x1920": "1080p",
|
|
194
|
+
"1664x1248": "1080p",
|
|
195
|
+
"1248x1664": "1080p",
|
|
196
|
+
"1440x1440": "1080p",
|
|
197
|
+
"2206x946": "1080p",
|
|
198
|
+
"946x2206": "1080p",
|
|
199
|
+
"1920x1088": "1080p",
|
|
200
|
+
"1088x1920": "1080p",
|
|
201
|
+
"2176x928": "1080p",
|
|
202
|
+
"928x2176": "1080p"
|
|
292
203
|
};
|
|
293
204
|
function getFirstFrameImage(options) {
|
|
294
|
-
|
|
205
|
+
return options.frameImages?.find((frame) => frame.frameType === "first_frame")?.image;
|
|
295
206
|
}
|
|
296
207
|
function resolveStartImage(options) {
|
|
297
|
-
|
|
208
|
+
return getFirstFrameImage(options) ?? options.image;
|
|
298
209
|
}
|
|
299
|
-
|
|
210
|
+
const isVideoFile = (f) => f.mediaType != null && getTopLevelMediaType(f.mediaType) === "video";
|
|
300
211
|
function resolveReferenceContent(options, byteDanceOptions, warnings) {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
return content;
|
|
212
|
+
if (options.frameImages != null && options.frameImages.length > 0) return [];
|
|
213
|
+
const inputReferences = options.inputReferences;
|
|
214
|
+
if (inputReferences != null && inputReferences.length > 0) return inputReferences.map((reference) => {
|
|
215
|
+
if (reference.type === "url" && reference.mediaType == null) warnings.push({
|
|
216
|
+
type: "unsupported",
|
|
217
|
+
feature: "inputReferences",
|
|
218
|
+
details: "ByteDance requires an explicit mediaType to route URL references as video or image. Pass { data: url, mediaType: \"video/mp4\" } for video references. The reference was treated as an image."
|
|
219
|
+
});
|
|
220
|
+
const url = convertImageModelFileToDataUri(reference);
|
|
221
|
+
return isVideoFile(reference) ? {
|
|
222
|
+
type: "video_url",
|
|
223
|
+
video_url: { url },
|
|
224
|
+
role: "reference_video"
|
|
225
|
+
} : {
|
|
226
|
+
type: "image_url",
|
|
227
|
+
image_url: { url },
|
|
228
|
+
role: "reference_image"
|
|
229
|
+
};
|
|
230
|
+
});
|
|
231
|
+
const content = [];
|
|
232
|
+
for (const imageUrl of byteDanceOptions?.referenceImages ?? []) content.push({
|
|
233
|
+
type: "image_url",
|
|
234
|
+
image_url: { url: imageUrl },
|
|
235
|
+
role: "reference_image"
|
|
236
|
+
});
|
|
237
|
+
for (const videoUrl of byteDanceOptions?.referenceVideos ?? []) content.push({
|
|
238
|
+
type: "video_url",
|
|
239
|
+
video_url: { url: videoUrl },
|
|
240
|
+
role: "reference_video"
|
|
241
|
+
});
|
|
242
|
+
return content;
|
|
334
243
|
}
|
|
335
244
|
function resolveLastFrameImage(options, byteDanceOptions) {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
if (lastFrame != null) {
|
|
340
|
-
return convertImageModelFileToDataUri2(lastFrame);
|
|
341
|
-
}
|
|
342
|
-
return byteDanceOptions?.lastFrameImage ?? void 0;
|
|
245
|
+
const lastFrame = options.frameImages?.find((frame) => frame.frameType === "last_frame")?.image;
|
|
246
|
+
if (lastFrame != null) return convertImageModelFileToDataUri(lastFrame);
|
|
247
|
+
return byteDanceOptions?.lastFrameImage ?? void 0;
|
|
343
248
|
}
|
|
344
249
|
var ByteDanceVideoModel = class {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
validateUrl: true,
|
|
516
|
-
trustedOrigin: this.config.baseURL,
|
|
517
|
-
headers: combineHeaders2(
|
|
518
|
-
await resolve2(this.config.headers),
|
|
519
|
-
options.headers
|
|
520
|
-
),
|
|
521
|
-
failedResponseHandler: byteDanceFailedResponseHandler2,
|
|
522
|
-
successfulResponseHandler: createJsonResponseHandler2(
|
|
523
|
-
byteDanceStatusResponseSchema
|
|
524
|
-
),
|
|
525
|
-
abortSignal: options.abortSignal,
|
|
526
|
-
fetch: this.config.fetch
|
|
527
|
-
});
|
|
528
|
-
if (statusResponse.status === "succeeded") {
|
|
529
|
-
const videoUrl = statusResponse.content?.video_url;
|
|
530
|
-
if (!videoUrl) {
|
|
531
|
-
throw new AISDKError({
|
|
532
|
-
name: "BYTEDANCE_VIDEO_GENERATION_ERROR",
|
|
533
|
-
message: `No video URL in response. Task ID: ${taskId}`
|
|
534
|
-
});
|
|
535
|
-
}
|
|
536
|
-
return {
|
|
537
|
-
status: "completed",
|
|
538
|
-
videos: [
|
|
539
|
-
{
|
|
540
|
-
type: "url",
|
|
541
|
-
url: videoUrl,
|
|
542
|
-
mediaType: "video/mp4"
|
|
543
|
-
}
|
|
544
|
-
],
|
|
545
|
-
warnings: [],
|
|
546
|
-
response: {
|
|
547
|
-
timestamp: currentDate,
|
|
548
|
-
modelId: this.modelId,
|
|
549
|
-
headers: responseHeaders
|
|
550
|
-
},
|
|
551
|
-
providerMetadata: {
|
|
552
|
-
bytedance: {
|
|
553
|
-
taskId,
|
|
554
|
-
usage: statusResponse.usage,
|
|
555
|
-
...statusResponse.content?.last_frame_url != null ? { lastFrameUrl: statusResponse.content.last_frame_url } : {}
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
};
|
|
559
|
-
}
|
|
560
|
-
if (statusResponse.status === "failed" || statusResponse.status === "expired" || statusResponse.status === "cancelled" || statusResponse.status === "canceled") {
|
|
561
|
-
const failureDetails = statusResponse.error?.message ?? statusResponse.error?.code ?? JSON.stringify(statusResponse);
|
|
562
|
-
return {
|
|
563
|
-
status: "error",
|
|
564
|
-
error: `Video generation ${statusResponse.status}. Task ID: ${taskId}. ${failureDetails}`,
|
|
565
|
-
response: {
|
|
566
|
-
timestamp: currentDate,
|
|
567
|
-
modelId: this.modelId,
|
|
568
|
-
headers: responseHeaders
|
|
569
|
-
}
|
|
570
|
-
};
|
|
571
|
-
}
|
|
572
|
-
return {
|
|
573
|
-
status: "pending",
|
|
574
|
-
response: {
|
|
575
|
-
timestamp: currentDate,
|
|
576
|
-
modelId: this.modelId,
|
|
577
|
-
headers: responseHeaders
|
|
578
|
-
}
|
|
579
|
-
};
|
|
580
|
-
}
|
|
250
|
+
get provider() {
|
|
251
|
+
return this.config.provider;
|
|
252
|
+
}
|
|
253
|
+
constructor(modelId, config) {
|
|
254
|
+
this.modelId = modelId;
|
|
255
|
+
this.config = config;
|
|
256
|
+
this.specificationVersion = "v4";
|
|
257
|
+
this.maxVideosPerCall = 1;
|
|
258
|
+
}
|
|
259
|
+
async buildRequestBody(options) {
|
|
260
|
+
const warnings = [];
|
|
261
|
+
const byteDanceOptions = await parseProviderOptions({
|
|
262
|
+
provider: "bytedance",
|
|
263
|
+
providerOptions: options.providerOptions,
|
|
264
|
+
schema: byteDanceVideoModelOptionsSchema
|
|
265
|
+
});
|
|
266
|
+
for (const setting of ["pollIntervalMs", "pollTimeoutMs"]) if (byteDanceOptions?.[setting] != null) warnings.push({
|
|
267
|
+
type: "deprecated",
|
|
268
|
+
setting,
|
|
269
|
+
message: `\`${setting}\` is ignored. Polling is orchestrated by the AI SDK: pass \`poll: { intervalMs, timeoutMs }\` to \`generateVideo\` instead.`
|
|
270
|
+
});
|
|
271
|
+
if (options.fps) warnings.push({
|
|
272
|
+
type: "unsupported",
|
|
273
|
+
feature: "fps",
|
|
274
|
+
details: "ByteDance video models do not support custom FPS. Frame rate is fixed at 24 fps."
|
|
275
|
+
});
|
|
276
|
+
if (options.n != null && options.n > 1) warnings.push({
|
|
277
|
+
type: "unsupported",
|
|
278
|
+
feature: "n",
|
|
279
|
+
details: "ByteDance video models do not support generating multiple videos per call. Only 1 video will be generated."
|
|
280
|
+
});
|
|
281
|
+
const content = [];
|
|
282
|
+
if (options.prompt != null) content.push({
|
|
283
|
+
type: "text",
|
|
284
|
+
text: options.prompt
|
|
285
|
+
});
|
|
286
|
+
const startImage = resolveStartImage(options);
|
|
287
|
+
const lastFrameImageUrl = resolveLastFrameImage(options, byteDanceOptions);
|
|
288
|
+
const referenceContent = resolveReferenceContent(options, byteDanceOptions, warnings);
|
|
289
|
+
if (startImage != null) content.push({
|
|
290
|
+
type: "image_url",
|
|
291
|
+
image_url: { url: convertImageModelFileToDataUri(startImage) },
|
|
292
|
+
...lastFrameImageUrl != null ? { role: "first_frame" } : referenceContent.length > 0 ? { role: "reference_image" } : {}
|
|
293
|
+
});
|
|
294
|
+
if (lastFrameImageUrl != null) content.push({
|
|
295
|
+
type: "image_url",
|
|
296
|
+
image_url: { url: lastFrameImageUrl },
|
|
297
|
+
role: "last_frame"
|
|
298
|
+
});
|
|
299
|
+
for (const entry of referenceContent) content.push(entry);
|
|
300
|
+
if (byteDanceOptions?.referenceAudio != null && byteDanceOptions.referenceAudio.length > 0) for (const audioUrl of byteDanceOptions.referenceAudio) content.push({
|
|
301
|
+
type: "audio_url",
|
|
302
|
+
audio_url: { url: audioUrl },
|
|
303
|
+
role: "reference_audio"
|
|
304
|
+
});
|
|
305
|
+
const body = {
|
|
306
|
+
model: this.modelId,
|
|
307
|
+
content
|
|
308
|
+
};
|
|
309
|
+
if (options.aspectRatio) body.ratio = options.aspectRatio;
|
|
310
|
+
if (options.duration) body.duration = options.duration;
|
|
311
|
+
if (options.seed) body.seed = options.seed;
|
|
312
|
+
if (options.resolution) {
|
|
313
|
+
const mapped = RESOLUTION_MAP[options.resolution];
|
|
314
|
+
if (mapped) body.resolution = mapped;
|
|
315
|
+
else body.resolution = options.resolution;
|
|
316
|
+
}
|
|
317
|
+
const generateAudio = options.generateAudio ?? byteDanceOptions?.generateAudio;
|
|
318
|
+
if (generateAudio != null) body.generate_audio = generateAudio;
|
|
319
|
+
if (byteDanceOptions != null) {
|
|
320
|
+
if (byteDanceOptions.watermark != null) body.watermark = byteDanceOptions.watermark;
|
|
321
|
+
if (byteDanceOptions.cameraFixed != null) body.camera_fixed = byteDanceOptions.cameraFixed;
|
|
322
|
+
if (byteDanceOptions.returnLastFrame != null) body.return_last_frame = byteDanceOptions.returnLastFrame;
|
|
323
|
+
if (byteDanceOptions.serviceTier != null) body.service_tier = byteDanceOptions.serviceTier;
|
|
324
|
+
if (byteDanceOptions.draft != null) body.draft = byteDanceOptions.draft;
|
|
325
|
+
for (const [key, value] of Object.entries(byteDanceOptions)) if (!HANDLED_PROVIDER_OPTIONS.has(key)) body[key] = value;
|
|
326
|
+
}
|
|
327
|
+
return {
|
|
328
|
+
body,
|
|
329
|
+
warnings
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
async doStart(options) {
|
|
333
|
+
const currentDate = this.config._internal?.currentDate?.() ?? /* @__PURE__ */ new Date();
|
|
334
|
+
const { body, warnings } = await this.buildRequestBody(options);
|
|
335
|
+
if (options.webhookUrl != null) body.callback_url = options.webhookUrl;
|
|
336
|
+
const { value: createResponse, responseHeaders } = await postJsonToApi({
|
|
337
|
+
url: `${this.config.baseURL}/contents/generations/tasks`,
|
|
338
|
+
headers: combineHeaders(await resolve(this.config.headers), options.headers),
|
|
339
|
+
body,
|
|
340
|
+
failedResponseHandler: byteDanceFailedResponseHandler,
|
|
341
|
+
successfulResponseHandler: createJsonResponseHandler(byteDanceTaskResponseSchema),
|
|
342
|
+
abortSignal: options.abortSignal,
|
|
343
|
+
fetch: this.config.fetch
|
|
344
|
+
});
|
|
345
|
+
const taskId = createResponse.id;
|
|
346
|
+
if (!taskId) throw new AISDKError({
|
|
347
|
+
name: "BYTEDANCE_VIDEO_GENERATION_ERROR",
|
|
348
|
+
message: "No task ID returned from API"
|
|
349
|
+
});
|
|
350
|
+
return {
|
|
351
|
+
operation: { taskId },
|
|
352
|
+
warnings,
|
|
353
|
+
response: {
|
|
354
|
+
timestamp: currentDate,
|
|
355
|
+
modelId: this.modelId,
|
|
356
|
+
headers: responseHeaders
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
async doStatus(options) {
|
|
361
|
+
const currentDate = this.config._internal?.currentDate?.() ?? /* @__PURE__ */ new Date();
|
|
362
|
+
const { taskId } = options.operation;
|
|
363
|
+
const { value: statusResponse, responseHeaders } = await getFromApi({
|
|
364
|
+
url: `${this.config.baseURL}/contents/generations/tasks/${taskId}`,
|
|
365
|
+
validateUrl: true,
|
|
366
|
+
trustedOrigin: this.config.baseURL,
|
|
367
|
+
headers: combineHeaders(await resolve(this.config.headers), options.headers),
|
|
368
|
+
failedResponseHandler: byteDanceFailedResponseHandler,
|
|
369
|
+
successfulResponseHandler: createJsonResponseHandler(byteDanceStatusResponseSchema),
|
|
370
|
+
abortSignal: options.abortSignal,
|
|
371
|
+
fetch: this.config.fetch
|
|
372
|
+
});
|
|
373
|
+
if (statusResponse.status === "succeeded") {
|
|
374
|
+
const videoUrl = statusResponse.content?.video_url;
|
|
375
|
+
if (!videoUrl) throw new AISDKError({
|
|
376
|
+
name: "BYTEDANCE_VIDEO_GENERATION_ERROR",
|
|
377
|
+
message: `No video URL in response. Task ID: ${taskId}`
|
|
378
|
+
});
|
|
379
|
+
return {
|
|
380
|
+
status: "completed",
|
|
381
|
+
videos: [{
|
|
382
|
+
type: "url",
|
|
383
|
+
url: videoUrl,
|
|
384
|
+
mediaType: "video/mp4"
|
|
385
|
+
}],
|
|
386
|
+
warnings: [],
|
|
387
|
+
response: {
|
|
388
|
+
timestamp: currentDate,
|
|
389
|
+
modelId: this.modelId,
|
|
390
|
+
headers: responseHeaders
|
|
391
|
+
},
|
|
392
|
+
providerMetadata: { bytedance: {
|
|
393
|
+
taskId,
|
|
394
|
+
usage: statusResponse.usage,
|
|
395
|
+
...statusResponse.content?.last_frame_url != null ? { lastFrameUrl: statusResponse.content.last_frame_url } : {}
|
|
396
|
+
} }
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
if (statusResponse.status === "failed" || statusResponse.status === "expired" || statusResponse.status === "cancelled" || statusResponse.status === "canceled") {
|
|
400
|
+
const failureDetails = statusResponse.error?.message ?? statusResponse.error?.code ?? JSON.stringify(statusResponse);
|
|
401
|
+
return {
|
|
402
|
+
status: "error",
|
|
403
|
+
error: `Video generation ${statusResponse.status}. Task ID: ${taskId}. ${failureDetails}`,
|
|
404
|
+
response: {
|
|
405
|
+
timestamp: currentDate,
|
|
406
|
+
modelId: this.modelId,
|
|
407
|
+
headers: responseHeaders
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
return {
|
|
412
|
+
status: "pending",
|
|
413
|
+
response: {
|
|
414
|
+
timestamp: currentDate,
|
|
415
|
+
modelId: this.modelId,
|
|
416
|
+
headers: responseHeaders
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
}
|
|
581
420
|
};
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
// Present on failed tasks (the HTTP response itself is still 200).
|
|
597
|
-
error: z4.object({
|
|
598
|
-
code: z4.string().nullish(),
|
|
599
|
-
message: z4.string().nullish()
|
|
600
|
-
}).nullish()
|
|
421
|
+
const byteDanceTaskResponseSchema = z.object({ id: z.string().nullish() });
|
|
422
|
+
const byteDanceStatusResponseSchema = z.object({
|
|
423
|
+
id: z.string().nullish(),
|
|
424
|
+
model: z.string().nullish(),
|
|
425
|
+
status: z.string(),
|
|
426
|
+
content: z.object({
|
|
427
|
+
video_url: z.string().nullish(),
|
|
428
|
+
last_frame_url: z.string().nullish()
|
|
429
|
+
}).nullish(),
|
|
430
|
+
usage: z.object({ completion_tokens: z.number().nullish() }).nullish(),
|
|
431
|
+
error: z.object({
|
|
432
|
+
code: z.string().nullish(),
|
|
433
|
+
message: z.string().nullish()
|
|
434
|
+
}).nullish()
|
|
601
435
|
});
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
436
|
+
const byteDanceErrorSchema = z.object({
|
|
437
|
+
error: z.object({
|
|
438
|
+
message: z.string(),
|
|
439
|
+
code: z.string().nullish()
|
|
440
|
+
}).nullish(),
|
|
441
|
+
message: z.string().nullish()
|
|
608
442
|
});
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
443
|
+
const byteDanceFailedResponseHandler = createJsonErrorResponseHandler({
|
|
444
|
+
errorSchema: byteDanceErrorSchema,
|
|
445
|
+
errorToMessage: (data) => data.error?.message ?? data.message ?? "Unknown error"
|
|
612
446
|
});
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
447
|
+
//#endregion
|
|
448
|
+
//#region src/bytedance-provider.ts
|
|
449
|
+
const defaultBaseURL = "https://ark.ap-southeast.bytepluses.com/api/v3";
|
|
450
|
+
/**
|
|
451
|
+
* Create a ByteDance provider instance.
|
|
452
|
+
*/
|
|
616
453
|
function createByteDance(options = {}) {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
454
|
+
const baseURL = withoutTrailingSlash(options.baseURL ?? defaultBaseURL);
|
|
455
|
+
const getHeaders = () => ({
|
|
456
|
+
Authorization: `Bearer ${loadApiKey({
|
|
457
|
+
apiKey: options.apiKey,
|
|
458
|
+
environmentVariableName: "ARK_API_KEY",
|
|
459
|
+
description: "ByteDance ModelArk"
|
|
460
|
+
})}`,
|
|
461
|
+
"Content-Type": "application/json",
|
|
462
|
+
...options.headers
|
|
463
|
+
});
|
|
464
|
+
const createVideoModel = (modelId) => new ByteDanceVideoModel(modelId, {
|
|
465
|
+
provider: "bytedance.video",
|
|
466
|
+
baseURL: baseURL ?? defaultBaseURL,
|
|
467
|
+
headers: getHeaders,
|
|
468
|
+
fetch: options.fetch
|
|
469
|
+
});
|
|
470
|
+
const createImageModel = (modelId) => new ByteDanceImageModel(modelId, {
|
|
471
|
+
provider: "bytedance.image",
|
|
472
|
+
baseURL: baseURL ?? defaultBaseURL,
|
|
473
|
+
headers: getHeaders,
|
|
474
|
+
fetch: options.fetch
|
|
475
|
+
});
|
|
476
|
+
return {
|
|
477
|
+
specificationVersion: "v4",
|
|
478
|
+
embeddingModel: (modelId) => {
|
|
479
|
+
throw new NoSuchModelError({
|
|
480
|
+
modelId,
|
|
481
|
+
modelType: "embeddingModel"
|
|
482
|
+
});
|
|
483
|
+
},
|
|
484
|
+
languageModel: (modelId) => {
|
|
485
|
+
throw new NoSuchModelError({
|
|
486
|
+
modelId,
|
|
487
|
+
modelType: "languageModel"
|
|
488
|
+
});
|
|
489
|
+
},
|
|
490
|
+
image: createImageModel,
|
|
491
|
+
imageModel: createImageModel,
|
|
492
|
+
video: createVideoModel,
|
|
493
|
+
videoModel: createVideoModel
|
|
494
|
+
};
|
|
652
495
|
}
|
|
653
|
-
|
|
496
|
+
/**
|
|
497
|
+
* Default ByteDance provider instance.
|
|
498
|
+
*/
|
|
499
|
+
const byteDance = createByteDance();
|
|
500
|
+
//#endregion
|
|
501
|
+
//#region src/version.ts
|
|
502
|
+
const VERSION = "2.0.55";
|
|
503
|
+
//#endregion
|
|
504
|
+
export { ByteDanceImageModel, VERSION, byteDance, createByteDance };
|
|
654
505
|
|
|
655
|
-
// src/version.ts
|
|
656
|
-
var VERSION = true ? "2.0.53" : "0.0.0-test";
|
|
657
|
-
export {
|
|
658
|
-
ByteDanceImageModel,
|
|
659
|
-
VERSION,
|
|
660
|
-
byteDance,
|
|
661
|
-
createByteDance
|
|
662
|
-
};
|
|
663
506
|
//# sourceMappingURL=index.js.map
|