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