@ai-sdk/gateway 4.0.95 → 4.0.97
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 +8 -20
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/docs/00-ai-gateway.mdx +4 -4
- package/package.json +3 -3
- package/src/gateway-provider-options.ts +8 -27
- package/src/index.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @ai-sdk/gateway
|
|
2
2
|
|
|
3
|
+
## 4.0.97
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [e3605f6]
|
|
8
|
+
- Updated dependencies [525efc5]
|
|
9
|
+
- @ai-sdk/provider-utils@5.0.50
|
|
10
|
+
- @ai-sdk/provider@4.0.19
|
|
11
|
+
|
|
12
|
+
## 4.0.96
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- e6a7996: fix(provider/gateway): accept any non-empty conditional evaluation fallback model
|
|
17
|
+
- e19f0fc: fix(provider/gateway): accept conditional evaluation fallbacks in GatewayProviderOptions
|
|
18
|
+
|
|
3
19
|
## 4.0.95
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1252,7 +1252,7 @@ type GatewayModelFallback<QUESTION_ID extends string = string> = string | {
|
|
|
1252
1252
|
model: string;
|
|
1253
1253
|
when: EvaluationFallbackCondition<QUESTION_ID>;
|
|
1254
1254
|
};
|
|
1255
|
-
type GatewayProviderOptions = {
|
|
1255
|
+
type GatewayProviderOptions<QUESTION_ID extends string = string> = {
|
|
1256
1256
|
/**
|
|
1257
1257
|
* Service-owned options may be added by the Gateway without requiring an SDK
|
|
1258
1258
|
* release. The Gateway service validates and applies the runtime schema.
|
|
@@ -1283,11 +1283,13 @@ type GatewayProviderOptions = {
|
|
|
1283
1283
|
*/
|
|
1284
1284
|
idempotencyKey?: string;
|
|
1285
1285
|
/**
|
|
1286
|
-
*
|
|
1287
|
-
*
|
|
1288
|
-
* `
|
|
1286
|
+
* Fallback models to try in order. On evaluation requests, the first entry
|
|
1287
|
+
* can be a conditional `{ model, when }` fallback that reruns the evaluation
|
|
1288
|
+
* when `when` matches the primary answers. Other request types reject a
|
|
1289
|
+
* conditional entry. Pass your question IDs as `QUESTION_ID` to check the
|
|
1290
|
+
* `question` names in `when`.
|
|
1289
1291
|
*/
|
|
1290
|
-
models?:
|
|
1292
|
+
models?: GatewayModelFallbackList<QUESTION_ID>;
|
|
1291
1293
|
/** Array of provider slugs that are the only ones allowed to be used. */
|
|
1292
1294
|
only?: string[];
|
|
1293
1295
|
/** Array of provider slugs specifying the provider attempt order. */
|
|
@@ -1309,17 +1311,6 @@ type GatewayProviderOptions = {
|
|
|
1309
1311
|
/** Filter to providers with zero data retention agreements. */
|
|
1310
1312
|
zeroDataRetention?: boolean;
|
|
1311
1313
|
};
|
|
1312
|
-
/**
|
|
1313
|
-
* Gateway provider options for evaluation requests. Same as
|
|
1314
|
-
* `GatewayProviderOptions`, except `models` may start with one conditional
|
|
1315
|
-
* `{ model, when }` entry followed by string error fallbacks.
|
|
1316
|
-
*
|
|
1317
|
-
* The SDK validates `models` strictly before sending the request, so new
|
|
1318
|
-
* condition shapes need an SDK release. Other keys pass through unchanged.
|
|
1319
|
-
*/
|
|
1320
|
-
type GatewayEvaluationProviderOptions<QUESTION_ID extends string = string> = GatewayProviderOptionsWithoutModels & {
|
|
1321
|
-
models?: GatewayModelFallbackList<QUESTION_ID>;
|
|
1322
|
-
};
|
|
1323
1314
|
type EvaluationFallbackConditionList<QUESTION_ID extends string> = [
|
|
1324
1315
|
EvaluationFallbackCondition<QUESTION_ID>,
|
|
1325
1316
|
...EvaluationFallbackCondition<QUESTION_ID>[]
|
|
@@ -1328,9 +1319,6 @@ type ConditionKey = 'question' | 'confidenceBelow' | 'probabilityBetween' | 'any
|
|
|
1328
1319
|
type ExclusiveCondition<CONDITION> = CONDITION & {
|
|
1329
1320
|
[KEY in Exclude<ConditionKey, keyof CONDITION>]?: never;
|
|
1330
1321
|
};
|
|
1331
|
-
type GatewayProviderOptionsWithoutModels = {
|
|
1332
|
-
[KEY in keyof GatewayProviderOptions as KEY extends 'models' ? never : KEY]: GatewayProviderOptions[KEY];
|
|
1333
|
-
};
|
|
1334
1322
|
type ConditionalGatewayModelFallback<QUESTION_ID extends string> = Exclude<GatewayModelFallback<QUESTION_ID>, string>;
|
|
1335
1323
|
type GatewayModelFallbackList<QUESTION_ID extends string> = string[] | [ConditionalGatewayModelFallback<QUESTION_ID>, ...string[]];
|
|
1336
1324
|
|
|
@@ -1550,4 +1538,4 @@ declare class GatewayResponseError extends GatewayError {
|
|
|
1550
1538
|
|
|
1551
1539
|
declare const VERSION: string;
|
|
1552
1540
|
|
|
1553
|
-
export { type EvaluationFallbackCondition, GATEWAY_AUTH_SUBPROTOCOL_PREFIX, GATEWAY_REALTIME_SUBPROTOCOL, GATEWAY_TEAM_SUBPROTOCOL_PREFIX, GATEWAY_TRANSCRIPTION_SUBPROTOCOL, type GatewayAsyncJobMetadata, GatewayAuthenticationError, type GatewayCreditsResponse, type GatewayEmbeddingModelId, GatewayError, type GatewayErrorResponse, type GatewayEvaluationModelId,
|
|
1541
|
+
export { type EvaluationFallbackCondition, GATEWAY_AUTH_SUBPROTOCOL_PREFIX, GATEWAY_REALTIME_SUBPROTOCOL, GATEWAY_TEAM_SUBPROTOCOL_PREFIX, GATEWAY_TRANSCRIPTION_SUBPROTOCOL, type GatewayAsyncJobMetadata, GatewayAuthenticationError, type GatewayCreditsResponse, type GatewayEmbeddingModelId, GatewayError, type GatewayErrorResponse, type GatewayEvaluationModelId, GatewayFailedDependencyError, GatewayForbiddenError, type GatewayGenerationInfo, type GatewayGenerationInfoParams, type GatewayImageModelId, GatewayInternalServerError, GatewayInvalidRequestError, type GatewayLanguageModelEntry, type GatewayProviderOptions as GatewayLanguageModelOptions, type GatewayLanguageModelSpecification, type GatewayLanguageModelEntry as GatewayModelEntry, type GatewayModelFallback, type GatewayModelId, GatewayModelNotFoundError, GatewayNotFoundError, type GatewayProvider, type GatewayProviderMetadata, type GatewayProviderOptions, type GatewayProviderSettings, GatewayRateLimitError, type GatewayRealtimeModelId, type GatewayRerankingModelId, GatewayResponseError, type GatewaySpeechModelId, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayTranscriptionModelId, type GatewayVideoModelId, VERSION, createGateway, createGateway as createGatewayProvider, gateway, getGatewayRealtimeAuthToken, getGatewayRealtimeProtocols, getGatewayRealtimeTeamIdOrSlug, getGatewayTranscriptionProtocols };
|
package/dist/index.js
CHANGED
|
@@ -2259,7 +2259,6 @@ import { lazySchema as lazySchema9, zodSchema as zodSchema9 } from "@ai-sdk/prov
|
|
|
2259
2259
|
var EVALUATION_FALLBACK_MAX_CONDITION_DEPTH = 5;
|
|
2260
2260
|
var EVALUATION_FALLBACK_MAX_CONDITIONS_PER_LIST = 20;
|
|
2261
2261
|
var EVALUATION_FALLBACK_MAX_QUESTION_LENGTH = 256;
|
|
2262
|
-
var EVALUATION_FALLBACK_MAX_MODEL_LENGTH = 256;
|
|
2263
2262
|
var gatewayEvaluationProviderOptionsSchema = lazySchema9(
|
|
2264
2263
|
() => zodSchema9(
|
|
2265
2264
|
z.object({
|
|
@@ -2292,7 +2291,7 @@ var groupBeyondMaxDepthSchema = z.union([
|
|
|
2292
2291
|
});
|
|
2293
2292
|
});
|
|
2294
2293
|
var conditionalModelFallbackSchema = z.object({
|
|
2295
|
-
model: z.string().min(1)
|
|
2294
|
+
model: z.string().min(1),
|
|
2296
2295
|
when: conditionSchema(1)
|
|
2297
2296
|
}).strict();
|
|
2298
2297
|
var gatewayModelFallbacksSchema = z.array(z.union([z.string(), conditionalModelFallbackSchema])).superRefine((entries, context) => {
|
|
@@ -3809,7 +3808,7 @@ async function getVercelRequestId() {
|
|
|
3809
3808
|
}
|
|
3810
3809
|
|
|
3811
3810
|
// src/version.ts
|
|
3812
|
-
var VERSION = true ? "4.0.
|
|
3811
|
+
var VERSION = true ? "4.0.97" : "0.0.0-test";
|
|
3813
3812
|
|
|
3814
3813
|
// src/gateway-provider.ts
|
|
3815
3814
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|