@ai-sdk/gateway 4.0.77 → 4.0.79
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 +23 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/gateway-batch.ts +18 -1
- package/src/gateway-language-model-settings.ts +3 -2
- package/src/gateway-video-model-settings.ts +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/gateway",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.79",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@ai-sdk/provider": "4.0.
|
|
34
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
33
|
+
"@ai-sdk/provider": "4.0.14",
|
|
34
|
+
"@ai-sdk/provider-utils": "5.0.40",
|
|
35
35
|
"@vercel/oidc": "3.2.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
package/src/gateway-batch.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InvalidArgumentError,
|
|
3
|
+
UnsupportedFunctionalityError,
|
|
3
4
|
type Experimental_BatchV4 as BatchV4,
|
|
4
5
|
type Experimental_BatchV4ItemResult as BatchV4ItemResult,
|
|
5
6
|
type Experimental_BatchV4OperationOptions as BatchV4OperationOptions,
|
|
6
7
|
type Experimental_BatchV4StartResult as BatchV4StartResult,
|
|
7
8
|
type Experimental_BatchV4Status as BatchV4Status,
|
|
8
9
|
type Experimental_BatchV4StartOptions as BatchV4StartOptions,
|
|
10
|
+
type Experimental_TextBatchV4Request as TextBatchV4Request,
|
|
9
11
|
type LanguageModelV4CallOptions,
|
|
10
12
|
type SharedV4ProviderMetadata,
|
|
11
13
|
type SharedV4ProviderOptions,
|
|
@@ -52,6 +54,7 @@ export class GatewayBatch implements BatchV4<{ text: GatewayModelId }> {
|
|
|
52
54
|
}: BatchV4StartOptions<{
|
|
53
55
|
text: GatewayModelId;
|
|
54
56
|
}>): Promise<BatchV4StartResult> {
|
|
57
|
+
assertTextBatchRequests(requests);
|
|
55
58
|
const modelId = validateSingleModel(requests);
|
|
56
59
|
|
|
57
60
|
const resolvedHeaders = this.config.headers
|
|
@@ -251,7 +254,7 @@ function maybeBase64EncodeFileData<T extends { type: string }>(data: T): T {
|
|
|
251
254
|
}
|
|
252
255
|
|
|
253
256
|
function validateSingleModel(
|
|
254
|
-
requests:
|
|
257
|
+
requests: ReadonlyArray<TextBatchV4Request<GatewayModelId>>,
|
|
255
258
|
): GatewayModelId {
|
|
256
259
|
const modelId = requests[0]?.modelId;
|
|
257
260
|
|
|
@@ -276,6 +279,20 @@ function validateSingleModel(
|
|
|
276
279
|
return modelId;
|
|
277
280
|
}
|
|
278
281
|
|
|
282
|
+
function assertTextBatchRequests(
|
|
283
|
+
requests: BatchV4StartOptions['requests'],
|
|
284
|
+
): asserts requests is ReadonlyArray<TextBatchV4Request<GatewayModelId>> {
|
|
285
|
+
for (const request of requests) {
|
|
286
|
+
const requestType = request.type;
|
|
287
|
+
if (requestType !== 'text') {
|
|
288
|
+
throw new UnsupportedFunctionalityError({
|
|
289
|
+
functionality: `batch request type: ${requestType}`,
|
|
290
|
+
message: `The AI Gateway Batch API does not support batch requests with type "${requestType}".`,
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
279
296
|
/**
|
|
280
297
|
* Extracts the optional Gateway idempotency key from
|
|
281
298
|
* `providerOptions.gateway.idempotencyKey`. It is sent as the
|
|
@@ -27,7 +27,6 @@ export type GatewayModelId =
|
|
|
27
27
|
| 'alibaba/qwen3.8-2.4t-a95b'
|
|
28
28
|
| 'alibaba/qwen3.8-27b'
|
|
29
29
|
| 'alibaba/qwen3.8-flash'
|
|
30
|
-
| 'alibaba/qwen3.8-flash-next'
|
|
31
30
|
| 'alibaba/qwen3.8-max'
|
|
32
31
|
| 'alibaba/qwen3.8-max-0902'
|
|
33
32
|
| 'amazon/nova-2-lite'
|
|
@@ -64,7 +63,7 @@ export type GatewayModelId =
|
|
|
64
63
|
| 'deepseek/deepseek-v4-flash-vision-exp'
|
|
65
64
|
| 'deepseek/deepseek-v4-pro'
|
|
66
65
|
| 'deepseek/deepseek-v4-pro-0813'
|
|
67
|
-
| 'deepseek/deepseek-v4.1-flash
|
|
66
|
+
| 'deepseek/deepseek-v4.1-flash'
|
|
68
67
|
| 'google/gemini-2.5-flash'
|
|
69
68
|
| 'google/gemini-2.5-flash-image'
|
|
70
69
|
| 'google/gemini-2.5-flash-lite'
|
|
@@ -207,7 +206,9 @@ export type GatewayModelId =
|
|
|
207
206
|
| 'perplexity/sonar-reasoning-pro'
|
|
208
207
|
| 'poolside/laguna-s-2.1'
|
|
209
208
|
| 'poolside/laguna-s-2.1-free'
|
|
209
|
+
| 'sakana/fugu-max'
|
|
210
210
|
| 'sakana/fugu-ultra'
|
|
211
|
+
| 'sakana/fugu-ultra-v2'
|
|
211
212
|
| 'sakana/namazu'
|
|
212
213
|
| 'spacexai/grok-4.1-fast-non-reasoning'
|
|
213
214
|
| 'spacexai/grok-4.1-fast-reasoning'
|