@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.cjs
CHANGED
|
@@ -6467,14 +6467,14 @@ function xaiReferenceMode(model, req) {
|
|
|
6467
6467
|
const takesLastFrame = (model.constraints.supports ?? []).includes("lastFrame");
|
|
6468
6468
|
return (req.referenceImages ?? []).length > 0 || takesLastFrame && req.lastFrame !== void 0;
|
|
6469
6469
|
}
|
|
6470
|
-
function
|
|
6471
|
-
if (
|
|
6472
|
-
if (!xaiReferenceMode(model, req)) return;
|
|
6470
|
+
function xaiReferenceResolution(model, req, onUnsupported, warnings, provider) {
|
|
6471
|
+
if (req.resolution !== "1080p" || !xaiReferenceMode(model, req)) return void 0;
|
|
6473
6472
|
const message = xaiReferenceResolutionMessage(model.id);
|
|
6474
6473
|
if (onUnsupported === "error") {
|
|
6475
6474
|
throw new ModelKitError({
|
|
6476
6475
|
code: "unsupported_option",
|
|
6477
6476
|
message,
|
|
6477
|
+
...provider === void 0 ? {} : { provider },
|
|
6478
6478
|
model: model.id,
|
|
6479
6479
|
retryable: false
|
|
6480
6480
|
});
|
|
@@ -6486,7 +6486,12 @@ function applyXaiVideoRules(model, req, onUnsupported, warnings) {
|
|
|
6486
6486
|
to: XAI_REFERENCE_MAX_RESOLUTION,
|
|
6487
6487
|
message
|
|
6488
6488
|
});
|
|
6489
|
-
|
|
6489
|
+
return XAI_REFERENCE_MAX_RESOLUTION;
|
|
6490
|
+
}
|
|
6491
|
+
function applyXaiVideoRules(model, req, onUnsupported, warnings) {
|
|
6492
|
+
if (model.adapter !== "xai-video") return;
|
|
6493
|
+
const lowered = xaiReferenceResolution(model, req, onUnsupported, warnings);
|
|
6494
|
+
if (lowered !== void 0) req.resolution = lowered;
|
|
6490
6495
|
}
|
|
6491
6496
|
function takesTargetAspectRatio(model) {
|
|
6492
6497
|
const ratios = model.constraints.aspectRatios ?? [];
|
|
@@ -12490,7 +12495,7 @@ var VEO_POLL_INTERVAL_MS = 5e3;
|
|
|
12490
12495
|
var OMNI_POLL_INTERVAL_MS = 1e4;
|
|
12491
12496
|
var RESULT_TIMEOUT_MS3 = 15 * 60 * 1e3;
|
|
12492
12497
|
var OMNI_INLINE_LIMIT_BYTES = 4 * 1024 * 1024;
|
|
12493
|
-
var MEDIA_PART_INLINE_LIMIT_BYTES =
|
|
12498
|
+
var MEDIA_PART_INLINE_LIMIT_BYTES = 10 * 1024 * 1024;
|
|
12494
12499
|
var errorTextSchema = import_zod22.z.string();
|
|
12495
12500
|
function isGoogleGenaiVideoKnown(providerModelId) {
|
|
12496
12501
|
return providerModelId.startsWith("veo-") || providerModelId.startsWith("gemini-omni");
|
|
@@ -15718,14 +15723,15 @@ async function generateXaiVideo(req, ctx, deps) {
|
|
|
15718
15723
|
});
|
|
15719
15724
|
}
|
|
15720
15725
|
const refLimit = ctx.model.constraints.references?.images ?? SDK_REFERENCE_CAP;
|
|
15721
|
-
const
|
|
15726
|
+
const refs = (req.referenceImages ?? []).slice(0, refLimit);
|
|
15727
|
+
const refUrls = refs.map(refToUrl);
|
|
15722
15728
|
const takesLastFrame = (ctx.model.constraints.supports ?? []).includes("lastFrame");
|
|
15723
15729
|
const lastFrame = takesLastFrame && req.lastFrame ? refToUrl(req.lastFrame) : void 0;
|
|
15724
15730
|
const xaiOptions = {
|
|
15725
15731
|
pollIntervalMs: POLL_INTERVAL_MS2,
|
|
15726
15732
|
pollTimeoutMs: POLL_TIMEOUT_MS2
|
|
15727
15733
|
};
|
|
15728
|
-
const resolution = xaiResolution(req, ctx,
|
|
15734
|
+
const resolution = xaiResolution(req, ctx, refs);
|
|
15729
15735
|
if (resolution !== void 0) xaiOptions.resolution = resolution;
|
|
15730
15736
|
const sent = resolution === void 0 ? req : { ...req, resolution };
|
|
15731
15737
|
if (refUrls.length > SDK_REFERENCE_CAP) {
|
|
@@ -15852,27 +15858,17 @@ function usage2(ctx, req, meta) {
|
|
|
15852
15858
|
if (req.resolution !== void 0) event.resolution = req.resolution;
|
|
15853
15859
|
return event;
|
|
15854
15860
|
}
|
|
15855
|
-
function xaiResolution(req, ctx,
|
|
15861
|
+
function xaiResolution(req, ctx, sentRefs) {
|
|
15856
15862
|
const requested = req.resolution;
|
|
15857
15863
|
if (requested !== "480p" && requested !== "720p" && requested !== "1080p") return void 0;
|
|
15858
|
-
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
-
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
|
|
15866
|
-
});
|
|
15867
|
-
}
|
|
15868
|
-
ctx.warnings.push({
|
|
15869
|
-
code: "resolution_coerced",
|
|
15870
|
-
field: "resolution",
|
|
15871
|
-
from: requested,
|
|
15872
|
-
to: XAI_REFERENCE_MAX_RESOLUTION,
|
|
15873
|
-
message: xaiReferenceResolutionMessage(ctx.model.id)
|
|
15874
|
-
});
|
|
15875
|
-
return XAI_REFERENCE_MAX_RESOLUTION;
|
|
15864
|
+
const lowered = xaiReferenceResolution(
|
|
15865
|
+
ctx.model,
|
|
15866
|
+
{ ...req, referenceImages: sentRefs },
|
|
15867
|
+
ctx.call.onUnsupported ?? "error",
|
|
15868
|
+
ctx.warnings,
|
|
15869
|
+
"xai-video"
|
|
15870
|
+
);
|
|
15871
|
+
return lowered ?? requested;
|
|
15876
15872
|
}
|
|
15877
15873
|
|
|
15878
15874
|
// src/adapters/index.ts
|