@shop-os/modelkit 0.1.1 → 0.1.3
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/README.md +10 -4
- package/dist/index.cjs +335 -166
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +335 -166
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -81,8 +81,13 @@ await generateText({ model: openai("gpt-4o"), prompt }); // pass-through: the SD
|
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
A pass-through model has no catalog row, so it gets no defaults and no key resolution,
|
|
84
|
-
and usage is attributed to its own `provider` and `modelId`.
|
|
85
|
-
|
|
84
|
+
and usage is attributed to its own `provider` and `modelId`. The kit still translates
|
|
85
|
+
the shared request into what `ai` accepts — image references ride inside the prompt and
|
|
86
|
+
`exactSize` becomes the SDK's `size`; video frames become `frameImages`, references
|
|
87
|
+
become `inputReferences`, and `generateAudio` passes through. Anything the SDK call
|
|
88
|
+
cannot express (image `quality`/`outputFormat`, video `sourceVideo`, tiered
|
|
89
|
+
`resolution`, ...) is dropped with an `option_ignored` warning, never silently. Use it
|
|
90
|
+
for a model the catalog does not carry yet; the next step is a catalog row.
|
|
86
91
|
|
|
87
92
|
| `ai` function | Here |
|
|
88
93
|
| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
@@ -95,7 +100,8 @@ catalog does not carry yet; the next step is a catalog row.
|
|
|
95
100
|
An optional second `CallContext` argument selects enterprise keys, adds cancellation
|
|
96
101
|
(combined with `abortSignal`), and sets `onUnsupported`. Package-level functions read
|
|
97
102
|
keys from the environment; a configured kit adds routing, catalog overrides, custom
|
|
98
|
-
fetch,
|
|
103
|
+
fetch, provider endpoint overrides (`endpoints.ark` for the Ark base url), logging, and
|
|
104
|
+
the `onUsage` sink.
|
|
99
105
|
|
|
100
106
|
`providerOptions` on `generateImage`/`generateVideo` reach the provider only for
|
|
101
107
|
pass-through instances; catalog rows carry their own and the caller's are dropped
|
|
@@ -115,7 +121,7 @@ The kit keeps its `Warning` type for coercions; the SDK's warning type is `AiWar
|
|
|
115
121
|
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
116
122
|
| Ids | `id` is the pro-backend pricing key. Every historical id (`nb-pro`, `veo-3.1-generate-001`, `kling-v2.5-turbo-pro`) is an alias. |
|
|
117
123
|
| Options | `resolveOptions` fills catalog defaults, coerces aspect ratio to the nearest supported one, errors on unsupported size or resolution (`onUnsupported: "coerce"` snaps down instead), clamps duration, trims references (audio first, then video), and drops options the model ignores with a warning. |
|
|
118
|
-
| Keys | Enterprise keys win only when every key the adapter needs is set on the enterprise tier.
|
|
124
|
+
| Keys | Enterprise keys win only when every key the adapter (and its route, e.g. the cloudflare token for gateway-routed text) needs is set on the enterprise tier. |
|
|
119
125
|
| Routing | Cloudflare AI Gateway for text only. Never for Gemini images or Omni. fal passthrough for geo-blocked regions. OpenRouter optional for text. |
|
|
120
126
|
| Retry | One classifier. Never on content blocks or 4xx except 429. |
|
|
121
127
|
| Errors | `ModelKitError` with `code`, `provider`, `status`, `body`. Gemini `blockReason` and fal `body.detail` are lifted into `body`. |
|