@shop-os/modelkit 0.7.4 → 0.7.7
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 +12 -0
- package/README.md +1 -1
- package/dist/catalog.cjs +9 -4
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.js +9 -4
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +22 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6329,14 +6329,14 @@ function xaiReferenceMode(model, req) {
|
|
|
6329
6329
|
const takesLastFrame = (model.constraints.supports ?? []).includes("lastFrame");
|
|
6330
6330
|
return (req.referenceImages ?? []).length > 0 || takesLastFrame && req.lastFrame !== void 0;
|
|
6331
6331
|
}
|
|
6332
|
-
function
|
|
6333
|
-
if (
|
|
6334
|
-
if (!xaiReferenceMode(model, req)) return;
|
|
6332
|
+
function xaiReferenceResolution(model, req, onUnsupported, warnings, provider) {
|
|
6333
|
+
if (req.resolution !== "1080p" || !xaiReferenceMode(model, req)) return void 0;
|
|
6335
6334
|
const message = xaiReferenceResolutionMessage(model.id);
|
|
6336
6335
|
if (onUnsupported === "error") {
|
|
6337
6336
|
throw new ModelKitError({
|
|
6338
6337
|
code: "unsupported_option",
|
|
6339
6338
|
message,
|
|
6339
|
+
...provider === void 0 ? {} : { provider },
|
|
6340
6340
|
model: model.id,
|
|
6341
6341
|
retryable: false
|
|
6342
6342
|
});
|
|
@@ -6348,7 +6348,12 @@ function applyXaiVideoRules(model, req, onUnsupported, warnings) {
|
|
|
6348
6348
|
to: XAI_REFERENCE_MAX_RESOLUTION,
|
|
6349
6349
|
message
|
|
6350
6350
|
});
|
|
6351
|
-
|
|
6351
|
+
return XAI_REFERENCE_MAX_RESOLUTION;
|
|
6352
|
+
}
|
|
6353
|
+
function applyXaiVideoRules(model, req, onUnsupported, warnings) {
|
|
6354
|
+
if (model.adapter !== "xai-video") return;
|
|
6355
|
+
const lowered = xaiReferenceResolution(model, req, onUnsupported, warnings);
|
|
6356
|
+
if (lowered !== void 0) req.resolution = lowered;
|
|
6352
6357
|
}
|
|
6353
6358
|
function takesTargetAspectRatio(model) {
|
|
6354
6359
|
const ratios = model.constraints.aspectRatios ?? [];
|
|
@@ -12354,7 +12359,7 @@ var VEO_POLL_INTERVAL_MS = 5e3;
|
|
|
12354
12359
|
var OMNI_POLL_INTERVAL_MS = 1e4;
|
|
12355
12360
|
var RESULT_TIMEOUT_MS3 = 15 * 60 * 1e3;
|
|
12356
12361
|
var OMNI_INLINE_LIMIT_BYTES = 4 * 1024 * 1024;
|
|
12357
|
-
var MEDIA_PART_INLINE_LIMIT_BYTES =
|
|
12362
|
+
var MEDIA_PART_INLINE_LIMIT_BYTES = 10 * 1024 * 1024;
|
|
12358
12363
|
var errorTextSchema = z22.string();
|
|
12359
12364
|
function isGoogleGenaiVideoKnown(providerModelId) {
|
|
12360
12365
|
return providerModelId.startsWith("veo-") || providerModelId.startsWith("gemini-omni");
|
|
@@ -15582,14 +15587,15 @@ async function generateXaiVideo(req, ctx, deps) {
|
|
|
15582
15587
|
});
|
|
15583
15588
|
}
|
|
15584
15589
|
const refLimit = ctx.model.constraints.references?.images ?? SDK_REFERENCE_CAP;
|
|
15585
|
-
const
|
|
15590
|
+
const refs = (req.referenceImages ?? []).slice(0, refLimit);
|
|
15591
|
+
const refUrls = refs.map(refToUrl);
|
|
15586
15592
|
const takesLastFrame = (ctx.model.constraints.supports ?? []).includes("lastFrame");
|
|
15587
15593
|
const lastFrame = takesLastFrame && req.lastFrame ? refToUrl(req.lastFrame) : void 0;
|
|
15588
15594
|
const xaiOptions = {
|
|
15589
15595
|
pollIntervalMs: POLL_INTERVAL_MS2,
|
|
15590
15596
|
pollTimeoutMs: POLL_TIMEOUT_MS2
|
|
15591
15597
|
};
|
|
15592
|
-
const resolution = xaiResolution(req, ctx,
|
|
15598
|
+
const resolution = xaiResolution(req, ctx, refs);
|
|
15593
15599
|
if (resolution !== void 0) xaiOptions.resolution = resolution;
|
|
15594
15600
|
const sent = resolution === void 0 ? req : { ...req, resolution };
|
|
15595
15601
|
if (refUrls.length > SDK_REFERENCE_CAP) {
|
|
@@ -15716,27 +15722,17 @@ function usage2(ctx, req, meta) {
|
|
|
15716
15722
|
if (req.resolution !== void 0) event.resolution = req.resolution;
|
|
15717
15723
|
return event;
|
|
15718
15724
|
}
|
|
15719
|
-
function xaiResolution(req, ctx,
|
|
15725
|
+
function xaiResolution(req, ctx, sentRefs) {
|
|
15720
15726
|
const requested = req.resolution;
|
|
15721
15727
|
if (requested !== "480p" && requested !== "720p" && requested !== "1080p") return void 0;
|
|
15722
|
-
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
|
|
15726
|
-
|
|
15727
|
-
|
|
15728
|
-
|
|
15729
|
-
|
|
15730
|
-
});
|
|
15731
|
-
}
|
|
15732
|
-
ctx.warnings.push({
|
|
15733
|
-
code: "resolution_coerced",
|
|
15734
|
-
field: "resolution",
|
|
15735
|
-
from: requested,
|
|
15736
|
-
to: XAI_REFERENCE_MAX_RESOLUTION,
|
|
15737
|
-
message: xaiReferenceResolutionMessage(ctx.model.id)
|
|
15738
|
-
});
|
|
15739
|
-
return XAI_REFERENCE_MAX_RESOLUTION;
|
|
15728
|
+
const lowered = xaiReferenceResolution(
|
|
15729
|
+
ctx.model,
|
|
15730
|
+
{ ...req, referenceImages: sentRefs },
|
|
15731
|
+
ctx.call.onUnsupported ?? "error",
|
|
15732
|
+
ctx.warnings,
|
|
15733
|
+
"xai-video"
|
|
15734
|
+
);
|
|
15735
|
+
return lowered ?? requested;
|
|
15740
15736
|
}
|
|
15741
15737
|
|
|
15742
15738
|
// src/adapters/index.ts
|