@ai-sdk/replicate 3.0.0-beta.5 → 3.0.0-beta.51
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 +392 -8
- package/README.md +2 -0
- package/dist/index.d.ts +29 -19
- package/dist/index.js +168 -143
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
- package/src/index.ts +2 -2
- package/src/replicate-image-model-options.ts +66 -0
- package/src/replicate-image-model.ts +22 -67
- package/src/replicate-provider.ts +9 -6
- package/src/replicate-video-model-options.ts +47 -0
- package/src/replicate-video-model.ts +14 -51
- package/dist/index.d.mts +0 -117
- package/dist/index.mjs +0 -519
- package/dist/index.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,47 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
VERSION: () => VERSION,
|
|
24
|
-
createReplicate: () => createReplicate,
|
|
25
|
-
replicate: () => replicate
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(index_exports);
|
|
28
|
-
|
|
29
1
|
// src/replicate-provider.ts
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
import {
|
|
3
|
+
NoSuchModelError
|
|
4
|
+
} from "@ai-sdk/provider";
|
|
5
|
+
import {
|
|
6
|
+
loadApiKey,
|
|
7
|
+
withUserAgentSuffix
|
|
8
|
+
} from "@ai-sdk/provider-utils";
|
|
32
9
|
|
|
33
10
|
// src/replicate-image-model.ts
|
|
34
|
-
|
|
35
|
-
|
|
11
|
+
import {
|
|
12
|
+
combineHeaders,
|
|
13
|
+
convertImageModelFileToDataUri,
|
|
14
|
+
createBinaryResponseHandler,
|
|
15
|
+
createJsonResponseHandler,
|
|
16
|
+
getFromApi,
|
|
17
|
+
parseProviderOptions,
|
|
18
|
+
postJsonToApi,
|
|
19
|
+
resolve,
|
|
20
|
+
serializeModelOptions,
|
|
21
|
+
WORKFLOW_SERIALIZE,
|
|
22
|
+
WORKFLOW_DESERIALIZE
|
|
23
|
+
} from "@ai-sdk/provider-utils";
|
|
24
|
+
import { z as z3 } from "zod/v4";
|
|
36
25
|
|
|
37
26
|
// src/replicate-error.ts
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var replicateErrorSchema =
|
|
41
|
-
detail:
|
|
42
|
-
error:
|
|
27
|
+
import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
|
|
28
|
+
import { z } from "zod/v4";
|
|
29
|
+
var replicateErrorSchema = z.object({
|
|
30
|
+
detail: z.string().optional(),
|
|
31
|
+
error: z.string().optional()
|
|
43
32
|
});
|
|
44
|
-
var replicateFailedResponseHandler =
|
|
33
|
+
var replicateFailedResponseHandler = createJsonErrorResponseHandler({
|
|
45
34
|
errorSchema: replicateErrorSchema,
|
|
46
35
|
errorToMessage: (error) => {
|
|
47
36
|
var _a, _b;
|
|
@@ -49,10 +38,57 @@ var replicateFailedResponseHandler = (0, import_provider_utils.createJsonErrorRe
|
|
|
49
38
|
}
|
|
50
39
|
});
|
|
51
40
|
|
|
41
|
+
// src/replicate-image-model-options.ts
|
|
42
|
+
import {
|
|
43
|
+
lazySchema,
|
|
44
|
+
zodSchema
|
|
45
|
+
} from "@ai-sdk/provider-utils";
|
|
46
|
+
import { z as z2 } from "zod/v4";
|
|
47
|
+
var replicateImageModelOptionsSchema = lazySchema(
|
|
48
|
+
() => zodSchema(
|
|
49
|
+
z2.object({
|
|
50
|
+
/**
|
|
51
|
+
* Maximum time in seconds to wait for the prediction to complete in sync mode.
|
|
52
|
+
* By default, Replicate uses sync mode with a 60-second timeout.
|
|
53
|
+
*
|
|
54
|
+
* - When not specified: Uses default 60-second sync wait (`prefer: wait`)
|
|
55
|
+
* - When set to a positive number: Uses that duration (`prefer: wait=N`)
|
|
56
|
+
*/
|
|
57
|
+
maxWaitTimeInSeconds: z2.number().positive().nullish(),
|
|
58
|
+
/**
|
|
59
|
+
* Guidance scale for classifier-free guidance.
|
|
60
|
+
* Higher values make the output more closely match the prompt.
|
|
61
|
+
*/
|
|
62
|
+
guidance_scale: z2.number().nullish(),
|
|
63
|
+
/**
|
|
64
|
+
* Number of denoising steps. More steps = higher quality but slower.
|
|
65
|
+
*/
|
|
66
|
+
num_inference_steps: z2.number().nullish(),
|
|
67
|
+
/**
|
|
68
|
+
* Negative prompt to guide what to avoid in the generation.
|
|
69
|
+
*/
|
|
70
|
+
negative_prompt: z2.string().nullish(),
|
|
71
|
+
/**
|
|
72
|
+
* Output image format.
|
|
73
|
+
*/
|
|
74
|
+
output_format: z2.enum(["png", "jpg", "webp"]).nullish(),
|
|
75
|
+
/**
|
|
76
|
+
* Output image quality (1-100). Only applies to jpg and webp.
|
|
77
|
+
*/
|
|
78
|
+
output_quality: z2.number().min(1).max(100).nullish(),
|
|
79
|
+
/**
|
|
80
|
+
* Strength of the transformation for img2img (0-1).
|
|
81
|
+
* Lower values keep more of the original image.
|
|
82
|
+
*/
|
|
83
|
+
strength: z2.number().min(0).max(1).nullish()
|
|
84
|
+
}).passthrough()
|
|
85
|
+
)
|
|
86
|
+
);
|
|
87
|
+
|
|
52
88
|
// src/replicate-image-model.ts
|
|
53
89
|
var FLUX_2_MODEL_PATTERN = /^black-forest-labs\/flux-2-/;
|
|
54
90
|
var MAX_FLUX_2_INPUT_IMAGES = 8;
|
|
55
|
-
var ReplicateImageModel = class {
|
|
91
|
+
var ReplicateImageModel = class _ReplicateImageModel {
|
|
56
92
|
constructor(modelId, config) {
|
|
57
93
|
this.modelId = modelId;
|
|
58
94
|
this.config = config;
|
|
@@ -67,6 +103,15 @@ var ReplicateImageModel = class {
|
|
|
67
103
|
get isFlux2Model() {
|
|
68
104
|
return FLUX_2_MODEL_PATTERN.test(this.modelId);
|
|
69
105
|
}
|
|
106
|
+
static [WORKFLOW_SERIALIZE](model) {
|
|
107
|
+
return serializeModelOptions({
|
|
108
|
+
modelId: model.modelId,
|
|
109
|
+
config: model.config
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
static [WORKFLOW_DESERIALIZE](options) {
|
|
113
|
+
return new _ReplicateImageModel(options.modelId, options.config);
|
|
114
|
+
}
|
|
70
115
|
async doGenerate({
|
|
71
116
|
prompt,
|
|
72
117
|
n,
|
|
@@ -83,7 +128,7 @@ var ReplicateImageModel = class {
|
|
|
83
128
|
const warnings = [];
|
|
84
129
|
const [modelId, version] = this.modelId.split(":");
|
|
85
130
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
86
|
-
const replicateOptions = await
|
|
131
|
+
const replicateOptions = await parseProviderOptions({
|
|
87
132
|
provider: "replicate",
|
|
88
133
|
providerOptions,
|
|
89
134
|
schema: replicateImageModelOptionsSchema
|
|
@@ -93,7 +138,7 @@ var ReplicateImageModel = class {
|
|
|
93
138
|
if (this.isFlux2Model) {
|
|
94
139
|
for (let i = 0; i < Math.min(files.length, MAX_FLUX_2_INPUT_IMAGES); i++) {
|
|
95
140
|
const key = i === 0 ? "input_image" : `input_image_${i + 1}`;
|
|
96
|
-
imageInputs[key] =
|
|
141
|
+
imageInputs[key] = convertImageModelFileToDataUri(files[i]);
|
|
97
142
|
}
|
|
98
143
|
if (files.length > MAX_FLUX_2_INPUT_IMAGES) {
|
|
99
144
|
warnings.push({
|
|
@@ -102,7 +147,7 @@ var ReplicateImageModel = class {
|
|
|
102
147
|
});
|
|
103
148
|
}
|
|
104
149
|
} else {
|
|
105
|
-
imageInputs = { image:
|
|
150
|
+
imageInputs = { image: convertImageModelFileToDataUri(files[0]) };
|
|
106
151
|
if (files.length > 1) {
|
|
107
152
|
warnings.push({
|
|
108
153
|
type: "other",
|
|
@@ -119,7 +164,7 @@ var ReplicateImageModel = class {
|
|
|
119
164
|
message: "Flux-2 models do not support mask input. The mask will be ignored."
|
|
120
165
|
});
|
|
121
166
|
} else {
|
|
122
|
-
maskInput =
|
|
167
|
+
maskInput = convertImageModelFileToDataUri(mask);
|
|
123
168
|
}
|
|
124
169
|
}
|
|
125
170
|
const { maxWaitTimeInSeconds, ...inputOptions } = replicateOptions != null ? replicateOptions : {};
|
|
@@ -127,13 +172,13 @@ var ReplicateImageModel = class {
|
|
|
127
172
|
const {
|
|
128
173
|
value: { output },
|
|
129
174
|
responseHeaders
|
|
130
|
-
} = await
|
|
175
|
+
} = await postJsonToApi({
|
|
131
176
|
url: (
|
|
132
177
|
// different endpoints for versioned vs unversioned models:
|
|
133
178
|
version != null ? `${this.config.baseURL}/predictions` : `${this.config.baseURL}/models/${modelId}/predictions`
|
|
134
179
|
),
|
|
135
|
-
headers:
|
|
136
|
-
await
|
|
180
|
+
headers: combineHeaders(
|
|
181
|
+
this.config.headers ? await resolve(this.config.headers) : void 0,
|
|
137
182
|
headers,
|
|
138
183
|
preferHeader
|
|
139
184
|
),
|
|
@@ -151,7 +196,7 @@ var ReplicateImageModel = class {
|
|
|
151
196
|
// for versioned models, include the version in the body:
|
|
152
197
|
...version != null ? { version } : {}
|
|
153
198
|
},
|
|
154
|
-
successfulResponseHandler:
|
|
199
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
155
200
|
replicateImageResponseSchema
|
|
156
201
|
),
|
|
157
202
|
failedResponseHandler: replicateFailedResponseHandler,
|
|
@@ -161,9 +206,9 @@ var ReplicateImageModel = class {
|
|
|
161
206
|
const outputArray = Array.isArray(output) ? output : [output];
|
|
162
207
|
const images = await Promise.all(
|
|
163
208
|
outputArray.map(async (url) => {
|
|
164
|
-
const { value: image } = await
|
|
209
|
+
const { value: image } = await getFromApi({
|
|
165
210
|
url,
|
|
166
|
-
successfulResponseHandler:
|
|
211
|
+
successfulResponseHandler: createBinaryResponseHandler(),
|
|
167
212
|
failedResponseHandler: replicateFailedResponseHandler,
|
|
168
213
|
abortSignal,
|
|
169
214
|
fetch: this.config.fetch
|
|
@@ -182,54 +227,50 @@ var ReplicateImageModel = class {
|
|
|
182
227
|
};
|
|
183
228
|
}
|
|
184
229
|
};
|
|
185
|
-
var replicateImageResponseSchema =
|
|
186
|
-
output:
|
|
230
|
+
var replicateImageResponseSchema = z3.object({
|
|
231
|
+
output: z3.union([z3.array(z3.string()), z3.string()])
|
|
187
232
|
});
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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
|
-
}).passthrough()
|
|
233
|
+
|
|
234
|
+
// src/replicate-video-model.ts
|
|
235
|
+
import {
|
|
236
|
+
AISDKError
|
|
237
|
+
} from "@ai-sdk/provider";
|
|
238
|
+
import {
|
|
239
|
+
combineHeaders as combineHeaders2,
|
|
240
|
+
convertImageModelFileToDataUri as convertImageModelFileToDataUri2,
|
|
241
|
+
createJsonResponseHandler as createJsonResponseHandler2,
|
|
242
|
+
delay,
|
|
243
|
+
getFromApi as getFromApi2,
|
|
244
|
+
isSameOrigin,
|
|
245
|
+
parseProviderOptions as parseProviderOptions2,
|
|
246
|
+
postJsonToApi as postJsonToApi2,
|
|
247
|
+
resolve as resolve2
|
|
248
|
+
} from "@ai-sdk/provider-utils";
|
|
249
|
+
import { z as z5 } from "zod/v4";
|
|
250
|
+
|
|
251
|
+
// src/replicate-video-model-options.ts
|
|
252
|
+
import { lazySchema as lazySchema2, zodSchema as zodSchema2 } from "@ai-sdk/provider-utils";
|
|
253
|
+
import { z as z4 } from "zod/v4";
|
|
254
|
+
var replicateVideoModelOptionsSchema = lazySchema2(
|
|
255
|
+
() => zodSchema2(
|
|
256
|
+
z4.object({
|
|
257
|
+
pollIntervalMs: z4.number().positive().nullish(),
|
|
258
|
+
pollTimeoutMs: z4.number().positive().nullish(),
|
|
259
|
+
maxWaitTimeInSeconds: z4.number().positive().nullish(),
|
|
260
|
+
guidance_scale: z4.number().nullish(),
|
|
261
|
+
num_inference_steps: z4.number().nullish(),
|
|
262
|
+
motion_bucket_id: z4.number().nullish(),
|
|
263
|
+
cond_aug: z4.number().nullish(),
|
|
264
|
+
decoding_t: z4.number().nullish(),
|
|
265
|
+
video_length: z4.string().nullish(),
|
|
266
|
+
sizing_strategy: z4.string().nullish(),
|
|
267
|
+
frames_per_second: z4.number().nullish(),
|
|
268
|
+
prompt_optimizer: z4.boolean().nullish()
|
|
269
|
+
}).loose()
|
|
226
270
|
)
|
|
227
271
|
);
|
|
228
272
|
|
|
229
273
|
// src/replicate-video-model.ts
|
|
230
|
-
var import_provider = require("@ai-sdk/provider");
|
|
231
|
-
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
232
|
-
var import_v43 = require("zod/v4");
|
|
233
274
|
var ReplicateVideoModel = class {
|
|
234
275
|
constructor(modelId, config) {
|
|
235
276
|
this.modelId = modelId;
|
|
@@ -245,7 +286,7 @@ var ReplicateVideoModel = class {
|
|
|
245
286
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
246
287
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
247
288
|
const warnings = [];
|
|
248
|
-
const replicateOptions = await (
|
|
289
|
+
const replicateOptions = await parseProviderOptions2({
|
|
249
290
|
provider: "replicate",
|
|
250
291
|
providerOptions: options.providerOptions,
|
|
251
292
|
schema: replicateVideoModelOptionsSchema
|
|
@@ -259,7 +300,7 @@ var ReplicateVideoModel = class {
|
|
|
259
300
|
if (options.image.type === "url") {
|
|
260
301
|
input.image = options.image.url;
|
|
261
302
|
} else {
|
|
262
|
-
input.image = (
|
|
303
|
+
input.image = convertImageModelFileToDataUri2(options.image);
|
|
263
304
|
}
|
|
264
305
|
}
|
|
265
306
|
if (options.aspectRatio) {
|
|
@@ -328,10 +369,10 @@ var ReplicateVideoModel = class {
|
|
|
328
369
|
const maxWaitTimeInSeconds = replicateOptions == null ? void 0 : replicateOptions.maxWaitTimeInSeconds;
|
|
329
370
|
const preferHeader = maxWaitTimeInSeconds != null ? { prefer: `wait=${maxWaitTimeInSeconds}` } : { prefer: "wait" };
|
|
330
371
|
const predictionUrl = version != null ? `${this.config.baseURL}/predictions` : `${this.config.baseURL}/models/${modelId}/predictions`;
|
|
331
|
-
const { value: prediction, responseHeaders } = await (
|
|
372
|
+
const { value: prediction, responseHeaders } = await postJsonToApi2({
|
|
332
373
|
url: predictionUrl,
|
|
333
|
-
headers: (
|
|
334
|
-
await (
|
|
374
|
+
headers: combineHeaders2(
|
|
375
|
+
await resolve2(this.config.headers),
|
|
335
376
|
options.headers,
|
|
336
377
|
preferHeader
|
|
337
378
|
),
|
|
@@ -339,7 +380,7 @@ var ReplicateVideoModel = class {
|
|
|
339
380
|
input,
|
|
340
381
|
...version != null ? { version } : {}
|
|
341
382
|
},
|
|
342
|
-
successfulResponseHandler: (
|
|
383
|
+
successfulResponseHandler: createJsonResponseHandler2(
|
|
343
384
|
replicatePredictionSchema
|
|
344
385
|
),
|
|
345
386
|
failedResponseHandler: replicateFailedResponseHandler,
|
|
@@ -353,22 +394,25 @@ var ReplicateVideoModel = class {
|
|
|
353
394
|
const startTime = Date.now();
|
|
354
395
|
while (finalPrediction.status === "starting" || finalPrediction.status === "processing") {
|
|
355
396
|
if (Date.now() - startTime > pollTimeoutMs) {
|
|
356
|
-
throw new
|
|
397
|
+
throw new AISDKError({
|
|
357
398
|
name: "REPLICATE_VIDEO_GENERATION_TIMEOUT",
|
|
358
399
|
message: `Video generation timed out after ${pollTimeoutMs}ms`
|
|
359
400
|
});
|
|
360
401
|
}
|
|
361
|
-
await
|
|
402
|
+
await delay(pollIntervalMs);
|
|
362
403
|
if ((_f = options.abortSignal) == null ? void 0 : _f.aborted) {
|
|
363
|
-
throw new
|
|
404
|
+
throw new AISDKError({
|
|
364
405
|
name: "REPLICATE_VIDEO_GENERATION_ABORTED",
|
|
365
406
|
message: "Video generation request was aborted"
|
|
366
407
|
});
|
|
367
408
|
}
|
|
368
|
-
const
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
409
|
+
const pollUrl = finalPrediction.urls.get;
|
|
410
|
+
const { value: statusPrediction } = await getFromApi2({
|
|
411
|
+
url: pollUrl,
|
|
412
|
+
// The polling URL comes from the provider response; only send
|
|
413
|
+
// credentials when it stays on the provider's own origin.
|
|
414
|
+
headers: isSameOrigin(pollUrl, this.config.baseURL) ? await resolve2(this.config.headers) : void 0,
|
|
415
|
+
successfulResponseHandler: createJsonResponseHandler2(
|
|
372
416
|
replicatePredictionSchema
|
|
373
417
|
),
|
|
374
418
|
failedResponseHandler: replicateFailedResponseHandler,
|
|
@@ -379,20 +423,20 @@ var ReplicateVideoModel = class {
|
|
|
379
423
|
}
|
|
380
424
|
}
|
|
381
425
|
if (finalPrediction.status === "failed") {
|
|
382
|
-
throw new
|
|
426
|
+
throw new AISDKError({
|
|
383
427
|
name: "REPLICATE_VIDEO_GENERATION_FAILED",
|
|
384
428
|
message: `Video generation failed: ${(_g = finalPrediction.error) != null ? _g : "Unknown error"}`
|
|
385
429
|
});
|
|
386
430
|
}
|
|
387
431
|
if (finalPrediction.status === "canceled") {
|
|
388
|
-
throw new
|
|
432
|
+
throw new AISDKError({
|
|
389
433
|
name: "REPLICATE_VIDEO_GENERATION_CANCELED",
|
|
390
434
|
message: "Video generation was canceled"
|
|
391
435
|
});
|
|
392
436
|
}
|
|
393
437
|
const videoUrl = finalPrediction.output;
|
|
394
438
|
if (!videoUrl) {
|
|
395
|
-
throw new
|
|
439
|
+
throw new AISDKError({
|
|
396
440
|
name: "REPLICATE_VIDEO_GENERATION_ERROR",
|
|
397
441
|
message: "No video URL in response"
|
|
398
442
|
});
|
|
@@ -425,45 +469,27 @@ var ReplicateVideoModel = class {
|
|
|
425
469
|
};
|
|
426
470
|
}
|
|
427
471
|
};
|
|
428
|
-
var replicatePredictionSchema =
|
|
429
|
-
id:
|
|
430
|
-
status:
|
|
431
|
-
output:
|
|
432
|
-
error:
|
|
433
|
-
urls:
|
|
434
|
-
get:
|
|
472
|
+
var replicatePredictionSchema = z5.object({
|
|
473
|
+
id: z5.string(),
|
|
474
|
+
status: z5.enum(["starting", "processing", "succeeded", "failed", "canceled"]),
|
|
475
|
+
output: z5.string().nullish(),
|
|
476
|
+
error: z5.string().nullish(),
|
|
477
|
+
urls: z5.object({
|
|
478
|
+
get: z5.string()
|
|
435
479
|
}),
|
|
436
|
-
metrics:
|
|
437
|
-
predict_time:
|
|
480
|
+
metrics: z5.object({
|
|
481
|
+
predict_time: z5.number().nullish()
|
|
438
482
|
}).nullish()
|
|
439
483
|
});
|
|
440
|
-
var replicateVideoModelOptionsSchema = (0, import_provider_utils3.lazySchema)(
|
|
441
|
-
() => (0, import_provider_utils3.zodSchema)(
|
|
442
|
-
import_v43.z.object({
|
|
443
|
-
pollIntervalMs: import_v43.z.number().positive().nullish(),
|
|
444
|
-
pollTimeoutMs: import_v43.z.number().positive().nullish(),
|
|
445
|
-
maxWaitTimeInSeconds: import_v43.z.number().positive().nullish(),
|
|
446
|
-
guidance_scale: import_v43.z.number().nullish(),
|
|
447
|
-
num_inference_steps: import_v43.z.number().nullish(),
|
|
448
|
-
motion_bucket_id: import_v43.z.number().nullish(),
|
|
449
|
-
cond_aug: import_v43.z.number().nullish(),
|
|
450
|
-
decoding_t: import_v43.z.number().nullish(),
|
|
451
|
-
video_length: import_v43.z.string().nullish(),
|
|
452
|
-
sizing_strategy: import_v43.z.string().nullish(),
|
|
453
|
-
frames_per_second: import_v43.z.number().nullish(),
|
|
454
|
-
prompt_optimizer: import_v43.z.boolean().nullish()
|
|
455
|
-
}).loose()
|
|
456
|
-
)
|
|
457
|
-
);
|
|
458
484
|
|
|
459
485
|
// src/version.ts
|
|
460
|
-
var VERSION = true ? "3.0.0-beta.
|
|
486
|
+
var VERSION = true ? "3.0.0-beta.51" : "0.0.0-test";
|
|
461
487
|
|
|
462
488
|
// src/replicate-provider.ts
|
|
463
489
|
function createReplicate(options = {}) {
|
|
464
|
-
const getHeaders = () =>
|
|
490
|
+
const getHeaders = () => withUserAgentSuffix(
|
|
465
491
|
{
|
|
466
|
-
Authorization: `Bearer ${
|
|
492
|
+
Authorization: `Bearer ${loadApiKey({
|
|
467
493
|
apiKey: options.apiToken,
|
|
468
494
|
environmentVariableName: "REPLICATE_API_TOKEN",
|
|
469
495
|
description: "Replicate"
|
|
@@ -491,7 +517,7 @@ function createReplicate(options = {}) {
|
|
|
491
517
|
});
|
|
492
518
|
};
|
|
493
519
|
const embeddingModel = (modelId) => {
|
|
494
|
-
throw new
|
|
520
|
+
throw new NoSuchModelError({
|
|
495
521
|
modelId,
|
|
496
522
|
modelType: "embeddingModel"
|
|
497
523
|
});
|
|
@@ -501,7 +527,7 @@ function createReplicate(options = {}) {
|
|
|
501
527
|
image: createImageModel,
|
|
502
528
|
imageModel: createImageModel,
|
|
503
529
|
languageModel: (modelId) => {
|
|
504
|
-
throw new
|
|
530
|
+
throw new NoSuchModelError({
|
|
505
531
|
modelId,
|
|
506
532
|
modelType: "languageModel"
|
|
507
533
|
});
|
|
@@ -513,10 +539,9 @@ function createReplicate(options = {}) {
|
|
|
513
539
|
};
|
|
514
540
|
}
|
|
515
541
|
var replicate = createReplicate();
|
|
516
|
-
|
|
517
|
-
0 && (module.exports = {
|
|
542
|
+
export {
|
|
518
543
|
VERSION,
|
|
519
544
|
createReplicate,
|
|
520
545
|
replicate
|
|
521
|
-
}
|
|
546
|
+
};
|
|
522
547
|
//# sourceMappingURL=index.js.map
|