@ai-sdk/gateway 4.0.106 → 4.0.108
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 +31 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/docs/00-ai-gateway.mdx +2 -2
- package/package.json +3 -3
- package/src/gateway-decision-model-settings.ts +1 -0
- package/src/gateway-decision-model.ts +20 -4
- package/src/gateway-image-model-settings.ts +1 -0
- package/src/gateway-language-model-settings.ts +1 -0
- package/src/gateway-transcription-model-settings.ts +0 -1
- package/src/gateway-video-model-settings.ts +2 -0
package/docs/00-ai-gateway.mdx
CHANGED
|
@@ -247,7 +247,7 @@ import {
|
|
|
247
247
|
// The receiver uses this token to look up the expected batch and signing
|
|
248
248
|
// secret before trusting anything in the webhook body.
|
|
249
249
|
const token = randomUUID();
|
|
250
|
-
const model = 'anthropic/claude-haiku-
|
|
250
|
+
const model = 'anthropic/claude-haiku-5.5' as const;
|
|
251
251
|
|
|
252
252
|
// Reserve the token before starting so an early delivery finds a retryable
|
|
253
253
|
// pending record rather than an unknown callback.
|
|
@@ -1412,7 +1412,7 @@ import { gateway, streamText } from 'ai';
|
|
|
1412
1412
|
|
|
1413
1413
|
// 1. Make requests with tags
|
|
1414
1414
|
const result = streamText({
|
|
1415
|
-
model: gateway('anthropic/claude-haiku-
|
|
1415
|
+
model: gateway('anthropic/claude-haiku-5.5'),
|
|
1416
1416
|
prompt: 'Summarize this quarter's results',
|
|
1417
1417
|
providerOptions: {
|
|
1418
1418
|
gateway: {
|
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.108",
|
|
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.25",
|
|
34
|
+
"@ai-sdk/provider-utils": "5.0.57",
|
|
35
35
|
"@vercel/oidc": "3.2.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
UnsupportedFunctionalityError,
|
|
3
|
+
type Experimental_DecisionModelV4 as DecisionModelV4,
|
|
4
|
+
type SharedV4ProviderMetadata,
|
|
4
5
|
} from '@ai-sdk/provider';
|
|
5
6
|
import {
|
|
6
7
|
combineHeaders,
|
|
@@ -51,6 +52,21 @@ export class GatewayDecisionModel implements DecisionModelV4 {
|
|
|
51
52
|
}: Parameters<DecisionModelV4['doDecide']>[0]): Promise<
|
|
52
53
|
Awaited<ReturnType<DecisionModelV4['doDecide']>>
|
|
53
54
|
> {
|
|
55
|
+
const values = state.map(part => {
|
|
56
|
+
if (part.type === 'file') {
|
|
57
|
+
throw new UnsupportedFunctionalityError({
|
|
58
|
+
functionality: 'Gateway decision file input',
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return part.type === 'text' ? part.text : part.value;
|
|
62
|
+
});
|
|
63
|
+
// Keep the legacy Gateway state format: string, JSON object, or JSON array.
|
|
64
|
+
const requestState =
|
|
65
|
+
values.length === 1 &&
|
|
66
|
+
(typeof values[0] === 'string' ||
|
|
67
|
+
(typeof values[0] === 'object' && values[0] !== null))
|
|
68
|
+
? values[0]
|
|
69
|
+
: values;
|
|
54
70
|
const gatewayOptions = await parseProviderOptions({
|
|
55
71
|
provider: 'gateway',
|
|
56
72
|
providerOptions,
|
|
@@ -77,7 +93,7 @@ export class GatewayDecisionModel implements DecisionModelV4 {
|
|
|
77
93
|
await resolve(this.config.o11yHeaders),
|
|
78
94
|
),
|
|
79
95
|
body: {
|
|
80
|
-
state,
|
|
96
|
+
state: requestState,
|
|
81
97
|
questions,
|
|
82
98
|
...(validatedProviderOptions
|
|
83
99
|
? { providerOptions: validatedProviderOptions }
|
|
@@ -2,7 +2,6 @@ export type GatewayTranscriptionModelId =
|
|
|
2
2
|
| 'fish-audio/transcribe-1'
|
|
3
3
|
| 'google/gemini-3.5-transcribe'
|
|
4
4
|
| 'google/gemini-3.5-transcribe-live'
|
|
5
|
-
| 'microsoft/mai-transcribe-1.5'
|
|
6
5
|
| 'microsoft/mai-transcribe-2'
|
|
7
6
|
| 'microsoft/mai-transcribe-2-streaming'
|
|
8
7
|
| 'openai/gpt-4o-mini-transcribe'
|