@ai-sdk/gateway 4.0.98 → 4.0.100
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 +16 -0
- package/dist/index.d.ts +7 -5
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/docs/00-ai-gateway.mdx +1 -1
- package/package.json +2 -2
- package/src/gateway-language-model-settings.ts +2 -3
- package/src/gateway-provider-options.ts +8 -6
- package/src/gateway-provider.ts +1 -1
package/docs/00-ai-gateway.mdx
CHANGED
|
@@ -1478,7 +1478,7 @@ The following gateway provider options are available:
|
|
|
1478
1478
|
|
|
1479
1479
|
Example: `models: ['openai/gpt-5.4-nano', 'google/gemini-3.8-flash']` will try the fallback models in order if the primary model fails.
|
|
1480
1480
|
|
|
1481
|
-
A direct condition uses `{ question, confidenceBelow }` for Choice and Score questions, or `{ question, probabilityBetween: [minimum, maximum] }` for Boolean questions. Boolean probability is P(true), not confidence in the selected Boolean outcome. Bounds are inclusive, finite, ordered, and within `[0, 1]`.
|
|
1481
|
+
A direct condition uses `{ question, confidenceBelow }` for Choice and Score questions, or `{ question, probabilityBetween: [minimum, maximum] }` for Boolean questions. Leave out `question` to check every question of that type: `{ confidenceBelow: 0.6 }` matches when any Choice or Score answer is below 0.6, and a request with no Choice or Score questions never matches it. Boolean probability is P(true), not confidence in the selected Boolean outcome. Bounds are inclusive, finite, ordered, and within `[0, 1]`.
|
|
1482
1482
|
|
|
1483
1483
|
Combine conditions with `{ any: [...] }`, `{ all: [...] }`, or `{ atLeast: { count, conditions: [...] } }`. Each condition list holds 1 to 20 conditions. `atLeast.count` must be an integer from `1` through the number of conditions. Conditions nest at most 5 levels deep. Question IDs are 1 to 256 characters, and the conditional `model` must not be empty. The SDK checks these bounds before sending the request, and the gateway also checks that each question exists and has a kind that matches its condition. String error fallbacks may follow the conditional entry.
|
|
1484
1484
|
|
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.100",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@ai-sdk/provider": "4.0.19",
|
|
34
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
34
|
+
"@ai-sdk/provider-utils": "5.0.51",
|
|
35
35
|
"@vercel/oidc": "3.2.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
@@ -95,13 +95,13 @@ export type GatewayModelId =
|
|
|
95
95
|
| 'inception/mercury-coder-small'
|
|
96
96
|
| 'inclusionai/ling-3.0-flash'
|
|
97
97
|
| 'inclusionai/ling-3.0-flash-fin'
|
|
98
|
-
| 'inclusionai/ling-3.0-flash-fin-free'
|
|
99
98
|
| 'inclusionai/ling-3.0-flash-sante'
|
|
100
99
|
| 'inclusionai/ling-3.0-flash-sante-free'
|
|
101
100
|
| 'inclusionai/ling-3.0-flash-vl'
|
|
102
101
|
| 'inference-net/schematron-v2-small'
|
|
103
102
|
| 'inference-net/schematron-v2-turbo'
|
|
104
103
|
| 'interfaze/interfaze-beta'
|
|
104
|
+
| 'meituan/longcat-2.5-preview'
|
|
105
105
|
| 'meta/llama-3.1-70b'
|
|
106
106
|
| 'meta/llama-3.1-8b'
|
|
107
107
|
| 'meta/llama-3.3-70b'
|
|
@@ -209,8 +209,6 @@ export type GatewayModelId =
|
|
|
209
209
|
| 'openai/o4-mini'
|
|
210
210
|
| 'openai/o4-mini-fast'
|
|
211
211
|
| 'perplexity/sonar'
|
|
212
|
-
| 'perplexity/sonar-pro'
|
|
213
|
-
| 'perplexity/sonar-reasoning-pro'
|
|
214
212
|
| 'poolside/laguna-s-2.1'
|
|
215
213
|
| 'poolside/laguna-s-2.1-free'
|
|
216
214
|
| 'quiverai/arrow-2'
|
|
@@ -232,6 +230,7 @@ export type GatewayModelId =
|
|
|
232
230
|
| 'spacexai/grok-4.6'
|
|
233
231
|
| 'spacexai/grok-4.7'
|
|
234
232
|
| 'spacexai/grok-build-0.1'
|
|
233
|
+
| 'stealth/pixel-canary'
|
|
235
234
|
| 'stepfun/step-3.5-flash'
|
|
236
235
|
| 'stepfun/step-3.7-flash'
|
|
237
236
|
| 'stepfun/step-5-preview'
|
|
@@ -19,13 +19,15 @@ export const gatewayEvaluationProviderOptionsSchema = lazySchema(() =>
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* A condition on the primary model's answers. `QUESTION_ID` narrows
|
|
22
|
-
* `question` to your question IDs.
|
|
23
|
-
*
|
|
22
|
+
* `question` to your question IDs. Without `question`, `confidenceBelow`
|
|
23
|
+
* checks every Choice and Score question and `probabilityBetween` every
|
|
24
|
+
* Boolean question. Groups nest at most five levels deep, which the SDK
|
|
25
|
+
* checks at runtime.
|
|
24
26
|
*/
|
|
25
27
|
export type EvaluationFallbackCondition<QUESTION_ID extends string = string> =
|
|
26
|
-
| ExclusiveCondition<{ question
|
|
28
|
+
| ExclusiveCondition<{ question?: QUESTION_ID; confidenceBelow: number }>
|
|
27
29
|
| ExclusiveCondition<{
|
|
28
|
-
question
|
|
30
|
+
question?: QUESTION_ID;
|
|
29
31
|
probabilityBetween: [number, number];
|
|
30
32
|
}>
|
|
31
33
|
| ExclusiveCondition<{ any: EvaluationFallbackConditionList<QUESTION_ID> }>
|
|
@@ -162,13 +164,13 @@ const questionSchema = z
|
|
|
162
164
|
const directConditionSchema = z.union([
|
|
163
165
|
z
|
|
164
166
|
.object({
|
|
165
|
-
question: questionSchema,
|
|
167
|
+
question: questionSchema.optional(),
|
|
166
168
|
confidenceBelow: probabilitySchema,
|
|
167
169
|
})
|
|
168
170
|
.strict(),
|
|
169
171
|
z
|
|
170
172
|
.object({
|
|
171
|
-
question: questionSchema,
|
|
173
|
+
question: questionSchema.optional(),
|
|
172
174
|
probabilityBetween: z
|
|
173
175
|
.array(probabilitySchema)
|
|
174
176
|
.length(2)
|