@ai-sdk/replicate 3.0.0-beta.9 → 3.0.0-canary.34
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 +216 -0
- package/README.md +2 -0
- package/dist/index.d.ts +29 -19
- package/dist/index.js +163 -142
- package/dist/index.js.map +1 -1
- package/package.json +11 -9
- 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 +6 -49
- 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,49 @@ 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
|
-
strength: import_v42.z.number().min(0).max(1).nullish()
|
|
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
|
+
parseProviderOptions as parseProviderOptions2,
|
|
245
|
+
postJsonToApi as postJsonToApi2,
|
|
246
|
+
resolve as resolve2
|
|
247
|
+
} from "@ai-sdk/provider-utils";
|
|
248
|
+
import { z as z5 } from "zod/v4";
|
|
249
|
+
|
|
250
|
+
// src/replicate-video-model-options.ts
|
|
251
|
+
import { lazySchema as lazySchema2, zodSchema as zodSchema2 } from "@ai-sdk/provider-utils";
|
|
252
|
+
import { z as z4 } from "zod/v4";
|
|
253
|
+
var replicateVideoModelOptionsSchema = lazySchema2(
|
|
254
|
+
() => zodSchema2(
|
|
255
|
+
z4.object({
|
|
256
|
+
pollIntervalMs: z4.number().positive().nullish(),
|
|
257
|
+
pollTimeoutMs: z4.number().positive().nullish(),
|
|
258
|
+
maxWaitTimeInSeconds: z4.number().positive().nullish(),
|
|
259
|
+
guidance_scale: z4.number().nullish(),
|
|
260
|
+
num_inference_steps: z4.number().nullish(),
|
|
261
|
+
motion_bucket_id: z4.number().nullish(),
|
|
262
|
+
cond_aug: z4.number().nullish(),
|
|
263
|
+
decoding_t: z4.number().nullish(),
|
|
264
|
+
video_length: z4.string().nullish(),
|
|
265
|
+
sizing_strategy: z4.string().nullish(),
|
|
266
|
+
frames_per_second: z4.number().nullish(),
|
|
267
|
+
prompt_optimizer: z4.boolean().nullish()
|
|
268
|
+
}).loose()
|
|
226
269
|
)
|
|
227
270
|
);
|
|
228
271
|
|
|
229
272
|
// 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
273
|
var ReplicateVideoModel = class {
|
|
234
274
|
constructor(modelId, config) {
|
|
235
275
|
this.modelId = modelId;
|
|
@@ -245,7 +285,7 @@ var ReplicateVideoModel = class {
|
|
|
245
285
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
246
286
|
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
287
|
const warnings = [];
|
|
248
|
-
const replicateOptions = await (
|
|
288
|
+
const replicateOptions = await parseProviderOptions2({
|
|
249
289
|
provider: "replicate",
|
|
250
290
|
providerOptions: options.providerOptions,
|
|
251
291
|
schema: replicateVideoModelOptionsSchema
|
|
@@ -259,7 +299,7 @@ var ReplicateVideoModel = class {
|
|
|
259
299
|
if (options.image.type === "url") {
|
|
260
300
|
input.image = options.image.url;
|
|
261
301
|
} else {
|
|
262
|
-
input.image = (
|
|
302
|
+
input.image = convertImageModelFileToDataUri2(options.image);
|
|
263
303
|
}
|
|
264
304
|
}
|
|
265
305
|
if (options.aspectRatio) {
|
|
@@ -328,10 +368,10 @@ var ReplicateVideoModel = class {
|
|
|
328
368
|
const maxWaitTimeInSeconds = replicateOptions == null ? void 0 : replicateOptions.maxWaitTimeInSeconds;
|
|
329
369
|
const preferHeader = maxWaitTimeInSeconds != null ? { prefer: `wait=${maxWaitTimeInSeconds}` } : { prefer: "wait" };
|
|
330
370
|
const predictionUrl = version != null ? `${this.config.baseURL}/predictions` : `${this.config.baseURL}/models/${modelId}/predictions`;
|
|
331
|
-
const { value: prediction, responseHeaders } = await (
|
|
371
|
+
const { value: prediction, responseHeaders } = await postJsonToApi2({
|
|
332
372
|
url: predictionUrl,
|
|
333
|
-
headers: (
|
|
334
|
-
await (
|
|
373
|
+
headers: combineHeaders2(
|
|
374
|
+
await resolve2(this.config.headers),
|
|
335
375
|
options.headers,
|
|
336
376
|
preferHeader
|
|
337
377
|
),
|
|
@@ -339,7 +379,7 @@ var ReplicateVideoModel = class {
|
|
|
339
379
|
input,
|
|
340
380
|
...version != null ? { version } : {}
|
|
341
381
|
},
|
|
342
|
-
successfulResponseHandler: (
|
|
382
|
+
successfulResponseHandler: createJsonResponseHandler2(
|
|
343
383
|
replicatePredictionSchema
|
|
344
384
|
),
|
|
345
385
|
failedResponseHandler: replicateFailedResponseHandler,
|
|
@@ -353,22 +393,22 @@ var ReplicateVideoModel = class {
|
|
|
353
393
|
const startTime = Date.now();
|
|
354
394
|
while (finalPrediction.status === "starting" || finalPrediction.status === "processing") {
|
|
355
395
|
if (Date.now() - startTime > pollTimeoutMs) {
|
|
356
|
-
throw new
|
|
396
|
+
throw new AISDKError({
|
|
357
397
|
name: "REPLICATE_VIDEO_GENERATION_TIMEOUT",
|
|
358
398
|
message: `Video generation timed out after ${pollTimeoutMs}ms`
|
|
359
399
|
});
|
|
360
400
|
}
|
|
361
|
-
await
|
|
401
|
+
await delay(pollIntervalMs);
|
|
362
402
|
if ((_f = options.abortSignal) == null ? void 0 : _f.aborted) {
|
|
363
|
-
throw new
|
|
403
|
+
throw new AISDKError({
|
|
364
404
|
name: "REPLICATE_VIDEO_GENERATION_ABORTED",
|
|
365
405
|
message: "Video generation request was aborted"
|
|
366
406
|
});
|
|
367
407
|
}
|
|
368
|
-
const { value: statusPrediction } = await (
|
|
408
|
+
const { value: statusPrediction } = await getFromApi2({
|
|
369
409
|
url: finalPrediction.urls.get,
|
|
370
|
-
headers: await (
|
|
371
|
-
successfulResponseHandler: (
|
|
410
|
+
headers: await resolve2(this.config.headers),
|
|
411
|
+
successfulResponseHandler: createJsonResponseHandler2(
|
|
372
412
|
replicatePredictionSchema
|
|
373
413
|
),
|
|
374
414
|
failedResponseHandler: replicateFailedResponseHandler,
|
|
@@ -379,20 +419,20 @@ var ReplicateVideoModel = class {
|
|
|
379
419
|
}
|
|
380
420
|
}
|
|
381
421
|
if (finalPrediction.status === "failed") {
|
|
382
|
-
throw new
|
|
422
|
+
throw new AISDKError({
|
|
383
423
|
name: "REPLICATE_VIDEO_GENERATION_FAILED",
|
|
384
424
|
message: `Video generation failed: ${(_g = finalPrediction.error) != null ? _g : "Unknown error"}`
|
|
385
425
|
});
|
|
386
426
|
}
|
|
387
427
|
if (finalPrediction.status === "canceled") {
|
|
388
|
-
throw new
|
|
428
|
+
throw new AISDKError({
|
|
389
429
|
name: "REPLICATE_VIDEO_GENERATION_CANCELED",
|
|
390
430
|
message: "Video generation was canceled"
|
|
391
431
|
});
|
|
392
432
|
}
|
|
393
433
|
const videoUrl = finalPrediction.output;
|
|
394
434
|
if (!videoUrl) {
|
|
395
|
-
throw new
|
|
435
|
+
throw new AISDKError({
|
|
396
436
|
name: "REPLICATE_VIDEO_GENERATION_ERROR",
|
|
397
437
|
message: "No video URL in response"
|
|
398
438
|
});
|
|
@@ -425,45 +465,27 @@ var ReplicateVideoModel = class {
|
|
|
425
465
|
};
|
|
426
466
|
}
|
|
427
467
|
};
|
|
428
|
-
var replicatePredictionSchema =
|
|
429
|
-
id:
|
|
430
|
-
status:
|
|
431
|
-
output:
|
|
432
|
-
error:
|
|
433
|
-
urls:
|
|
434
|
-
get:
|
|
468
|
+
var replicatePredictionSchema = z5.object({
|
|
469
|
+
id: z5.string(),
|
|
470
|
+
status: z5.enum(["starting", "processing", "succeeded", "failed", "canceled"]),
|
|
471
|
+
output: z5.string().nullish(),
|
|
472
|
+
error: z5.string().nullish(),
|
|
473
|
+
urls: z5.object({
|
|
474
|
+
get: z5.string()
|
|
435
475
|
}),
|
|
436
|
-
metrics:
|
|
437
|
-
predict_time:
|
|
476
|
+
metrics: z5.object({
|
|
477
|
+
predict_time: z5.number().nullish()
|
|
438
478
|
}).nullish()
|
|
439
479
|
});
|
|
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
480
|
|
|
459
481
|
// src/version.ts
|
|
460
|
-
var VERSION = true ? "3.0.0-
|
|
482
|
+
var VERSION = true ? "3.0.0-canary.34" : "0.0.0-test";
|
|
461
483
|
|
|
462
484
|
// src/replicate-provider.ts
|
|
463
485
|
function createReplicate(options = {}) {
|
|
464
|
-
const getHeaders = () =>
|
|
486
|
+
const getHeaders = () => withUserAgentSuffix(
|
|
465
487
|
{
|
|
466
|
-
Authorization: `Bearer ${
|
|
488
|
+
Authorization: `Bearer ${loadApiKey({
|
|
467
489
|
apiKey: options.apiToken,
|
|
468
490
|
environmentVariableName: "REPLICATE_API_TOKEN",
|
|
469
491
|
description: "Replicate"
|
|
@@ -491,7 +513,7 @@ function createReplicate(options = {}) {
|
|
|
491
513
|
});
|
|
492
514
|
};
|
|
493
515
|
const embeddingModel = (modelId) => {
|
|
494
|
-
throw new
|
|
516
|
+
throw new NoSuchModelError({
|
|
495
517
|
modelId,
|
|
496
518
|
modelType: "embeddingModel"
|
|
497
519
|
});
|
|
@@ -501,7 +523,7 @@ function createReplicate(options = {}) {
|
|
|
501
523
|
image: createImageModel,
|
|
502
524
|
imageModel: createImageModel,
|
|
503
525
|
languageModel: (modelId) => {
|
|
504
|
-
throw new
|
|
526
|
+
throw new NoSuchModelError({
|
|
505
527
|
modelId,
|
|
506
528
|
modelType: "languageModel"
|
|
507
529
|
});
|
|
@@ -513,10 +535,9 @@ function createReplicate(options = {}) {
|
|
|
513
535
|
};
|
|
514
536
|
}
|
|
515
537
|
var replicate = createReplicate();
|
|
516
|
-
|
|
517
|
-
0 && (module.exports = {
|
|
538
|
+
export {
|
|
518
539
|
VERSION,
|
|
519
540
|
createReplicate,
|
|
520
541
|
replicate
|
|
521
|
-
}
|
|
542
|
+
};
|
|
522
543
|
//# sourceMappingURL=index.js.map
|