@shop-os/modelkit 0.7.7 → 0.7.8
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 +7 -0
- package/dist/catalog.cjs +6 -4
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.js +6 -4
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +24 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5129,8 +5129,10 @@ var RAY_RESOLUTIONS = ["360p", "720p", "1080p"];
|
|
|
5129
5129
|
var RAY_PROMPT = { referenceSyntax: "numbered", maxChars: 6e3 };
|
|
5130
5130
|
var LUMA_VIDEO_MODELS = [
|
|
5131
5131
|
{
|
|
5132
|
-
// https://docs.agents.lumalabs.ai: type "video" with a
|
|
5133
|
-
// firstFrame and lastFrame ride as start_frame and end_frame.
|
|
5132
|
+
// https://docs.agents.lumalabs.ai: type "video" with a 5 s or 10 s duration;
|
|
5133
|
+
// firstFrame and lastFrame ride as start_frame and end_frame. Luma bills a
|
|
5134
|
+
// 10 s clip at 3x the 5 s price; pro-backend prices it that way, so this row
|
|
5135
|
+
// must not offer 10 s before that pricing is deployed (ENG-3324).
|
|
5134
5136
|
id: "ray-3.2",
|
|
5135
5137
|
aliases: [],
|
|
5136
5138
|
label: "Ray 3.2",
|
|
@@ -5142,7 +5144,7 @@ var LUMA_VIDEO_MODELS = [
|
|
|
5142
5144
|
constraints: {
|
|
5143
5145
|
aspectRatios: ["adaptive", ...RAY_RATIOS],
|
|
5144
5146
|
resolutions: [...RAY_RESOLUTIONS],
|
|
5145
|
-
durations: [5],
|
|
5147
|
+
durations: [5, 10],
|
|
5146
5148
|
supports: ["lastFrame"],
|
|
5147
5149
|
prompt: { ...RAY_PROMPT },
|
|
5148
5150
|
audio: "never"
|
|
@@ -5152,7 +5154,7 @@ var LUMA_VIDEO_MODELS = [
|
|
|
5152
5154
|
pricingKind: "video_per_second",
|
|
5153
5155
|
display: {
|
|
5154
5156
|
provider: "luma",
|
|
5155
|
-
description: "Luma Ray 3.2 text- and image-to-video with optional first and last frames, 5-second clips at up to 1080p.",
|
|
5157
|
+
description: "Luma Ray 3.2 text- and image-to-video with optional first and last frames, 5- or 10-second clips at up to 1080p.",
|
|
5156
5158
|
logo: LUMA_LOGO2
|
|
5157
5159
|
},
|
|
5158
5160
|
capabilities: {}
|
|
@@ -14132,6 +14134,21 @@ function imageUsage2(ctx) {
|
|
|
14132
14134
|
};
|
|
14133
14135
|
}
|
|
14134
14136
|
var GENERATE_SECONDS = 5;
|
|
14137
|
+
var GENERATE_LENGTHS = [5, 10];
|
|
14138
|
+
function generateSeconds(req) {
|
|
14139
|
+
return req.durationSeconds ?? GENERATE_SECONDS;
|
|
14140
|
+
}
|
|
14141
|
+
function checkGenerateSeconds(req, ctx) {
|
|
14142
|
+
const seconds3 = generateSeconds(req);
|
|
14143
|
+
if (GENERATE_LENGTHS.includes(seconds3)) return;
|
|
14144
|
+
throw new ModelKitError({
|
|
14145
|
+
code: "unsupported_option",
|
|
14146
|
+
message: `${ctx.model.id} renders ${GENERATE_LENGTHS.join(" or ")} s clips, not ${seconds3} s`,
|
|
14147
|
+
provider: "luma",
|
|
14148
|
+
model: ctx.model.id,
|
|
14149
|
+
retryable: false
|
|
14150
|
+
});
|
|
14151
|
+
}
|
|
14135
14152
|
var MAX_PLAUSIBLE_SECONDS = 60;
|
|
14136
14153
|
function editedSeconds(req, bytes) {
|
|
14137
14154
|
const measured = mp4DurationSeconds(bytes);
|
|
@@ -14197,7 +14214,7 @@ function videoBody(req, ctx, mode) {
|
|
|
14197
14214
|
prompt,
|
|
14198
14215
|
video: {
|
|
14199
14216
|
...req.resolution !== void 0 && { resolution: req.resolution },
|
|
14200
|
-
duration:
|
|
14217
|
+
duration: `${generateSeconds(req)}s`,
|
|
14201
14218
|
...req.firstFrame !== void 0 && { start_frame: imageRef(req.firstFrame) },
|
|
14202
14219
|
...req.lastFrame !== void 0 && { end_frame: imageRef(req.lastFrame) }
|
|
14203
14220
|
}
|
|
@@ -14306,7 +14323,7 @@ function lumaVideoJob(ctx, req, mode, id) {
|
|
|
14306
14323
|
if (mode === "generate") {
|
|
14307
14324
|
const result2 = {
|
|
14308
14325
|
video: { url, expiresAt: new Date(Date.now() + OUTPUT_URL_TTL_MS) },
|
|
14309
|
-
usage: videoUsage4(jobCtx, req, mode,
|
|
14326
|
+
usage: videoUsage4(jobCtx, req, mode, generateSeconds(req)),
|
|
14310
14327
|
raw: { id }
|
|
14311
14328
|
};
|
|
14312
14329
|
return result2;
|
|
@@ -14334,6 +14351,7 @@ async function generateLumaVideo(req, ctx) {
|
|
|
14334
14351
|
});
|
|
14335
14352
|
}
|
|
14336
14353
|
const mode = lumaVideoMode(ctx);
|
|
14354
|
+
if (mode === "generate") checkGenerateSeconds(req, ctx);
|
|
14337
14355
|
const created = await submitGeneration(ctx, videoBody(req, ctx, mode));
|
|
14338
14356
|
return lumaVideoJob(ctx, req, mode, created.id);
|
|
14339
14357
|
}
|