@ai-sdk/gateway 4.0.94 → 4.0.96
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 +13 -0
- package/dist/index.d.ts +45 -4
- package/dist/index.js +140 -47
- package/dist/index.js.map +1 -1
- package/docs/00-ai-gateway.mdx +63 -2
- package/package.json +1 -1
- package/src/gateway-evaluation-model.ts +16 -2
- package/src/gateway-provider-options.ts +184 -3
- package/src/index.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @ai-sdk/gateway
|
|
2
2
|
|
|
3
|
+
## 4.0.96
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e6a7996: fix(provider/gateway): accept any non-empty conditional evaluation fallback model
|
|
8
|
+
- e19f0fc: fix(provider/gateway): accept conditional evaluation fallbacks in GatewayProviderOptions
|
|
9
|
+
|
|
10
|
+
## 4.0.95
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- b67b1b7: feat(provider/gateway): type conditional evaluation fallbacks
|
|
15
|
+
|
|
3
16
|
## 4.0.94
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1227,7 +1227,32 @@ type GatewayProviderMetadata = {
|
|
|
1227
1227
|
readonly [key: string]: JSONValue | undefined;
|
|
1228
1228
|
};
|
|
1229
1229
|
|
|
1230
|
-
|
|
1230
|
+
/**
|
|
1231
|
+
* A condition on the primary model's answers. `QUESTION_ID` narrows
|
|
1232
|
+
* `question` to your question IDs. Groups nest at most five levels deep,
|
|
1233
|
+
* which the SDK checks at runtime.
|
|
1234
|
+
*/
|
|
1235
|
+
type EvaluationFallbackCondition<QUESTION_ID extends string = string> = ExclusiveCondition<{
|
|
1236
|
+
question: QUESTION_ID;
|
|
1237
|
+
confidenceBelow: number;
|
|
1238
|
+
}> | ExclusiveCondition<{
|
|
1239
|
+
question: QUESTION_ID;
|
|
1240
|
+
probabilityBetween: [number, number];
|
|
1241
|
+
}> | ExclusiveCondition<{
|
|
1242
|
+
any: EvaluationFallbackConditionList<QUESTION_ID>;
|
|
1243
|
+
}> | ExclusiveCondition<{
|
|
1244
|
+
all: EvaluationFallbackConditionList<QUESTION_ID>;
|
|
1245
|
+
}> | ExclusiveCondition<{
|
|
1246
|
+
atLeast: {
|
|
1247
|
+
count: number;
|
|
1248
|
+
conditions: EvaluationFallbackConditionList<QUESTION_ID>;
|
|
1249
|
+
};
|
|
1250
|
+
}>;
|
|
1251
|
+
type GatewayModelFallback<QUESTION_ID extends string = string> = string | {
|
|
1252
|
+
model: string;
|
|
1253
|
+
when: EvaluationFallbackCondition<QUESTION_ID>;
|
|
1254
|
+
};
|
|
1255
|
+
type GatewayProviderOptions<QUESTION_ID extends string = string> = {
|
|
1231
1256
|
/**
|
|
1232
1257
|
* Service-owned options may be added by the Gateway without requiring an SDK
|
|
1233
1258
|
* release. The Gateway service validates and applies the runtime schema.
|
|
@@ -1257,8 +1282,14 @@ type GatewayProviderOptions = {
|
|
|
1257
1282
|
* key replay the original batch instead of creating a duplicate.
|
|
1258
1283
|
*/
|
|
1259
1284
|
idempotencyKey?: string;
|
|
1260
|
-
/**
|
|
1261
|
-
|
|
1285
|
+
/**
|
|
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`.
|
|
1291
|
+
*/
|
|
1292
|
+
models?: GatewayModelFallbackList<QUESTION_ID>;
|
|
1262
1293
|
/** Array of provider slugs that are the only ones allowed to be used. */
|
|
1263
1294
|
only?: string[];
|
|
1264
1295
|
/** Array of provider slugs specifying the provider attempt order. */
|
|
@@ -1280,6 +1311,16 @@ type GatewayProviderOptions = {
|
|
|
1280
1311
|
/** Filter to providers with zero data retention agreements. */
|
|
1281
1312
|
zeroDataRetention?: boolean;
|
|
1282
1313
|
};
|
|
1314
|
+
type EvaluationFallbackConditionList<QUESTION_ID extends string> = [
|
|
1315
|
+
EvaluationFallbackCondition<QUESTION_ID>,
|
|
1316
|
+
...EvaluationFallbackCondition<QUESTION_ID>[]
|
|
1317
|
+
];
|
|
1318
|
+
type ConditionKey = 'question' | 'confidenceBelow' | 'probabilityBetween' | 'any' | 'all' | 'atLeast';
|
|
1319
|
+
type ExclusiveCondition<CONDITION> = CONDITION & {
|
|
1320
|
+
[KEY in Exclude<ConditionKey, keyof CONDITION>]?: never;
|
|
1321
|
+
};
|
|
1322
|
+
type ConditionalGatewayModelFallback<QUESTION_ID extends string> = Exclude<GatewayModelFallback<QUESTION_ID>, string>;
|
|
1323
|
+
type GatewayModelFallbackList<QUESTION_ID extends string> = string[] | [ConditionalGatewayModelFallback<QUESTION_ID>, ...string[]];
|
|
1283
1324
|
|
|
1284
1325
|
declare const symbol$9: unique symbol;
|
|
1285
1326
|
declare abstract class GatewayError extends Error {
|
|
@@ -1497,4 +1538,4 @@ declare class GatewayResponseError extends GatewayError {
|
|
|
1497
1538
|
|
|
1498
1539
|
declare const VERSION: string;
|
|
1499
1540
|
|
|
1500
|
-
export { 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 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 };
|
|
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
|
@@ -2247,11 +2247,97 @@ import {
|
|
|
2247
2247
|
createJsonErrorResponseHandler as createJsonErrorResponseHandler9,
|
|
2248
2248
|
createJsonResponseHandler as createJsonResponseHandler9,
|
|
2249
2249
|
getErrorMessage as getErrorMessage9,
|
|
2250
|
-
lazySchema as
|
|
2250
|
+
lazySchema as lazySchema10,
|
|
2251
|
+
parseProviderOptions,
|
|
2251
2252
|
postJsonToApi as postJsonToApi6,
|
|
2252
2253
|
resolve as resolve9,
|
|
2253
|
-
zodSchema as
|
|
2254
|
+
zodSchema as zodSchema10
|
|
2254
2255
|
} from "@ai-sdk/provider-utils";
|
|
2256
|
+
|
|
2257
|
+
// src/gateway-provider-options.ts
|
|
2258
|
+
import { lazySchema as lazySchema9, zodSchema as zodSchema9 } from "@ai-sdk/provider-utils";
|
|
2259
|
+
var EVALUATION_FALLBACK_MAX_CONDITION_DEPTH = 5;
|
|
2260
|
+
var EVALUATION_FALLBACK_MAX_CONDITIONS_PER_LIST = 20;
|
|
2261
|
+
var EVALUATION_FALLBACK_MAX_QUESTION_LENGTH = 256;
|
|
2262
|
+
var gatewayEvaluationProviderOptionsSchema = lazySchema9(
|
|
2263
|
+
() => zodSchema9(
|
|
2264
|
+
z.object({
|
|
2265
|
+
models: gatewayModelFallbacksSchema.optional()
|
|
2266
|
+
}).catchall(z.unknown())
|
|
2267
|
+
)
|
|
2268
|
+
);
|
|
2269
|
+
var probabilitySchema = z.number().finite().min(0).max(1);
|
|
2270
|
+
var questionSchema = z.string().min(1).max(EVALUATION_FALLBACK_MAX_QUESTION_LENGTH);
|
|
2271
|
+
var directConditionSchema = z.union([
|
|
2272
|
+
z.object({
|
|
2273
|
+
question: questionSchema,
|
|
2274
|
+
confidenceBelow: probabilitySchema
|
|
2275
|
+
}).strict(),
|
|
2276
|
+
z.object({
|
|
2277
|
+
question: questionSchema,
|
|
2278
|
+
probabilityBetween: z.array(probabilitySchema).length(2).refine(([minimum, maximum]) => minimum <= maximum, {
|
|
2279
|
+
message: "probabilityBetween minimum must be less than or equal to maximum"
|
|
2280
|
+
})
|
|
2281
|
+
}).strict()
|
|
2282
|
+
]);
|
|
2283
|
+
var groupBeyondMaxDepthSchema = z.union([
|
|
2284
|
+
z.object({ any: z.unknown() }),
|
|
2285
|
+
z.object({ all: z.unknown() }),
|
|
2286
|
+
z.object({ atLeast: z.unknown() })
|
|
2287
|
+
]).superRefine((_, context) => {
|
|
2288
|
+
context.addIssue({
|
|
2289
|
+
code: "custom",
|
|
2290
|
+
message: `conditions can be nested at most ${EVALUATION_FALLBACK_MAX_CONDITION_DEPTH} levels deep`
|
|
2291
|
+
});
|
|
2292
|
+
});
|
|
2293
|
+
var conditionalModelFallbackSchema = z.object({
|
|
2294
|
+
model: z.string().min(1),
|
|
2295
|
+
when: conditionSchema(1)
|
|
2296
|
+
}).strict();
|
|
2297
|
+
var gatewayModelFallbacksSchema = z.array(z.union([z.string(), conditionalModelFallbackSchema])).superRefine((entries, context) => {
|
|
2298
|
+
const conditionalIndexes = entries.flatMap(
|
|
2299
|
+
(entry, index) => typeof entry === "string" ? [] : [index]
|
|
2300
|
+
);
|
|
2301
|
+
if (conditionalIndexes.length > 1) {
|
|
2302
|
+
context.addIssue({
|
|
2303
|
+
code: "custom",
|
|
2304
|
+
message: "models supports at most one conditional evaluation fallback"
|
|
2305
|
+
});
|
|
2306
|
+
}
|
|
2307
|
+
if (conditionalIndexes[0] !== void 0 && conditionalIndexes[0] !== 0) {
|
|
2308
|
+
context.addIssue({
|
|
2309
|
+
code: "custom",
|
|
2310
|
+
message: "a conditional evaluation fallback must be the first models entry",
|
|
2311
|
+
path: [conditionalIndexes[0]]
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2314
|
+
});
|
|
2315
|
+
function conditionSchema(depth) {
|
|
2316
|
+
if (depth === EVALUATION_FALLBACK_MAX_CONDITION_DEPTH) {
|
|
2317
|
+
return z.union([
|
|
2318
|
+
directConditionSchema,
|
|
2319
|
+
groupBeyondMaxDepthSchema
|
|
2320
|
+
]);
|
|
2321
|
+
}
|
|
2322
|
+
const childConditionSchema = conditionSchema(depth + 1);
|
|
2323
|
+
const conditionListSchema = z.array(childConditionSchema).min(1).max(EVALUATION_FALLBACK_MAX_CONDITIONS_PER_LIST);
|
|
2324
|
+
return z.union([
|
|
2325
|
+
directConditionSchema,
|
|
2326
|
+
z.object({ any: conditionListSchema }).strict(),
|
|
2327
|
+
z.object({ all: conditionListSchema }).strict(),
|
|
2328
|
+
z.object({
|
|
2329
|
+
atLeast: z.object({
|
|
2330
|
+
count: z.number().int().min(1),
|
|
2331
|
+
conditions: conditionListSchema
|
|
2332
|
+
}).strict().refine(({ count, conditions }) => count <= conditions.length, {
|
|
2333
|
+
message: "atLeast count cannot exceed the number of conditions",
|
|
2334
|
+
path: ["count"]
|
|
2335
|
+
})
|
|
2336
|
+
}).strict()
|
|
2337
|
+
]);
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
// src/gateway-evaluation-model.ts
|
|
2255
2341
|
var GatewayEvaluationModel = class {
|
|
2256
2342
|
constructor(modelId, config) {
|
|
2257
2343
|
this.modelId = modelId;
|
|
@@ -2269,6 +2355,12 @@ var GatewayEvaluationModel = class {
|
|
|
2269
2355
|
abortSignal,
|
|
2270
2356
|
providerOptions
|
|
2271
2357
|
}) {
|
|
2358
|
+
const gatewayOptions = await parseProviderOptions({
|
|
2359
|
+
provider: "gateway",
|
|
2360
|
+
providerOptions,
|
|
2361
|
+
schema: gatewayEvaluationProviderOptionsSchema
|
|
2362
|
+
});
|
|
2363
|
+
const validatedProviderOptions = gatewayOptions == null ? providerOptions : { ...providerOptions, gateway: gatewayOptions };
|
|
2272
2364
|
const resolvedHeaders = this.config.headers ? await resolve9(this.config.headers) : void 0;
|
|
2273
2365
|
try {
|
|
2274
2366
|
const {
|
|
@@ -2286,7 +2378,7 @@ var GatewayEvaluationModel = class {
|
|
|
2286
2378
|
body: {
|
|
2287
2379
|
state,
|
|
2288
2380
|
questions,
|
|
2289
|
-
...
|
|
2381
|
+
...validatedProviderOptions ? { providerOptions: validatedProviderOptions } : {}
|
|
2290
2382
|
},
|
|
2291
2383
|
successfulResponseHandler: createJsonResponseHandler9(
|
|
2292
2384
|
gatewayEvaluationResponseSchema
|
|
@@ -2305,7 +2397,7 @@ var GatewayEvaluationModel = class {
|
|
|
2305
2397
|
warnings: responseBody.warnings ?? [],
|
|
2306
2398
|
providerMetadata: responseBody.providerMetadata,
|
|
2307
2399
|
response: {
|
|
2308
|
-
modelId: this.modelId,
|
|
2400
|
+
modelId: responseBody.model ?? this.modelId,
|
|
2309
2401
|
headers: responseHeaders,
|
|
2310
2402
|
body: rawValue
|
|
2311
2403
|
}
|
|
@@ -2364,10 +2456,11 @@ var gatewayEvaluationWarningSchema = z.discriminatedUnion("type", [
|
|
|
2364
2456
|
message: z.string()
|
|
2365
2457
|
})
|
|
2366
2458
|
]);
|
|
2367
|
-
var gatewayEvaluationResponseSchema =
|
|
2368
|
-
() =>
|
|
2459
|
+
var gatewayEvaluationResponseSchema = lazySchema10(
|
|
2460
|
+
() => zodSchema10(
|
|
2369
2461
|
z.object({
|
|
2370
2462
|
answers: z.record(z.string(), gatewayEvaluationAnswerSchema),
|
|
2463
|
+
model: z.string().optional(),
|
|
2371
2464
|
rounding: z.object({
|
|
2372
2465
|
probabilityDecimals: z.number().optional(),
|
|
2373
2466
|
scoreDecimals: z.number().optional()
|
|
@@ -2388,10 +2481,10 @@ import {
|
|
|
2388
2481
|
createJsonErrorResponseHandler as createJsonErrorResponseHandler10,
|
|
2389
2482
|
createJsonResponseHandler as createJsonResponseHandler10,
|
|
2390
2483
|
getErrorMessage as getErrorMessage10,
|
|
2391
|
-
lazySchema as
|
|
2484
|
+
lazySchema as lazySchema11,
|
|
2392
2485
|
postJsonToApi as postJsonToApi7,
|
|
2393
2486
|
resolve as resolve10,
|
|
2394
|
-
zodSchema as
|
|
2487
|
+
zodSchema as zodSchema11
|
|
2395
2488
|
} from "@ai-sdk/provider-utils";
|
|
2396
2489
|
var GatewayRerankingModel = class {
|
|
2397
2490
|
constructor(modelId, config) {
|
|
@@ -2484,8 +2577,8 @@ var gatewayRerankingWarningSchema = z.discriminatedUnion("type", [
|
|
|
2484
2577
|
message: z.string()
|
|
2485
2578
|
})
|
|
2486
2579
|
]);
|
|
2487
|
-
var gatewayRerankingResponseSchema =
|
|
2488
|
-
() =>
|
|
2580
|
+
var gatewayRerankingResponseSchema = lazySchema11(
|
|
2581
|
+
() => zodSchema11(
|
|
2489
2582
|
z.object({
|
|
2490
2583
|
ranking: z.array(
|
|
2491
2584
|
z.object({
|
|
@@ -3028,12 +3121,12 @@ function toGatewayRealtimeUrl(baseURL, modelId) {
|
|
|
3028
3121
|
// src/tool/browserbase-fetch.ts
|
|
3029
3122
|
import {
|
|
3030
3123
|
createProviderExecutedToolFactory,
|
|
3031
|
-
lazySchema as
|
|
3032
|
-
zodSchema as
|
|
3124
|
+
lazySchema as lazySchema12,
|
|
3125
|
+
zodSchema as zodSchema12
|
|
3033
3126
|
} from "@ai-sdk/provider-utils";
|
|
3034
3127
|
var jsonObjectSchema = z.record(z.string(), z.unknown());
|
|
3035
|
-
var browserbaseFetchInputSchema =
|
|
3036
|
-
() =>
|
|
3128
|
+
var browserbaseFetchInputSchema = lazySchema12(
|
|
3129
|
+
() => zodSchema12(
|
|
3037
3130
|
z.object({
|
|
3038
3131
|
url: z.string().url().describe("URL of the page to fetch."),
|
|
3039
3132
|
allow_redirects: z.boolean().optional().describe("Whether to follow HTTP redirects (default: false)."),
|
|
@@ -3052,8 +3145,8 @@ var browserbaseFetchInputSchema = lazySchema11(
|
|
|
3052
3145
|
})
|
|
3053
3146
|
)
|
|
3054
3147
|
);
|
|
3055
|
-
var browserbaseFetchOutputSchema =
|
|
3056
|
-
() =>
|
|
3148
|
+
var browserbaseFetchOutputSchema = lazySchema12(
|
|
3149
|
+
() => zodSchema12(
|
|
3057
3150
|
z.union([
|
|
3058
3151
|
z.object({
|
|
3059
3152
|
id: z.string(),
|
|
@@ -3089,19 +3182,19 @@ var browserbaseFetch = (config = {}) => browserbaseFetchToolFactory(config);
|
|
|
3089
3182
|
// src/tool/browserbase-search.ts
|
|
3090
3183
|
import {
|
|
3091
3184
|
createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
|
|
3092
|
-
lazySchema as
|
|
3093
|
-
zodSchema as
|
|
3185
|
+
lazySchema as lazySchema13,
|
|
3186
|
+
zodSchema as zodSchema13
|
|
3094
3187
|
} from "@ai-sdk/provider-utils";
|
|
3095
|
-
var browserbaseSearchInputSchema =
|
|
3096
|
-
() =>
|
|
3188
|
+
var browserbaseSearchInputSchema = lazySchema13(
|
|
3189
|
+
() => zodSchema13(
|
|
3097
3190
|
z.object({
|
|
3098
3191
|
query: z.string().min(1).max(200).describe("Web search query. Must be between 1 and 200 characters."),
|
|
3099
3192
|
num_results: z.number().int().min(1).max(25).optional().describe("Maximum number of results to return (1-25, default: 10).")
|
|
3100
3193
|
})
|
|
3101
3194
|
)
|
|
3102
3195
|
);
|
|
3103
|
-
var browserbaseSearchOutputSchema =
|
|
3104
|
-
() =>
|
|
3196
|
+
var browserbaseSearchOutputSchema = lazySchema13(
|
|
3197
|
+
() => zodSchema13(
|
|
3105
3198
|
z.union([
|
|
3106
3199
|
z.object({
|
|
3107
3200
|
query: z.string(),
|
|
@@ -3144,11 +3237,11 @@ var browserbaseSearch = (config = {}) => browserbaseSearchToolFactory(config);
|
|
|
3144
3237
|
// src/tool/exa-search.ts
|
|
3145
3238
|
import {
|
|
3146
3239
|
createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
|
|
3147
|
-
lazySchema as
|
|
3148
|
-
zodSchema as
|
|
3240
|
+
lazySchema as lazySchema14,
|
|
3241
|
+
zodSchema as zodSchema14
|
|
3149
3242
|
} from "@ai-sdk/provider-utils";
|
|
3150
|
-
var exaSearchInputSchema =
|
|
3151
|
-
() =>
|
|
3243
|
+
var exaSearchInputSchema = lazySchema14(
|
|
3244
|
+
() => zodSchema14(
|
|
3152
3245
|
z.object({
|
|
3153
3246
|
query: z.string().describe("Natural-language web search query. This is required."),
|
|
3154
3247
|
type: z.enum(["auto", "fast", "instant"]).optional().describe(
|
|
@@ -3218,8 +3311,8 @@ var exaSearchInputSchema = lazySchema13(
|
|
|
3218
3311
|
})
|
|
3219
3312
|
)
|
|
3220
3313
|
);
|
|
3221
|
-
var exaSearchOutputSchema =
|
|
3222
|
-
() =>
|
|
3314
|
+
var exaSearchOutputSchema = lazySchema14(
|
|
3315
|
+
() => zodSchema14(
|
|
3223
3316
|
z.union([
|
|
3224
3317
|
z.object({
|
|
3225
3318
|
requestId: z.string(),
|
|
@@ -3276,11 +3369,11 @@ var exaSearch = (config = {}) => exaSearchToolFactory(config);
|
|
|
3276
3369
|
// src/tool/parallel-search.ts
|
|
3277
3370
|
import {
|
|
3278
3371
|
createProviderExecutedToolFactory as createProviderExecutedToolFactory4,
|
|
3279
|
-
lazySchema as
|
|
3280
|
-
zodSchema as
|
|
3372
|
+
lazySchema as lazySchema15,
|
|
3373
|
+
zodSchema as zodSchema15
|
|
3281
3374
|
} from "@ai-sdk/provider-utils";
|
|
3282
|
-
var parallelSearchInputSchema =
|
|
3283
|
-
() =>
|
|
3375
|
+
var parallelSearchInputSchema = lazySchema15(
|
|
3376
|
+
() => zodSchema15(
|
|
3284
3377
|
z.object({
|
|
3285
3378
|
objective: z.string().describe(
|
|
3286
3379
|
"Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
|
|
@@ -3319,8 +3412,8 @@ var parallelSearchInputSchema = lazySchema14(
|
|
|
3319
3412
|
})
|
|
3320
3413
|
)
|
|
3321
3414
|
);
|
|
3322
|
-
var parallelSearchOutputSchema =
|
|
3323
|
-
() =>
|
|
3415
|
+
var parallelSearchOutputSchema = lazySchema15(
|
|
3416
|
+
() => zodSchema15(
|
|
3324
3417
|
z.union([
|
|
3325
3418
|
// Success response
|
|
3326
3419
|
z.object({
|
|
@@ -3361,11 +3454,11 @@ var parallelSearch = (config = {}) => parallelSearchToolFactory(config);
|
|
|
3361
3454
|
// src/tool/perplexity-search.ts
|
|
3362
3455
|
import {
|
|
3363
3456
|
createProviderExecutedToolFactory as createProviderExecutedToolFactory5,
|
|
3364
|
-
lazySchema as
|
|
3365
|
-
zodSchema as
|
|
3457
|
+
lazySchema as lazySchema16,
|
|
3458
|
+
zodSchema as zodSchema16
|
|
3366
3459
|
} from "@ai-sdk/provider-utils";
|
|
3367
|
-
var perplexitySearchInputSchema =
|
|
3368
|
-
() =>
|
|
3460
|
+
var perplexitySearchInputSchema = lazySchema16(
|
|
3461
|
+
() => zodSchema16(
|
|
3369
3462
|
z.object({
|
|
3370
3463
|
query: z.union([z.string(), z.array(z.string())]).describe(
|
|
3371
3464
|
"Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."
|
|
@@ -3406,8 +3499,8 @@ var perplexitySearchInputSchema = lazySchema15(
|
|
|
3406
3499
|
})
|
|
3407
3500
|
)
|
|
3408
3501
|
);
|
|
3409
|
-
var perplexitySearchOutputSchema =
|
|
3410
|
-
() =>
|
|
3502
|
+
var perplexitySearchOutputSchema = lazySchema16(
|
|
3503
|
+
() => zodSchema16(
|
|
3411
3504
|
z.union([
|
|
3412
3505
|
// Success response
|
|
3413
3506
|
z.object({
|
|
@@ -3447,8 +3540,8 @@ var perplexitySearch = (config = {}) => perplexitySearchToolFactory(config);
|
|
|
3447
3540
|
// src/tool/tako-search.ts
|
|
3448
3541
|
import {
|
|
3449
3542
|
createProviderExecutedToolFactory as createProviderExecutedToolFactory6,
|
|
3450
|
-
lazySchema as
|
|
3451
|
-
zodSchema as
|
|
3543
|
+
lazySchema as lazySchema17,
|
|
3544
|
+
zodSchema as zodSchema17
|
|
3452
3545
|
} from "@ai-sdk/provider-utils";
|
|
3453
3546
|
var takoDataSourceInputSchema = z.object({
|
|
3454
3547
|
count: z.number().optional().describe(
|
|
@@ -3487,8 +3580,8 @@ var takoWebSourceInputSchema = z.object({
|
|
|
3487
3580
|
"Keep results published on or before this ISO date (YYYY-MM-DD)."
|
|
3488
3581
|
)
|
|
3489
3582
|
});
|
|
3490
|
-
var takoSearchInputSchema =
|
|
3491
|
-
() =>
|
|
3583
|
+
var takoSearchInputSchema = lazySchema17(
|
|
3584
|
+
() => zodSchema17(
|
|
3492
3585
|
z.object({
|
|
3493
3586
|
query: z.string().describe(
|
|
3494
3587
|
'Natural-language search query. Include the entity, metric, and time period. Quote a phrase to force it to one entity, for example "Tesla":PRODUCT price.'
|
|
@@ -3618,8 +3711,8 @@ var takoWebResultSchema = z.object({
|
|
|
3618
3711
|
publish_date: z.string().nullish(),
|
|
3619
3712
|
content: takoResultContentSchema.nullish()
|
|
3620
3713
|
}).passthrough();
|
|
3621
|
-
var takoSearchOutputSchema =
|
|
3622
|
-
() =>
|
|
3714
|
+
var takoSearchOutputSchema = lazySchema17(
|
|
3715
|
+
() => zodSchema17(
|
|
3623
3716
|
z.union([
|
|
3624
3717
|
z.object({
|
|
3625
3718
|
request_id: z.string(),
|
|
@@ -3715,7 +3808,7 @@ async function getVercelRequestId() {
|
|
|
3715
3808
|
}
|
|
3716
3809
|
|
|
3717
3810
|
// src/version.ts
|
|
3718
|
-
var VERSION = true ? "4.0.
|
|
3811
|
+
var VERSION = true ? "4.0.96" : "0.0.0-test";
|
|
3719
3812
|
|
|
3720
3813
|
// src/gateway-provider.ts
|
|
3721
3814
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|