@shop-os/modelkit 0.7.6 → 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 CHANGED
@@ -9,6 +9,11 @@ header in the release PR.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.7.7] - Unreleased
13
+
14
+ ### Fixed
15
+ - Google `prepareMediaPart` inlines bytes only up to 10 MiB (was 20 MB) and uploads larger media through the Files API. Inline bytes are base64-encoded, so a 15 MB video made a ~20 MB request and Gemini refused it or timed out; on dev no inline video between 10.9 MB and 20 MB succeeded. Media of 10-20 MB now uploads (a few seconds slower, same tokens) and the returned `cleanup` deletes the file as before.
16
+
12
17
  ## [0.7.6] - Unreleased
13
18
 
14
19
  ENG-3323: one xAI reference-mode rule.
package/README.md CHANGED
@@ -309,7 +309,7 @@ const defaultKit = createDefaultModelKit({ keys: { pro: keysFromEnv(process.env)
309
309
  | Retry | One classifier, one policy. Never on content blocks, aborts, or 4xx except 429; SDKs with their own retry (Replicate) run under a single kit attempt; a 429 on a status poll keeps polling unless `CallContext.maxRetries` is `0`. See durable media execution above. |
310
310
  | Errors | `ModelKitError` with `code`, `provider`, `status`, `body`. Gemini `blockReason` and fal `body.detail` are lifted into `body`. A throw with no HTTP status (fetch failed, reset, DNS) is a retryable `network` error on every adapter. An out-of-credit provider account is `provider_billing` and is never retried: HTTP 402, a 4xx whose structured error code is a billing code (`insufficient_quota`, ...), or a 403/429 whose text names the exhausted account ("Exhausted balance", "Insufficient credit"). Text calls go through `ai` and surface the SDK's own error instead. |
311
311
  | Usage | One event per call with the canonical model id and the row's `usage.unit` (adapters supply the quantity in that unit). Gemini image events carry the token counts too (`inputTokens`/`outputTokens`); Google's raw `usageMetadata` rides on `raw.providerMetadata.google`. Video usage is emitted on completion and carries the resolution the provider renders (the default it falls back to when the request has none), because pricing is keyed by it; Seedance keeps `usage`, `duration`, `framespersecond` and `resolution` from the poll on `raw`. Audio: Lyria 3 returns no duration, so it emits `unit: "images", quantity: 1` (token counts ride along as `inputTokens`/`outputTokens`); Replicate audio (Lyria 2, MMAudio) emits `unit: "compute_seconds"` with the prediction time. |
312
- | Media parts | `prepareMediaPart` turns a `MediaRef` into an AI SDK file part. Google inlines bytes up to 20 MB and uploads larger payloads through the Files API; call the returned `cleanup` after the request. Other providers get the reference inline. |
312
+ | Media parts | `prepareMediaPart` turns a `MediaRef` into an AI SDK file part. Google inlines bytes up to 10 MiB (base64 makes them ~4/3 larger inside Gemini's 20 MB request cap) and uploads larger payloads through the Files API; call the returned `cleanup` after the request. Other providers get the reference inline. |
313
313
 
314
314
  ## Add a model
315
315
 
package/dist/index.cjs CHANGED
@@ -12495,7 +12495,7 @@ var VEO_POLL_INTERVAL_MS = 5e3;
12495
12495
  var OMNI_POLL_INTERVAL_MS = 1e4;
12496
12496
  var RESULT_TIMEOUT_MS3 = 15 * 60 * 1e3;
12497
12497
  var OMNI_INLINE_LIMIT_BYTES = 4 * 1024 * 1024;
12498
- var MEDIA_PART_INLINE_LIMIT_BYTES = 20 * 1024 * 1024;
12498
+ var MEDIA_PART_INLINE_LIMIT_BYTES = 10 * 1024 * 1024;
12499
12499
  var errorTextSchema = import_zod22.z.string();
12500
12500
  function isGoogleGenaiVideoKnown(providerModelId) {
12501
12501
  return providerModelId.startsWith("veo-") || providerModelId.startsWith("gemini-omni");