@shop-os/modelkit 0.2.5 → 0.2.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/dist/index.js CHANGED
@@ -1342,7 +1342,7 @@ var VIDEO_MODELS = [
1342
1342
  // reference clip keeps its own framing.
1343
1343
  aspectRatios: [...OMNI_RATIOS],
1344
1344
  durations: [3, 4, 5, 6, 7, 8, 9, 10],
1345
- references: { images: 6, videos: 3 },
1345
+ references: { images: 6, videos: 1 },
1346
1346
  supports: []
1347
1347
  },
1348
1348
  defaults: {},
@@ -1368,7 +1368,7 @@ var VIDEO_MODELS = [
1368
1368
  aspectRatios: [...OMNI_RATIOS],
1369
1369
  resolutions: ["360p", "720p", "1080p", "4k"],
1370
1370
  durations: [3, 4, 5, 6, 7, 8, 9, 10],
1371
- references: { images: 6, videos: 3 },
1371
+ references: { images: 6, videos: 1 },
1372
1372
  supports: []
1373
1373
  },
1374
1374
  defaults: {},
@@ -1495,7 +1495,7 @@ var VIDEO_MODELS = [
1495
1495
  resolutions: ["480p", "720p"],
1496
1496
  durations: { min: 1, max: 15 },
1497
1497
  durationPresets: [4, 6, 8, 10],
1498
- references: { images: 7 },
1498
+ references: { images: 5 },
1499
1499
  supports: []
1500
1500
  },
1501
1501
  // No resolution default: xAI picks its own unless the caller asks.
@@ -1504,7 +1504,7 @@ var VIDEO_MODELS = [
1504
1504
  pricingKind: "video_per_second",
1505
1505
  display: {
1506
1506
  provider: "xai",
1507
- description: "xAI's reference-to-video model. Generates short clips conditioned on up to 7 reference images with flexible aspect ratios.",
1507
+ description: "xAI's reference-to-video model. Generates short clips conditioned on up to 5 reference images with flexible aspect ratios.",
1508
1508
  logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png"
1509
1509
  },
1510
1510
  capabilities: { ...FRAMES_EXCLUDE_REFERENCES }
@@ -2981,10 +2981,12 @@ function toGeneratedImage(image) {
2981
2981
  import { createAnthropic } from "@ai-sdk/anthropic";
2982
2982
  import { createGoogleGenerativeAI } from "@ai-sdk/google";
2983
2983
  import { createOpenAI } from "@ai-sdk/openai";
2984
+ import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
2984
2985
  import { createPerplexity } from "@ai-sdk/perplexity";
2985
2986
  import { createXai } from "@ai-sdk/xai";
2986
2987
  import { createDeepSeek } from "@ai-sdk/deepseek";
2987
2988
  import { createMoonshotAI } from "@ai-sdk/moonshotai";
2989
+ import { extractReasoningMiddleware, wrapLanguageModel } from "ai";
2988
2990
  import { z as z5 } from "zod";
2989
2991
  var TEXT_PROVIDERS = [
2990
2992
  "openai",
@@ -3112,6 +3114,22 @@ function missingKey(ctx, name) {
3112
3114
  retryable: false
3113
3115
  });
3114
3116
  }
3117
+ function reasoningSplitMiddleware(providerName) {
3118
+ return {
3119
+ specificationVersion: "v3",
3120
+ transformParams: async ({ params }) => {
3121
+ if (providerName !== "minimax") return params;
3122
+ const existing = params.providerOptions?.[providerName] ?? {};
3123
+ return {
3124
+ ...params,
3125
+ providerOptions: {
3126
+ ...params.providerOptions,
3127
+ [providerName]: { reasoning_split: true, ...existing }
3128
+ }
3129
+ };
3130
+ }
3131
+ };
3132
+ }
3115
3133
  var aiSdkTextAdapter = {
3116
3134
  id: "ai-sdk-text",
3117
3135
  languageModel(ctx) {
@@ -3134,11 +3152,22 @@ var aiSdkTextAdapter = {
3134
3152
  return createDeepSeek(settings)(route2.modelId);
3135
3153
  case "moonshot":
3136
3154
  return createMoonshotAI(settings)(route2.modelId);
3137
- case "openai-compatible":
3138
- return createOpenAI({
3139
- ...settings,
3140
- name: route2.provider
3141
- }).chat(route2.modelId);
3155
+ case "openai-compatible": {
3156
+ const model = createOpenAICompatible({
3157
+ name: route2.provider,
3158
+ apiKey,
3159
+ baseURL: route2.baseURL,
3160
+ fetch: ctx.fetch,
3161
+ ...route2.headers ? { headers: route2.headers } : {}
3162
+ })(route2.modelId);
3163
+ return wrapLanguageModel({
3164
+ model,
3165
+ middleware: [
3166
+ reasoningSplitMiddleware(route2.provider),
3167
+ extractReasoningMiddleware({ tagName: "think" })
3168
+ ]
3169
+ });
3170
+ }
3142
3171
  case "openai":
3143
3172
  return createOpenAI(settings)(route2.modelId);
3144
3173
  }
@@ -7180,7 +7209,7 @@ async function generateXaiVideo(req, ctx, deps) {
7180
7209
  retryable: false
7181
7210
  });
7182
7211
  }
7183
- const refUrls = (req.referenceImages ?? []).map(refToUrl).slice(0, 7);
7212
+ const refUrls = (req.referenceImages ?? []).map(refToUrl).slice(0, 5);
7184
7213
  const xaiOptions = {
7185
7214
  pollIntervalMs: POLL_INTERVAL_MS2,
7186
7215
  pollTimeoutMs: POLL_TIMEOUT_MS2