@ai-sdk/gateway 4.0.139 → 4.0.142
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 +33 -0
- package/dist/index.d.ts +45 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +456 -416
- package/dist/index.js.map +1 -1
- package/docs/00-ai-gateway.mdx +38 -1
- package/package.json +3 -3
- package/src/errors/create-gateway-error.ts +4 -4
- package/src/gateway-batch.ts +29 -27
- package/src/gateway-decision-model-settings.ts +1 -0
- package/src/gateway-decision-model.ts +21 -21
- package/src/gateway-embedding-model.ts +7 -7
- package/src/gateway-fetch-metadata.ts +33 -29
- package/src/gateway-generation-info.ts +13 -11
- package/src/gateway-image-model.ts +17 -16
- package/src/gateway-language-model-settings.ts +6 -0
- package/src/gateway-provider-options.ts +72 -50
- package/src/gateway-provider.ts +1 -1
- package/src/gateway-reranking-model.ts +6 -6
- package/src/gateway-speech-model.ts +8 -8
- package/src/gateway-spend-report.ts +19 -18
- package/src/gateway-transcription-model.ts +18 -18
- package/src/gateway-video-model.ts +31 -30
- package/src/tool/browserbase-fetch.ts +22 -29
- package/src/tool/browserbase-search.ts +15 -17
- package/src/tool/deepseek-fetch.ts +10 -10
- package/src/tool/deepseek-search.ts +36 -37
- package/src/tool/exa-search.ts +132 -125
- package/src/tool/gateway-tool-error.ts +8 -7
- package/src/tool/parallel-search.ts +93 -104
- package/src/tool/perplexity-search.ts +62 -85
- package/src/tool/tako-search.ts +319 -251
- package/src/zod.ts +47 -5
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EXPERIMENTAL_SPEECH_STREAM_START_FRAME_TYPE, EXPERIMENTAL_SPEECH_STREAM_TEXT_DELTA_FRAME_TYPE, EXPERIMENTAL_SPEECH_STREAM_TEXT_DONE_FRAME_TYPE, EXPERIMENTAL_TRANSCRIPTION_STREAM_AUDIO_DONE_FRAME_TYPE, EXPERIMENTAL_TRANSCRIPTION_STREAM_START_FRAME_TYPE, WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, combineHeaders, connectToWebSocket, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertUint8ArrayToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonLinesResponseHandler, createJsonResponseHandler, createProviderExecutedToolFactory, experimental_parseSpeechStreamPart, experimental_parseTranscriptionStreamPart, getErrorMessage, getFromApi, lazySchema, loadOptionalSetting, normalizeBatchRequestCounts, normalizeHeaders, parseJsonEventStream, parseProviderOptions, postJsonToApi, removeUndefinedEntries, resolve, safeValidateTypes, secureJsonParse, serializeModelOptions, waitForWebSocketBufferDrain, withUserAgentSuffix, withoutTrailingSlash, zodSchema } from "@ai-sdk/provider-utils";
|
|
2
|
-
import { any, array, boolean, discriminatedUnion, enum as enum$1, instanceof as instanceof$1, json, literal, number, object, record, string, union, unknown } from "zod/v4";
|
|
2
|
+
import { any, array, boolean, catchall, discriminatedUnion, enum as enum$1, extend, globalRegistry, instanceof as instanceof$1, int, json, length, literal, maxLength, maximum, minLength, minimum, never, nullable, nullish, number, object, optional, pipe, record, refine, string, transform, union, unknown, url } from "zod/v4/mini";
|
|
3
3
|
import { APICallError, InvalidArgumentError, LoadAPIKeyError, UnsupportedFunctionalityError, getErrorMessage as getErrorMessage$1 } from "@ai-sdk/provider";
|
|
4
4
|
import { getContext, getVercelOidcToken } from "@vercel/oidc";
|
|
5
5
|
//#region src/gateway-realtime-auth.ts
|
|
@@ -119,18 +119,40 @@ const z = {
|
|
|
119
119
|
any,
|
|
120
120
|
array,
|
|
121
121
|
boolean,
|
|
122
|
+
catchall,
|
|
123
|
+
describe,
|
|
122
124
|
discriminatedUnion,
|
|
123
125
|
enum: enum$1,
|
|
126
|
+
extend,
|
|
124
127
|
instanceof: instanceof$1,
|
|
125
|
-
|
|
128
|
+
int,
|
|
126
129
|
json,
|
|
130
|
+
length,
|
|
131
|
+
literal,
|
|
132
|
+
maxLength,
|
|
133
|
+
maximum,
|
|
134
|
+
minLength,
|
|
135
|
+
minimum,
|
|
136
|
+
never,
|
|
137
|
+
nullable,
|
|
138
|
+
nullish,
|
|
127
139
|
number,
|
|
128
140
|
object,
|
|
141
|
+
optional,
|
|
142
|
+
pipe,
|
|
129
143
|
record,
|
|
144
|
+
refine,
|
|
130
145
|
string,
|
|
146
|
+
transform,
|
|
131
147
|
union,
|
|
132
|
-
unknown
|
|
148
|
+
unknown,
|
|
149
|
+
url
|
|
133
150
|
};
|
|
151
|
+
function describe(schema, description) {
|
|
152
|
+
const clone = schema.clone();
|
|
153
|
+
globalRegistry.add(clone, { description });
|
|
154
|
+
return clone;
|
|
155
|
+
}
|
|
134
156
|
//#endregion
|
|
135
157
|
//#region src/errors/gateway-error.ts
|
|
136
158
|
const symbol$10 = Symbol.for("vercel.ai.gateway.error");
|
|
@@ -515,11 +537,11 @@ async function createGatewayErrorFromResponse({ response, statusCode, defaultMes
|
|
|
515
537
|
const gatewayErrorResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
516
538
|
error: z.object({
|
|
517
539
|
message: z.string(),
|
|
518
|
-
type: z.
|
|
519
|
-
param: z.
|
|
520
|
-
code: z.union([z.string(), z.number()])
|
|
540
|
+
type: z.nullish(z.string()),
|
|
541
|
+
param: z.nullish(z.unknown()),
|
|
542
|
+
code: z.nullish(z.union([z.string(), z.number()]))
|
|
521
543
|
}),
|
|
522
|
-
generationId: z.
|
|
544
|
+
generationId: z.nullish(z.string())
|
|
523
545
|
})));
|
|
524
546
|
//#endregion
|
|
525
547
|
//#region src/errors/extract-api-call-response.ts
|
|
@@ -695,35 +717,35 @@ function getTeamIdOrSlug(headers) {
|
|
|
695
717
|
if (!headers) return void 0;
|
|
696
718
|
for (const [name, value] of Object.entries(headers)) if (name.toLowerCase() === "x-vercel-ai-gateway-team") return value?.trim() || void 0;
|
|
697
719
|
}
|
|
698
|
-
const gatewayAvailableModelsResponseSchema = lazySchema(() => zodSchema(z.object({ models: z.array(z.object({
|
|
720
|
+
const gatewayAvailableModelsResponseSchema = lazySchema(() => zodSchema(z.object({ models: z.pipe(z.array(z.object({
|
|
699
721
|
id: z.string(),
|
|
700
722
|
name: z.string(),
|
|
701
|
-
description: z.
|
|
702
|
-
pricing: z.object({
|
|
723
|
+
description: z.nullish(z.string()),
|
|
724
|
+
pricing: z.nullish(z.pipe(z.object({
|
|
703
725
|
input: z.string(),
|
|
704
726
|
output: z.string(),
|
|
705
|
-
input_cache_read: z.
|
|
706
|
-
input_cache_write: z.
|
|
707
|
-
}).transform(({ input, output, input_cache_read, input_cache_write }) => ({
|
|
727
|
+
input_cache_read: z.nullish(z.string()),
|
|
728
|
+
input_cache_write: z.nullish(z.string())
|
|
729
|
+
}), z.transform(({ input, output, input_cache_read, input_cache_write }) => ({
|
|
708
730
|
input,
|
|
709
731
|
output,
|
|
710
732
|
...input_cache_read ? { cachedInputTokens: input_cache_read } : {},
|
|
711
733
|
...input_cache_write ? { cacheCreationInputTokens: input_cache_write } : {}
|
|
712
|
-
}))
|
|
734
|
+
})))),
|
|
713
735
|
specification: z.object({
|
|
714
736
|
specificationVersion: z.literal("v4"),
|
|
715
737
|
provider: z.string(),
|
|
716
738
|
modelId: z.string()
|
|
717
739
|
}),
|
|
718
|
-
modelType: z.
|
|
719
|
-
})).transform((models) => models.filter((m) => m.modelType == null || KNOWN_MODEL_TYPES.includes(m.modelType))) })));
|
|
720
|
-
const gatewayCreditsResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
740
|
+
modelType: z.nullish(z.string())
|
|
741
|
+
})), z.transform((models) => models.filter((m) => m.modelType == null || KNOWN_MODEL_TYPES.includes(m.modelType)))) })));
|
|
742
|
+
const gatewayCreditsResponseSchema = lazySchema(() => zodSchema(z.pipe(z.object({
|
|
721
743
|
balance: z.string(),
|
|
722
744
|
total_used: z.string()
|
|
723
|
-
}).transform(({ balance, total_used }) => ({
|
|
745
|
+
}), z.transform(({ balance, total_used }) => ({
|
|
724
746
|
balance,
|
|
725
747
|
totalUsed: total_used
|
|
726
|
-
}))));
|
|
748
|
+
})))));
|
|
727
749
|
//#endregion
|
|
728
750
|
//#region src/gateway-spend-report.ts
|
|
729
751
|
var GatewaySpendReport = class {
|
|
@@ -760,23 +782,23 @@ var GatewaySpendReport = class {
|
|
|
760
782
|
}
|
|
761
783
|
}
|
|
762
784
|
};
|
|
763
|
-
const gatewaySpendReportResponseSchema = lazySchema(() => zodSchema(z.object({ results: z.array(z.object({
|
|
764
|
-
day: z.
|
|
765
|
-
hour: z.
|
|
766
|
-
user: z.
|
|
767
|
-
model: z.
|
|
768
|
-
tag: z.
|
|
769
|
-
provider: z.
|
|
770
|
-
credential_type: z.enum(["byok", "system"])
|
|
785
|
+
const gatewaySpendReportResponseSchema = lazySchema(() => zodSchema(z.object({ results: z.array(z.pipe(z.object({
|
|
786
|
+
day: z.optional(z.string()),
|
|
787
|
+
hour: z.optional(z.string()),
|
|
788
|
+
user: z.optional(z.string()),
|
|
789
|
+
model: z.optional(z.string()),
|
|
790
|
+
tag: z.optional(z.string()),
|
|
791
|
+
provider: z.optional(z.string()),
|
|
792
|
+
credential_type: z.optional(z.enum(["byok", "system"])),
|
|
771
793
|
total_cost: z.number(),
|
|
772
|
-
market_cost: z.
|
|
773
|
-
input_tokens: z.
|
|
774
|
-
output_tokens: z.
|
|
775
|
-
cached_input_tokens: z.
|
|
776
|
-
cache_creation_input_tokens: z.
|
|
777
|
-
reasoning_tokens: z.
|
|
778
|
-
request_count: z.
|
|
779
|
-
}).transform(({ credential_type, total_cost, market_cost, input_tokens, output_tokens, cached_input_tokens, cache_creation_input_tokens, reasoning_tokens, request_count, ...rest }) => ({
|
|
794
|
+
market_cost: z.optional(z.number()),
|
|
795
|
+
input_tokens: z.optional(z.number()),
|
|
796
|
+
output_tokens: z.optional(z.number()),
|
|
797
|
+
cached_input_tokens: z.optional(z.number()),
|
|
798
|
+
cache_creation_input_tokens: z.optional(z.number()),
|
|
799
|
+
reasoning_tokens: z.optional(z.number()),
|
|
800
|
+
request_count: z.optional(z.number())
|
|
801
|
+
}), z.transform(({ credential_type, total_cost, market_cost, input_tokens, output_tokens, cached_input_tokens, cache_creation_input_tokens, reasoning_tokens, request_count, ...rest }) => ({
|
|
780
802
|
...rest,
|
|
781
803
|
...credential_type !== void 0 ? { credentialType: credential_type } : {},
|
|
782
804
|
totalCost: total_cost,
|
|
@@ -787,7 +809,7 @@ const gatewaySpendReportResponseSchema = lazySchema(() => zodSchema(z.object({ r
|
|
|
787
809
|
...cache_creation_input_tokens !== void 0 ? { cacheCreationInputTokens: cache_creation_input_tokens } : {},
|
|
788
810
|
...reasoning_tokens !== void 0 ? { reasoningTokens: reasoning_tokens } : {},
|
|
789
811
|
...request_count !== void 0 ? { requestCount: request_count } : {}
|
|
790
|
-
}))) })));
|
|
812
|
+
})))) })));
|
|
791
813
|
//#endregion
|
|
792
814
|
//#region src/gateway-generation-info.ts
|
|
793
815
|
var GatewayGenerationInfoFetcher = class {
|
|
@@ -814,12 +836,12 @@ var GatewayGenerationInfoFetcher = class {
|
|
|
814
836
|
}
|
|
815
837
|
}
|
|
816
838
|
};
|
|
817
|
-
const gatewayGenerationInfoResponseSchema = lazySchema(() => zodSchema(z.object({ data: z.object({
|
|
839
|
+
const gatewayGenerationInfoResponseSchema = lazySchema(() => zodSchema(z.pipe(z.object({ data: z.pipe(z.object({
|
|
818
840
|
id: z.string(),
|
|
819
841
|
total_cost: z.number(),
|
|
820
|
-
market_cost: z.
|
|
821
|
-
surcharge_cost: z.
|
|
822
|
-
gateway_cost: z.
|
|
842
|
+
market_cost: z.nullish(z.number()),
|
|
843
|
+
surcharge_cost: z.nullish(z.number()),
|
|
844
|
+
gateway_cost: z.nullish(z.number()),
|
|
823
845
|
upstream_inference_cost: z.number(),
|
|
824
846
|
usage: z.number(),
|
|
825
847
|
created_at: z.string(),
|
|
@@ -836,7 +858,7 @@ const gatewayGenerationInfoResponseSchema = lazySchema(() => zodSchema(z.object(
|
|
|
836
858
|
native_tokens_cached: z.number(),
|
|
837
859
|
native_tokens_cache_creation: z.number(),
|
|
838
860
|
billable_web_search_calls: z.number()
|
|
839
|
-
}).transform(({ total_cost, market_cost, surcharge_cost, gateway_cost, upstream_inference_cost, created_at, is_byok, provider_name, finish_reason, generation_time, native_tokens_prompt, native_tokens_completion, native_tokens_reasoning, native_tokens_cached, native_tokens_cache_creation, billable_web_search_calls, ...rest }) => ({
|
|
861
|
+
}), z.transform(({ total_cost, market_cost, surcharge_cost, gateway_cost, upstream_inference_cost, created_at, is_byok, provider_name, finish_reason, generation_time, native_tokens_prompt, native_tokens_completion, native_tokens_reasoning, native_tokens_cached, native_tokens_cache_creation, billable_web_search_calls, ...rest }) => ({
|
|
840
862
|
...rest,
|
|
841
863
|
totalCost: total_cost,
|
|
842
864
|
...market_cost != null ? { marketCost: market_cost } : {},
|
|
@@ -854,7 +876,7 @@ const gatewayGenerationInfoResponseSchema = lazySchema(() => zodSchema(z.object(
|
|
|
854
876
|
cachedTokens: native_tokens_cached,
|
|
855
877
|
cacheCreationTokens: native_tokens_cache_creation,
|
|
856
878
|
billableWebSearchCalls: billable_web_search_calls
|
|
857
|
-
})) }).transform(({ data }) => data)));
|
|
879
|
+
}))) }), z.transform(({ data }) => data))));
|
|
858
880
|
//#endregion
|
|
859
881
|
//#region src/gateway-batch.ts
|
|
860
882
|
var GatewayBatch = class {
|
|
@@ -1107,7 +1129,7 @@ async function* convertGatewayBatchResultLines(lines) {
|
|
|
1107
1129
|
yield item;
|
|
1108
1130
|
}
|
|
1109
1131
|
}
|
|
1110
|
-
const gatewayBatchItemResultLineSchema = lazySchema(() => zodSchema(z.object({
|
|
1132
|
+
const gatewayBatchItemResultLineSchema = lazySchema(() => zodSchema(z.catchall(z.object({
|
|
1111
1133
|
type: z.literal("text"),
|
|
1112
1134
|
id: z.string(),
|
|
1113
1135
|
status: z.enum([
|
|
@@ -1116,18 +1138,18 @@ const gatewayBatchItemResultLineSchema = lazySchema(() => zodSchema(z.object({
|
|
|
1116
1138
|
"failed",
|
|
1117
1139
|
"succeeded"
|
|
1118
1140
|
])
|
|
1119
|
-
})
|
|
1141
|
+
}), z.unknown())));
|
|
1120
1142
|
const gatewayBatchErrorSchema = () => z.object({
|
|
1121
1143
|
message: z.string(),
|
|
1122
|
-
type: z.
|
|
1123
|
-
code: z.
|
|
1124
|
-
statusCode: z.
|
|
1144
|
+
type: z.nullish(z.string()),
|
|
1145
|
+
code: z.nullish(z.string()),
|
|
1146
|
+
statusCode: z.nullish(z.number())
|
|
1125
1147
|
});
|
|
1126
1148
|
const gatewayBatchRequestCountsSchema = () => z.object({
|
|
1127
|
-
total: z.
|
|
1128
|
-
pending: z.
|
|
1129
|
-
completed: z.
|
|
1130
|
-
failed: z.
|
|
1149
|
+
total: z.nullish(z.number()),
|
|
1150
|
+
pending: z.nullish(z.number()),
|
|
1151
|
+
completed: z.nullish(z.number()),
|
|
1152
|
+
failed: z.nullish(z.number())
|
|
1131
1153
|
});
|
|
1132
1154
|
const gatewayBatchProviderMetadataSchema = () => z.record(z.string(), z.record(z.string(), z.unknown()));
|
|
1133
1155
|
const gatewayBatchStatusFieldsSchema = () => z.object({
|
|
@@ -1136,19 +1158,19 @@ const gatewayBatchStatusFieldsSchema = () => z.object({
|
|
|
1136
1158
|
"failed",
|
|
1137
1159
|
"pending"
|
|
1138
1160
|
]),
|
|
1139
|
-
rawStatus: z.
|
|
1140
|
-
requestCounts:
|
|
1141
|
-
error:
|
|
1142
|
-
createdAt: z.
|
|
1143
|
-
expiresAt: z.
|
|
1144
|
-
providerMetadata:
|
|
1161
|
+
rawStatus: z.nullish(z.string()),
|
|
1162
|
+
requestCounts: z.nullish(gatewayBatchRequestCountsSchema()),
|
|
1163
|
+
error: z.nullish(gatewayBatchErrorSchema()),
|
|
1164
|
+
createdAt: z.nullish(z.string()),
|
|
1165
|
+
expiresAt: z.nullish(z.string()),
|
|
1166
|
+
providerMetadata: z.nullish(gatewayBatchProviderMetadataSchema())
|
|
1145
1167
|
});
|
|
1146
|
-
const gatewayBatchStartResponseSchema = lazySchema(() => zodSchema(gatewayBatchStatusFieldsSchema()
|
|
1168
|
+
const gatewayBatchStartResponseSchema = lazySchema(() => zodSchema(z.extend(gatewayBatchStatusFieldsSchema(), {
|
|
1147
1169
|
batchId: z.string(),
|
|
1148
|
-
warnings: z.array(z.object({
|
|
1149
|
-
requestId: z.
|
|
1170
|
+
warnings: z.nullish(z.array(z.catchall(z.object({
|
|
1171
|
+
requestId: z.nullish(z.string()),
|
|
1150
1172
|
warning: z.unknown()
|
|
1151
|
-
})
|
|
1173
|
+
}), z.unknown())))
|
|
1152
1174
|
})));
|
|
1153
1175
|
const gatewayBatchStatusResponseSchema = lazySchema(() => zodSchema(gatewayBatchStatusFieldsSchema()));
|
|
1154
1176
|
//#endregion
|
|
@@ -1355,12 +1377,12 @@ const gatewayEmbeddingWarningSchema = () => z.discriminatedUnion("type", [
|
|
|
1355
1377
|
z.object({
|
|
1356
1378
|
type: z.literal("unsupported"),
|
|
1357
1379
|
feature: z.string(),
|
|
1358
|
-
details: z.
|
|
1380
|
+
details: z.optional(z.string())
|
|
1359
1381
|
}),
|
|
1360
1382
|
z.object({
|
|
1361
1383
|
type: z.literal("compatibility"),
|
|
1362
1384
|
feature: z.string(),
|
|
1363
|
-
details: z.
|
|
1385
|
+
details: z.optional(z.string())
|
|
1364
1386
|
}),
|
|
1365
1387
|
z.object({
|
|
1366
1388
|
type: z.literal("deprecated"),
|
|
@@ -1374,9 +1396,9 @@ const gatewayEmbeddingWarningSchema = () => z.discriminatedUnion("type", [
|
|
|
1374
1396
|
]);
|
|
1375
1397
|
const gatewayEmbeddingResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
1376
1398
|
embeddings: z.array(z.array(z.number())),
|
|
1377
|
-
usage: z.object({ tokens: z.number() })
|
|
1378
|
-
warnings: z.array(gatewayEmbeddingWarningSchema())
|
|
1379
|
-
providerMetadata: z.record(z.string(), z.record(z.string(), z.unknown()))
|
|
1399
|
+
usage: z.nullish(z.object({ tokens: z.number() })),
|
|
1400
|
+
warnings: z.optional(z.array(gatewayEmbeddingWarningSchema())),
|
|
1401
|
+
providerMetadata: z.optional(z.record(z.string(), z.record(z.string(), z.unknown())))
|
|
1380
1402
|
})));
|
|
1381
1403
|
//#endregion
|
|
1382
1404
|
//#region src/gateway-image-model.ts
|
|
@@ -1474,17 +1496,17 @@ function toImageModelImages(images) {
|
|
|
1474
1496
|
if (images.every((image) => typeof image === "string")) return images;
|
|
1475
1497
|
return images.map((image) => typeof image === "string" ? convertBase64ToUint8Array(image) : image);
|
|
1476
1498
|
}
|
|
1477
|
-
const providerMetadataEntrySchema$3 = () => z.object({ images: z.array(z.unknown())
|
|
1499
|
+
const providerMetadataEntrySchema$3 = () => z.catchall(z.object({ images: z.optional(z.array(z.unknown())) }), z.unknown());
|
|
1478
1500
|
const gatewayImageWarningSchema = () => z.discriminatedUnion("type", [
|
|
1479
1501
|
z.object({
|
|
1480
1502
|
type: z.literal("unsupported"),
|
|
1481
1503
|
feature: z.string(),
|
|
1482
|
-
details: z.
|
|
1504
|
+
details: z.optional(z.string())
|
|
1483
1505
|
}),
|
|
1484
1506
|
z.object({
|
|
1485
1507
|
type: z.literal("compatibility"),
|
|
1486
1508
|
feature: z.string(),
|
|
1487
|
-
details: z.
|
|
1509
|
+
details: z.optional(z.string())
|
|
1488
1510
|
}),
|
|
1489
1511
|
z.object({
|
|
1490
1512
|
type: z.literal("deprecated"),
|
|
@@ -1497,16 +1519,16 @@ const gatewayImageWarningSchema = () => z.discriminatedUnion("type", [
|
|
|
1497
1519
|
})
|
|
1498
1520
|
]);
|
|
1499
1521
|
const gatewayImageUsageSchema = () => z.object({
|
|
1500
|
-
inputTokens: z.
|
|
1501
|
-
outputTokens: z.
|
|
1502
|
-
totalTokens: z.
|
|
1522
|
+
inputTokens: z.nullish(z.number()),
|
|
1523
|
+
outputTokens: z.nullish(z.number()),
|
|
1524
|
+
totalTokens: z.nullish(z.number())
|
|
1503
1525
|
});
|
|
1504
1526
|
const gatewayImageResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
1505
1527
|
images: z.array(z.union([z.string(), z.instanceof(Uint8Array)])),
|
|
1506
|
-
isRetryable: z.
|
|
1507
|
-
warnings: z.array(gatewayImageWarningSchema())
|
|
1508
|
-
providerMetadata: z.record(z.string(), providerMetadataEntrySchema$3())
|
|
1509
|
-
usage:
|
|
1528
|
+
isRetryable: z.optional(z.boolean()),
|
|
1529
|
+
warnings: z.optional(z.array(gatewayImageWarningSchema())),
|
|
1530
|
+
providerMetadata: z.optional(z.record(z.string(), providerMetadataEntrySchema$3())),
|
|
1531
|
+
usage: z.optional(gatewayImageUsageSchema())
|
|
1510
1532
|
})));
|
|
1511
1533
|
//#endregion
|
|
1512
1534
|
//#region src/gateway-video-model.ts
|
|
@@ -1729,7 +1751,7 @@ function maybeEncodeVideoFile(file) {
|
|
|
1729
1751
|
};
|
|
1730
1752
|
return file;
|
|
1731
1753
|
}
|
|
1732
|
-
const providerMetadataEntrySchema$2 = () => z.object({ videos: z.array(z.unknown())
|
|
1754
|
+
const providerMetadataEntrySchema$2 = () => z.catchall(z.object({ videos: z.optional(z.array(z.unknown())) }), z.unknown());
|
|
1733
1755
|
const gatewayVideoDataSchema = () => z.union([
|
|
1734
1756
|
z.object({
|
|
1735
1757
|
type: z.literal("uploaded"),
|
|
@@ -1750,12 +1772,12 @@ const gatewayVideoWarningSchema = () => z.discriminatedUnion("type", [
|
|
|
1750
1772
|
z.object({
|
|
1751
1773
|
type: z.literal("unsupported"),
|
|
1752
1774
|
feature: z.string(),
|
|
1753
|
-
details: z.
|
|
1775
|
+
details: z.optional(z.string())
|
|
1754
1776
|
}),
|
|
1755
1777
|
z.object({
|
|
1756
1778
|
type: z.literal("compatibility"),
|
|
1757
1779
|
feature: z.string(),
|
|
1758
|
-
details: z.
|
|
1780
|
+
details: z.optional(z.string())
|
|
1759
1781
|
}),
|
|
1760
1782
|
z.object({
|
|
1761
1783
|
type: z.literal("deprecated"),
|
|
@@ -1770,73 +1792,79 @@ const gatewayVideoWarningSchema = () => z.discriminatedUnion("type", [
|
|
|
1770
1792
|
const gatewayVideoEventSchema = lazySchema(() => zodSchema(z.discriminatedUnion("type", [z.object({
|
|
1771
1793
|
type: z.literal("result"),
|
|
1772
1794
|
videos: z.array(gatewayVideoDataSchema()),
|
|
1773
|
-
warnings: z.array(gatewayVideoWarningSchema())
|
|
1774
|
-
providerMetadata: z.record(z.string(), providerMetadataEntrySchema$2())
|
|
1795
|
+
warnings: z.optional(z.array(gatewayVideoWarningSchema())),
|
|
1796
|
+
providerMetadata: z.optional(z.record(z.string(), providerMetadataEntrySchema$2()))
|
|
1775
1797
|
}), z.object({
|
|
1776
1798
|
type: z.literal("error"),
|
|
1777
1799
|
message: z.string(),
|
|
1778
1800
|
errorType: z.string(),
|
|
1779
1801
|
statusCode: z.number(),
|
|
1780
|
-
param: z.
|
|
1802
|
+
param: z.nullable(z.unknown())
|
|
1781
1803
|
})])));
|
|
1782
1804
|
const gatewayVideoStartResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
1783
1805
|
operation: z.unknown(),
|
|
1784
|
-
warnings: z.array(gatewayVideoWarningSchema())
|
|
1785
|
-
providerMetadata: z.record(z.string(), providerMetadataEntrySchema$2())
|
|
1806
|
+
warnings: z.nullish(z.array(gatewayVideoWarningSchema())),
|
|
1807
|
+
providerMetadata: z.nullish(z.record(z.string(), providerMetadataEntrySchema$2()))
|
|
1786
1808
|
})));
|
|
1787
1809
|
const gatewayVideoStatusResponseSchema = lazySchema(() => zodSchema(z.discriminatedUnion("status", [
|
|
1788
1810
|
z.object({
|
|
1789
1811
|
status: z.literal("pending"),
|
|
1790
|
-
warnings: z.array(gatewayVideoWarningSchema())
|
|
1791
|
-
providerMetadata: z.record(z.string(), providerMetadataEntrySchema$2())
|
|
1812
|
+
warnings: z.nullish(z.array(gatewayVideoWarningSchema())),
|
|
1813
|
+
providerMetadata: z.nullish(z.record(z.string(), providerMetadataEntrySchema$2()))
|
|
1792
1814
|
}),
|
|
1793
1815
|
z.object({
|
|
1794
1816
|
status: z.literal("completed"),
|
|
1795
1817
|
videos: z.array(gatewayVideoDataSchema()),
|
|
1796
|
-
warnings: z.array(gatewayVideoWarningSchema())
|
|
1797
|
-
providerMetadata: z.record(z.string(), providerMetadataEntrySchema$2())
|
|
1818
|
+
warnings: z.nullish(z.array(gatewayVideoWarningSchema())),
|
|
1819
|
+
providerMetadata: z.nullish(z.record(z.string(), providerMetadataEntrySchema$2()))
|
|
1798
1820
|
}),
|
|
1799
1821
|
z.object({
|
|
1800
1822
|
status: z.literal("error"),
|
|
1801
1823
|
error: z.string(),
|
|
1802
|
-
providerMetadata: z.record(z.string(), providerMetadataEntrySchema$2())
|
|
1824
|
+
providerMetadata: z.nullish(z.record(z.string(), providerMetadataEntrySchema$2()))
|
|
1803
1825
|
}),
|
|
1804
1826
|
z.object({
|
|
1805
1827
|
status: z.literal("cancelled"),
|
|
1806
|
-
providerMetadata: z.record(z.string(), providerMetadataEntrySchema$2())
|
|
1828
|
+
providerMetadata: z.nullish(z.record(z.string(), providerMetadataEntrySchema$2()))
|
|
1807
1829
|
})
|
|
1808
1830
|
])));
|
|
1809
|
-
const gatewayDecisionProviderOptionsSchema = lazySchema(() => zodSchema(z.object({ models:
|
|
1810
|
-
const probabilitySchema = () => z.number().
|
|
1811
|
-
const questionSchema = () => z.string().
|
|
1812
|
-
const directConditionSchema = () => z.union([z.object({
|
|
1813
|
-
question:
|
|
1831
|
+
const gatewayDecisionProviderOptionsSchema = lazySchema(() => zodSchema(z.catchall(z.object({ models: z.optional(gatewayModelFallbacksSchema()) }), z.unknown())));
|
|
1832
|
+
const probabilitySchema = () => z.number().check(z.minimum(0)).check(z.maximum(1));
|
|
1833
|
+
const questionSchema = () => z.string().check(z.minLength(1)).check(z.maxLength(256));
|
|
1834
|
+
const directConditionSchema = () => z.union([z.catchall(z.object({
|
|
1835
|
+
question: z.optional(questionSchema()),
|
|
1814
1836
|
confidenceBelow: probabilitySchema()
|
|
1815
|
-
}).
|
|
1816
|
-
question:
|
|
1817
|
-
probabilityBetween: z.array(probabilitySchema()).length(2).refine(([minimum, maximum]) => minimum <= maximum, { message: "probabilityBetween minimum must be less than or equal to maximum" })
|
|
1818
|
-
}).
|
|
1837
|
+
}), z.never()), z.catchall(z.object({
|
|
1838
|
+
question: z.optional(questionSchema()),
|
|
1839
|
+
probabilityBetween: z.array(probabilitySchema()).check(z.length(2)).check(z.refine(([minimum, maximum]) => minimum <= maximum, { message: "probabilityBetween minimum must be less than or equal to maximum" }))
|
|
1840
|
+
}), z.never())]);
|
|
1819
1841
|
const groupBeyondMaxDepthSchema = () => z.union([
|
|
1820
1842
|
z.object({ any: z.unknown() }),
|
|
1821
1843
|
z.object({ all: z.unknown() }),
|
|
1822
1844
|
z.object({ atLeast: z.unknown() })
|
|
1823
|
-
]).
|
|
1824
|
-
context.
|
|
1845
|
+
]).check((context) => {
|
|
1846
|
+
context.issues.push({
|
|
1847
|
+
input: context.value,
|
|
1848
|
+
continue: true,
|
|
1825
1849
|
code: "custom",
|
|
1826
1850
|
message: `conditions can be nested at most 5 levels deep`
|
|
1827
1851
|
});
|
|
1828
1852
|
});
|
|
1829
|
-
const conditionalModelFallbackSchema = () => z.object({
|
|
1830
|
-
model: z.string().
|
|
1853
|
+
const conditionalModelFallbackSchema = () => z.catchall(z.object({
|
|
1854
|
+
model: z.string().check(z.minLength(1)),
|
|
1831
1855
|
when: conditionSchema(1)
|
|
1832
|
-
}).
|
|
1833
|
-
const gatewayModelFallbacksSchema = () => z.array(z.union([z.string(), conditionalModelFallbackSchema()])).
|
|
1834
|
-
const conditionalIndexes =
|
|
1835
|
-
if (conditionalIndexes.length > 1) context.
|
|
1856
|
+
}), z.never());
|
|
1857
|
+
const gatewayModelFallbacksSchema = () => z.array(z.union([z.string(), conditionalModelFallbackSchema()])).check((context) => {
|
|
1858
|
+
const conditionalIndexes = context.value.flatMap((entry, index) => typeof entry === "string" ? [] : [index]);
|
|
1859
|
+
if (conditionalIndexes.length > 1) context.issues.push({
|
|
1860
|
+
input: context.value,
|
|
1861
|
+
continue: true,
|
|
1836
1862
|
code: "custom",
|
|
1837
1863
|
message: "models supports at most one conditional decision fallback"
|
|
1838
1864
|
});
|
|
1839
|
-
if (conditionalIndexes[0] !== void 0 && conditionalIndexes[0] !== 0) context.
|
|
1865
|
+
if (conditionalIndexes[0] !== void 0 && conditionalIndexes[0] !== 0) context.issues.push({
|
|
1866
|
+
input: context.value,
|
|
1867
|
+
continue: true,
|
|
1840
1868
|
code: "custom",
|
|
1841
1869
|
message: "a conditional decision fallback must be the first models entry",
|
|
1842
1870
|
path: [conditionalIndexes[0]]
|
|
@@ -1845,18 +1873,18 @@ const gatewayModelFallbacksSchema = () => z.array(z.union([z.string(), condition
|
|
|
1845
1873
|
function conditionSchema(depth) {
|
|
1846
1874
|
if (depth === 5) return z.union([directConditionSchema(), groupBeyondMaxDepthSchema()]);
|
|
1847
1875
|
const childConditionSchema = conditionSchema(depth + 1);
|
|
1848
|
-
const conditionListSchema = z.array(childConditionSchema).
|
|
1876
|
+
const conditionListSchema = z.array(childConditionSchema).check(z.minLength(1)).check(z.maxLength(20));
|
|
1849
1877
|
return z.union([
|
|
1850
1878
|
directConditionSchema(),
|
|
1851
|
-
z.object({ any: conditionListSchema }).
|
|
1852
|
-
z.object({ all: conditionListSchema }).
|
|
1853
|
-
z.object({ atLeast: z.object({
|
|
1854
|
-
count: z.number().int().
|
|
1879
|
+
z.catchall(z.object({ any: conditionListSchema }), z.never()),
|
|
1880
|
+
z.catchall(z.object({ all: conditionListSchema }), z.never()),
|
|
1881
|
+
z.catchall(z.object({ atLeast: z.catchall(z.object({
|
|
1882
|
+
count: z.number().check(z.int()).check(z.minimum(1)),
|
|
1855
1883
|
conditions: conditionListSchema
|
|
1856
|
-
}).
|
|
1884
|
+
}), z.never()).check(z.refine(({ count, conditions }) => count <= conditions.length, {
|
|
1857
1885
|
message: "atLeast count cannot exceed the number of conditions",
|
|
1858
1886
|
path: ["count"]
|
|
1859
|
-
}) }).
|
|
1887
|
+
})) }), z.never())
|
|
1860
1888
|
]);
|
|
1861
1889
|
}
|
|
1862
1890
|
//#endregion
|
|
@@ -1940,12 +1968,12 @@ const gatewayDecisionAnswerSchema = () => z.discriminatedUnion("type", [
|
|
|
1940
1968
|
z.object({
|
|
1941
1969
|
type: z.literal("choice"),
|
|
1942
1970
|
choice: z.string(),
|
|
1943
|
-
probabilities: z.record(z.string(), z.number())
|
|
1971
|
+
probabilities: z.optional(z.record(z.string(), z.number()))
|
|
1944
1972
|
}),
|
|
1945
1973
|
z.object({
|
|
1946
1974
|
type: z.literal("score"),
|
|
1947
1975
|
score: z.number(),
|
|
1948
|
-
probabilities: z.record(z.string(), z.number())
|
|
1976
|
+
probabilities: z.optional(z.record(z.string(), z.number()))
|
|
1949
1977
|
}),
|
|
1950
1978
|
z.object({
|
|
1951
1979
|
type: z.literal("boolean"),
|
|
@@ -1957,12 +1985,12 @@ const gatewayDecisionWarningSchema = () => z.discriminatedUnion("type", [
|
|
|
1957
1985
|
z.object({
|
|
1958
1986
|
type: z.literal("unsupported"),
|
|
1959
1987
|
feature: z.string(),
|
|
1960
|
-
details: z.
|
|
1988
|
+
details: z.optional(z.string())
|
|
1961
1989
|
}),
|
|
1962
1990
|
z.object({
|
|
1963
1991
|
type: z.literal("compatibility"),
|
|
1964
1992
|
feature: z.string(),
|
|
1965
|
-
details: z.
|
|
1993
|
+
details: z.optional(z.string())
|
|
1966
1994
|
}),
|
|
1967
1995
|
z.object({
|
|
1968
1996
|
type: z.literal("deprecated"),
|
|
@@ -1976,17 +2004,17 @@ const gatewayDecisionWarningSchema = () => z.discriminatedUnion("type", [
|
|
|
1976
2004
|
]);
|
|
1977
2005
|
const gatewayDecisionResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
1978
2006
|
answers: z.record(z.string(), gatewayDecisionAnswerSchema()),
|
|
1979
|
-
model: z.
|
|
1980
|
-
rounding: z.object({
|
|
1981
|
-
probabilityDecimals: z.
|
|
1982
|
-
scoreDecimals: z.
|
|
1983
|
-
})
|
|
1984
|
-
usage: z.object({
|
|
1985
|
-
inputTokens: z.
|
|
1986
|
-
outputTokens: z.
|
|
1987
|
-
})
|
|
1988
|
-
warnings: z.array(gatewayDecisionWarningSchema())
|
|
1989
|
-
providerMetadata: z.record(z.string(), z.record(z.string(), z.unknown()))
|
|
2007
|
+
model: z.optional(z.string()),
|
|
2008
|
+
rounding: z.optional(z.object({
|
|
2009
|
+
probabilityDecimals: z.optional(z.number()),
|
|
2010
|
+
scoreDecimals: z.optional(z.number())
|
|
2011
|
+
})),
|
|
2012
|
+
usage: z.optional(z.object({
|
|
2013
|
+
inputTokens: z.optional(z.number()),
|
|
2014
|
+
outputTokens: z.optional(z.number())
|
|
2015
|
+
})),
|
|
2016
|
+
warnings: z.optional(z.array(gatewayDecisionWarningSchema())),
|
|
2017
|
+
providerMetadata: z.optional(z.record(z.string(), z.record(z.string(), z.unknown())))
|
|
1990
2018
|
})));
|
|
1991
2019
|
function toGatewayDecisionState(state) {
|
|
1992
2020
|
return state.map((part) => {
|
|
@@ -2060,12 +2088,12 @@ const gatewayRerankingWarningSchema = () => z.discriminatedUnion("type", [
|
|
|
2060
2088
|
z.object({
|
|
2061
2089
|
type: z.literal("unsupported"),
|
|
2062
2090
|
feature: z.string(),
|
|
2063
|
-
details: z.
|
|
2091
|
+
details: z.optional(z.string())
|
|
2064
2092
|
}),
|
|
2065
2093
|
z.object({
|
|
2066
2094
|
type: z.literal("compatibility"),
|
|
2067
2095
|
feature: z.string(),
|
|
2068
|
-
details: z.
|
|
2096
|
+
details: z.optional(z.string())
|
|
2069
2097
|
}),
|
|
2070
2098
|
z.object({
|
|
2071
2099
|
type: z.literal("deprecated"),
|
|
@@ -2082,8 +2110,8 @@ const gatewayRerankingResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
|
2082
2110
|
index: z.number(),
|
|
2083
2111
|
relevanceScore: z.number()
|
|
2084
2112
|
})),
|
|
2085
|
-
warnings: z.array(gatewayRerankingWarningSchema())
|
|
2086
|
-
providerMetadata: z.record(z.string(), z.record(z.string(), z.unknown()))
|
|
2113
|
+
warnings: z.optional(z.array(gatewayRerankingWarningSchema())),
|
|
2114
|
+
providerMetadata: z.optional(z.record(z.string(), z.record(z.string(), z.unknown())))
|
|
2087
2115
|
})));
|
|
2088
2116
|
//#endregion
|
|
2089
2117
|
//#region src/gateway-stream-errors.ts
|
|
@@ -2365,17 +2393,17 @@ function createGatewayTranscriptionStream({ webSocket, url, protocols, headers,
|
|
|
2365
2393
|
}
|
|
2366
2394
|
});
|
|
2367
2395
|
}
|
|
2368
|
-
const providerMetadataEntrySchema$1 = () => z.object({})
|
|
2396
|
+
const providerMetadataEntrySchema$1 = () => z.catchall(z.object({}), z.unknown());
|
|
2369
2397
|
const gatewayTranscriptionWarningSchema = () => z.discriminatedUnion("type", [
|
|
2370
2398
|
z.object({
|
|
2371
2399
|
type: z.literal("unsupported"),
|
|
2372
2400
|
feature: z.string(),
|
|
2373
|
-
details: z.
|
|
2401
|
+
details: z.optional(z.string())
|
|
2374
2402
|
}),
|
|
2375
2403
|
z.object({
|
|
2376
2404
|
type: z.literal("compatibility"),
|
|
2377
2405
|
feature: z.string(),
|
|
2378
|
-
details: z.
|
|
2406
|
+
details: z.optional(z.string())
|
|
2379
2407
|
}),
|
|
2380
2408
|
z.object({
|
|
2381
2409
|
type: z.literal("deprecated"),
|
|
@@ -2389,21 +2417,21 @@ const gatewayTranscriptionWarningSchema = () => z.discriminatedUnion("type", [
|
|
|
2389
2417
|
]);
|
|
2390
2418
|
const gatewayTranscriptionResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
2391
2419
|
text: z.string(),
|
|
2392
|
-
segments: z.array(z.object({
|
|
2420
|
+
segments: z.optional(z.array(z.object({
|
|
2393
2421
|
text: z.string(),
|
|
2394
2422
|
startSecond: z.number(),
|
|
2395
2423
|
endSecond: z.number()
|
|
2396
|
-
}))
|
|
2397
|
-
words: z.array(z.object({
|
|
2424
|
+
}))),
|
|
2425
|
+
words: z.nullish(z.array(z.object({
|
|
2398
2426
|
text: z.string(),
|
|
2399
2427
|
startSecond: z.number(),
|
|
2400
2428
|
endSecond: z.number()
|
|
2401
|
-
}))
|
|
2402
|
-
language: z.
|
|
2403
|
-
durationInSeconds: z.
|
|
2404
|
-
warnings: z.array(gatewayTranscriptionWarningSchema())
|
|
2405
|
-
usage: z.record(z.string(), z.json())
|
|
2406
|
-
providerMetadata: z.record(z.string(), providerMetadataEntrySchema$1())
|
|
2429
|
+
}))),
|
|
2430
|
+
language: z.nullish(z.string()),
|
|
2431
|
+
durationInSeconds: z.nullish(z.number()),
|
|
2432
|
+
warnings: z.optional(z.array(gatewayTranscriptionWarningSchema())),
|
|
2433
|
+
usage: z.optional(z.record(z.string(), z.json())),
|
|
2434
|
+
providerMetadata: z.optional(z.record(z.string(), providerMetadataEntrySchema$1()))
|
|
2407
2435
|
})));
|
|
2408
2436
|
//#endregion
|
|
2409
2437
|
//#region src/gateway-speech-model.ts
|
|
@@ -2643,17 +2671,17 @@ function createGatewaySpeechStream({ webSocket, url, protocols, headers, startFr
|
|
|
2643
2671
|
}
|
|
2644
2672
|
});
|
|
2645
2673
|
}
|
|
2646
|
-
const providerMetadataEntrySchema = () => z.object({})
|
|
2674
|
+
const providerMetadataEntrySchema = () => z.catchall(z.object({}), z.unknown());
|
|
2647
2675
|
const gatewaySpeechWarningSchema = () => z.discriminatedUnion("type", [
|
|
2648
2676
|
z.object({
|
|
2649
2677
|
type: z.literal("unsupported"),
|
|
2650
2678
|
feature: z.string(),
|
|
2651
|
-
details: z.
|
|
2679
|
+
details: z.optional(z.string())
|
|
2652
2680
|
}),
|
|
2653
2681
|
z.object({
|
|
2654
2682
|
type: z.literal("compatibility"),
|
|
2655
2683
|
feature: z.string(),
|
|
2656
|
-
details: z.
|
|
2684
|
+
details: z.optional(z.string())
|
|
2657
2685
|
}),
|
|
2658
2686
|
z.object({
|
|
2659
2687
|
type: z.literal("deprecated"),
|
|
@@ -2667,9 +2695,9 @@ const gatewaySpeechWarningSchema = () => z.discriminatedUnion("type", [
|
|
|
2667
2695
|
]);
|
|
2668
2696
|
const gatewaySpeechResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
2669
2697
|
audio: z.string(),
|
|
2670
|
-
warnings: z.array(gatewaySpeechWarningSchema())
|
|
2671
|
-
usage: z.record(z.string(), z.json())
|
|
2672
|
-
providerMetadata: z.record(z.string(), providerMetadataEntrySchema())
|
|
2698
|
+
warnings: z.optional(z.array(gatewaySpeechWarningSchema())),
|
|
2699
|
+
usage: z.optional(z.record(z.string(), z.json())),
|
|
2700
|
+
providerMetadata: z.optional(z.record(z.string(), providerMetadataEntrySchema()))
|
|
2673
2701
|
})));
|
|
2674
2702
|
//#endregion
|
|
2675
2703
|
//#region src/gateway-realtime-model.ts
|
|
@@ -2761,16 +2789,16 @@ function toGatewayRealtimeUrl(baseURL, modelId) {
|
|
|
2761
2789
|
//#region src/tool/browserbase-fetch.ts
|
|
2762
2790
|
const jsonObjectSchema = () => z.record(z.string(), z.unknown());
|
|
2763
2791
|
const browserbaseFetchInputSchema = lazySchema(() => zodSchema(z.object({
|
|
2764
|
-
url: z.
|
|
2765
|
-
allow_redirects: z.
|
|
2766
|
-
allow_insecure_ssl: z.
|
|
2767
|
-
proxies: z.
|
|
2768
|
-
format: z.enum([
|
|
2792
|
+
url: z.describe(z.url(), "URL of the page to fetch."),
|
|
2793
|
+
allow_redirects: z.describe(z.optional(z.boolean()), "Whether to follow HTTP redirects (default: false)."),
|
|
2794
|
+
allow_insecure_ssl: z.describe(z.optional(z.boolean()), "Whether to bypass TLS certificate verification (default: false). Only use for trusted hosts."),
|
|
2795
|
+
proxies: z.describe(z.optional(z.boolean()), "Whether to route the request through Browserbase proxies (default: false)."),
|
|
2796
|
+
format: z.describe(z.optional(z.enum([
|
|
2769
2797
|
"raw",
|
|
2770
2798
|
"json",
|
|
2771
2799
|
"markdown"
|
|
2772
|
-
])
|
|
2773
|
-
schema:
|
|
2800
|
+
])), "Output format. raw returns the response body unchanged, markdown returns page content as Markdown, and json returns structured content using schema."),
|
|
2801
|
+
schema: z.describe(z.optional(jsonObjectSchema()), "JSON Schema for structured extraction. Only use with format set to json.")
|
|
2774
2802
|
})));
|
|
2775
2803
|
const browserbaseFetchOutputSchema = lazySchema(() => zodSchema(z.union([z.object({
|
|
2776
2804
|
id: z.string(),
|
|
@@ -2789,7 +2817,7 @@ const browserbaseFetchOutputSchema = lazySchema(() => zodSchema(z.union([z.objec
|
|
|
2789
2817
|
"timeout",
|
|
2790
2818
|
"unknown"
|
|
2791
2819
|
]),
|
|
2792
|
-
statusCode: z.
|
|
2820
|
+
statusCode: z.optional(z.number()),
|
|
2793
2821
|
message: z.string()
|
|
2794
2822
|
})])));
|
|
2795
2823
|
const browserbaseFetchToolFactory = createProviderExecutedToolFactory({
|
|
@@ -2801,8 +2829,8 @@ const browserbaseFetch = (config = {}) => browserbaseFetchToolFactory(config);
|
|
|
2801
2829
|
//#endregion
|
|
2802
2830
|
//#region src/tool/browserbase-search.ts
|
|
2803
2831
|
const browserbaseSearchInputSchema = lazySchema(() => zodSchema(z.object({
|
|
2804
|
-
query: z.string().
|
|
2805
|
-
num_results: z.number().int().
|
|
2832
|
+
query: z.describe(z.string().check(z.minLength(1)).check(z.maxLength(200)), "Web search query. Must be between 1 and 200 characters."),
|
|
2833
|
+
num_results: z.describe(z.optional(z.number().check(z.int()).check(z.minimum(1)).check(z.maximum(25))), "Maximum number of results to return (1-25, default: 10).")
|
|
2806
2834
|
})));
|
|
2807
2835
|
const browserbaseSearchOutputSchema = lazySchema(() => zodSchema(z.union([z.object({
|
|
2808
2836
|
query: z.string(),
|
|
@@ -2811,10 +2839,10 @@ const browserbaseSearchOutputSchema = lazySchema(() => zodSchema(z.union([z.obje
|
|
|
2811
2839
|
id: z.string(),
|
|
2812
2840
|
title: z.string(),
|
|
2813
2841
|
url: z.string(),
|
|
2814
|
-
author: z.
|
|
2815
|
-
favicon: z.
|
|
2816
|
-
image: z.
|
|
2817
|
-
publishedDate: z.
|
|
2842
|
+
author: z.optional(z.string()),
|
|
2843
|
+
favicon: z.optional(z.string()),
|
|
2844
|
+
image: z.optional(z.string()),
|
|
2845
|
+
publishedDate: z.optional(z.string())
|
|
2818
2846
|
}))
|
|
2819
2847
|
}), z.object({
|
|
2820
2848
|
error: z.enum([
|
|
@@ -2826,7 +2854,7 @@ const browserbaseSearchOutputSchema = lazySchema(() => zodSchema(z.union([z.obje
|
|
|
2826
2854
|
"timeout",
|
|
2827
2855
|
"unknown"
|
|
2828
2856
|
]),
|
|
2829
|
-
statusCode: z.
|
|
2857
|
+
statusCode: z.optional(z.number()),
|
|
2830
2858
|
message: z.string()
|
|
2831
2859
|
})])));
|
|
2832
2860
|
const browserbaseSearchToolFactory = createProviderExecutedToolFactory({
|
|
@@ -2837,7 +2865,7 @@ const browserbaseSearchToolFactory = createProviderExecutedToolFactory({
|
|
|
2837
2865
|
const browserbaseSearch = (config = {}) => browserbaseSearchToolFactory(config);
|
|
2838
2866
|
//#endregion
|
|
2839
2867
|
//#region src/tool/gateway-tool-error.ts
|
|
2840
|
-
const gatewayToolErrorSchema = () => z.object({
|
|
2868
|
+
const gatewayToolErrorSchema = () => z.catchall(z.object({
|
|
2841
2869
|
error: z.enum([
|
|
2842
2870
|
"api_error",
|
|
2843
2871
|
"configuration_error",
|
|
@@ -2850,17 +2878,17 @@ const gatewayToolErrorSchema = () => z.object({
|
|
|
2850
2878
|
"unknown_tool"
|
|
2851
2879
|
]),
|
|
2852
2880
|
message: z.string(),
|
|
2853
|
-
statusCode: z.
|
|
2854
|
-
retryAfter: z.
|
|
2855
|
-
statusText: z.
|
|
2856
|
-
}).
|
|
2881
|
+
statusCode: z.optional(z.number()),
|
|
2882
|
+
retryAfter: z.optional(z.string()),
|
|
2883
|
+
statusText: z.optional(z.string())
|
|
2884
|
+
}), z.unknown());
|
|
2857
2885
|
//#endregion
|
|
2858
2886
|
//#region src/tool/deepseek-fetch.ts
|
|
2859
|
-
const deepseekFetchInputSchema = lazySchema(() => zodSchema(z.object({ url: z.string()
|
|
2860
|
-
const deepseekFetchOutputSchema = lazySchema(() => zodSchema(z.union([z.object({
|
|
2861
|
-
title: z.
|
|
2887
|
+
const deepseekFetchInputSchema = lazySchema(() => zodSchema(z.object({ url: z.describe(z.string(), "URL to fetch, at most 8192 characters; HTTP(S) only, without a username or password.") })));
|
|
2888
|
+
const deepseekFetchOutputSchema = lazySchema(() => zodSchema(z.union([z.catchall(z.object({
|
|
2889
|
+
title: z.nullish(z.string()),
|
|
2862
2890
|
content: z.string()
|
|
2863
|
-
}).
|
|
2891
|
+
}), z.unknown()), gatewayToolErrorSchema()])));
|
|
2864
2892
|
const deepseekFetchToolFactory = createProviderExecutedToolFactory({
|
|
2865
2893
|
id: "gateway.deepseek_fetch",
|
|
2866
2894
|
inputSchema: deepseekFetchInputSchema,
|
|
@@ -2870,23 +2898,23 @@ const deepseekFetch = (config = {}) => deepseekFetchToolFactory(config);
|
|
|
2870
2898
|
//#endregion
|
|
2871
2899
|
//#region src/tool/deepseek-search.ts
|
|
2872
2900
|
const deepseekSearchInputSchema = lazySchema(() => zodSchema(z.object({
|
|
2873
|
-
query: z.string()
|
|
2874
|
-
count: z.number().
|
|
2875
|
-
need_content: z.
|
|
2876
|
-
ori_question: z.
|
|
2901
|
+
query: z.describe(z.string(), "Web search query, 1 to 128 Unicode characters. Supports site:, -site:, lang:, after:, before:, and quoted phrases."),
|
|
2902
|
+
count: z.describe(z.optional(z.number().check(z.int())), "Number of results, 1 to 50 (default: 10)."),
|
|
2903
|
+
need_content: z.describe(z.optional(z.boolean()), "Include available page content (default: false)."),
|
|
2904
|
+
ori_question: z.describe(z.optional(z.nullable(z.string())), "Original user question, 1 to 128 Unicode characters.")
|
|
2877
2905
|
})));
|
|
2878
|
-
const deepseekSearchOutputSchema = lazySchema(() => zodSchema(z.union([z.object({ results: z.array(z.object({
|
|
2879
|
-
authority: z.
|
|
2880
|
-
content: z.
|
|
2881
|
-
date: z.
|
|
2882
|
-
rerank_score: z.
|
|
2883
|
-
site_icon: z.
|
|
2884
|
-
site_name: z.
|
|
2885
|
-
snippet: z.
|
|
2886
|
-
summary: z.
|
|
2887
|
-
title: z.
|
|
2888
|
-
url: z.
|
|
2889
|
-
}).
|
|
2906
|
+
const deepseekSearchOutputSchema = lazySchema(() => zodSchema(z.union([z.catchall(z.object({ results: z.array(z.catchall(z.object({
|
|
2907
|
+
authority: z.nullish(z.number()),
|
|
2908
|
+
content: z.nullish(z.string()),
|
|
2909
|
+
date: z.nullish(z.string()),
|
|
2910
|
+
rerank_score: z.nullish(z.number()),
|
|
2911
|
+
site_icon: z.nullish(z.string()),
|
|
2912
|
+
site_name: z.nullish(z.string()),
|
|
2913
|
+
snippet: z.nullish(z.string()),
|
|
2914
|
+
summary: z.nullish(z.string()),
|
|
2915
|
+
title: z.nullish(z.string()),
|
|
2916
|
+
url: z.nullish(z.string())
|
|
2917
|
+
}), z.unknown())) }), z.unknown()), gatewayToolErrorSchema()])));
|
|
2890
2918
|
const deepseekSearchToolFactory = createProviderExecutedToolFactory({
|
|
2891
2919
|
id: "gateway.deepseek_search",
|
|
2892
2920
|
inputSchema: deepseekSearchInputSchema,
|
|
@@ -2896,36 +2924,36 @@ const deepseekSearch = (config = {}) => deepseekSearchToolFactory(config);
|
|
|
2896
2924
|
//#endregion
|
|
2897
2925
|
//#region src/tool/exa-search.ts
|
|
2898
2926
|
const exaSearchInputSchema = lazySchema(() => zodSchema(z.object({
|
|
2899
|
-
query: z.string()
|
|
2900
|
-
type: z.enum([
|
|
2927
|
+
query: z.describe(z.string(), "Natural-language web search query. This is required."),
|
|
2928
|
+
type: z.describe(z.optional(z.enum([
|
|
2901
2929
|
"auto",
|
|
2902
2930
|
"fast",
|
|
2903
2931
|
"instant"
|
|
2904
|
-
])
|
|
2905
|
-
num_results: z.
|
|
2906
|
-
category: z.enum([
|
|
2932
|
+
])), "Search method. Use auto for the default balance of speed and quality."),
|
|
2933
|
+
num_results: z.describe(z.optional(z.number()), "Maximum number of results to return (1-100, default: 10)."),
|
|
2934
|
+
category: z.describe(z.optional(z.enum([
|
|
2907
2935
|
"company",
|
|
2908
2936
|
"people",
|
|
2909
2937
|
"research paper",
|
|
2910
2938
|
"news",
|
|
2911
2939
|
"personal site",
|
|
2912
2940
|
"financial report"
|
|
2913
|
-
])
|
|
2914
|
-
user_location: z.
|
|
2915
|
-
include_domains: z.array(z.string())
|
|
2916
|
-
exclude_domains: z.array(z.string())
|
|
2917
|
-
start_published_date: z.
|
|
2918
|
-
end_published_date: z.
|
|
2919
|
-
contents: z.object({
|
|
2920
|
-
text: z.union([z.boolean(), z.object({
|
|
2921
|
-
max_characters: z.
|
|
2922
|
-
include_html_tags: z.
|
|
2923
|
-
verbosity: z.enum([
|
|
2941
|
+
])), "Optional content category to focus results."),
|
|
2942
|
+
user_location: z.describe(z.optional(z.string()), "Two-letter ISO country code such as 'US'."),
|
|
2943
|
+
include_domains: z.describe(z.optional(z.array(z.string())), "Only return results from these domains."),
|
|
2944
|
+
exclude_domains: z.describe(z.optional(z.array(z.string())), "Exclude results from these domains."),
|
|
2945
|
+
start_published_date: z.describe(z.optional(z.string()), "Only return links published after this ISO 8601 date."),
|
|
2946
|
+
end_published_date: z.describe(z.optional(z.string()), "Only return links published before this ISO 8601 date."),
|
|
2947
|
+
contents: z.describe(z.optional(z.object({
|
|
2948
|
+
text: z.optional(z.union([z.boolean(), z.object({
|
|
2949
|
+
max_characters: z.optional(z.number()),
|
|
2950
|
+
include_html_tags: z.optional(z.boolean()),
|
|
2951
|
+
verbosity: z.optional(z.enum([
|
|
2924
2952
|
"compact",
|
|
2925
2953
|
"standard",
|
|
2926
2954
|
"full"
|
|
2927
|
-
])
|
|
2928
|
-
include_sections: z.array(z.enum([
|
|
2955
|
+
])),
|
|
2956
|
+
include_sections: z.optional(z.array(z.enum([
|
|
2929
2957
|
"header",
|
|
2930
2958
|
"navigation",
|
|
2931
2959
|
"banner",
|
|
@@ -2933,8 +2961,8 @@ const exaSearchInputSchema = lazySchema(() => zodSchema(z.object({
|
|
|
2933
2961
|
"sidebar",
|
|
2934
2962
|
"footer",
|
|
2935
2963
|
"metadata"
|
|
2936
|
-
]))
|
|
2937
|
-
exclude_sections: z.array(z.enum([
|
|
2964
|
+
]))),
|
|
2965
|
+
exclude_sections: z.optional(z.array(z.enum([
|
|
2938
2966
|
"header",
|
|
2939
2967
|
"navigation",
|
|
2940
2968
|
"banner",
|
|
@@ -2942,48 +2970,48 @@ const exaSearchInputSchema = lazySchema(() => zodSchema(z.object({
|
|
|
2942
2970
|
"sidebar",
|
|
2943
2971
|
"footer",
|
|
2944
2972
|
"metadata"
|
|
2945
|
-
]))
|
|
2946
|
-
})])
|
|
2947
|
-
highlights: z.union([z.boolean(), z.object({
|
|
2948
|
-
query: z.
|
|
2949
|
-
max_characters: z.
|
|
2950
|
-
})])
|
|
2951
|
-
max_age_hours: z.
|
|
2952
|
-
livecrawl_timeout: z.
|
|
2953
|
-
subpages: z.
|
|
2954
|
-
subpage_target: z.union([z.string(), z.array(z.string())])
|
|
2955
|
-
extras: z.object({
|
|
2956
|
-
links: z.
|
|
2957
|
-
image_links: z.
|
|
2958
|
-
})
|
|
2959
|
-
})
|
|
2973
|
+
])))
|
|
2974
|
+
})])),
|
|
2975
|
+
highlights: z.optional(z.union([z.boolean(), z.object({
|
|
2976
|
+
query: z.optional(z.string()),
|
|
2977
|
+
max_characters: z.optional(z.number())
|
|
2978
|
+
})])),
|
|
2979
|
+
max_age_hours: z.optional(z.number()),
|
|
2980
|
+
livecrawl_timeout: z.optional(z.number()),
|
|
2981
|
+
subpages: z.optional(z.number()),
|
|
2982
|
+
subpage_target: z.optional(z.union([z.string(), z.array(z.string())])),
|
|
2983
|
+
extras: z.optional(z.object({
|
|
2984
|
+
links: z.optional(z.number()),
|
|
2985
|
+
image_links: z.optional(z.number())
|
|
2986
|
+
}))
|
|
2987
|
+
})), "Controls extracted page content and freshness.")
|
|
2960
2988
|
})));
|
|
2961
2989
|
const exaSearchOutputSchema = lazySchema(() => zodSchema(z.union([z.object({
|
|
2962
2990
|
requestId: z.string(),
|
|
2963
|
-
searchType: z.
|
|
2964
|
-
resolvedSearchType: z.
|
|
2991
|
+
searchType: z.optional(z.string()),
|
|
2992
|
+
resolvedSearchType: z.optional(z.string()),
|
|
2965
2993
|
results: z.array(z.object({
|
|
2966
2994
|
title: z.string(),
|
|
2967
2995
|
url: z.string(),
|
|
2968
2996
|
id: z.string(),
|
|
2969
|
-
publishedDate: z.
|
|
2970
|
-
author: z.
|
|
2971
|
-
image: z.
|
|
2972
|
-
favicon: z.
|
|
2973
|
-
text: z.
|
|
2974
|
-
highlights: z.array(z.string())
|
|
2975
|
-
highlightScores: z.array(z.number())
|
|
2976
|
-
summary: z.
|
|
2977
|
-
subpages: z.array(z.any())
|
|
2978
|
-
extras: z.object({
|
|
2979
|
-
links: z.array(z.string())
|
|
2980
|
-
imageLinks: z.array(z.string())
|
|
2981
|
-
})
|
|
2997
|
+
publishedDate: z.optional(z.nullable(z.string())),
|
|
2998
|
+
author: z.optional(z.nullable(z.string())),
|
|
2999
|
+
image: z.optional(z.nullable(z.string())),
|
|
3000
|
+
favicon: z.optional(z.nullable(z.string())),
|
|
3001
|
+
text: z.optional(z.string()),
|
|
3002
|
+
highlights: z.optional(z.array(z.string())),
|
|
3003
|
+
highlightScores: z.optional(z.array(z.number())),
|
|
3004
|
+
summary: z.optional(z.string()),
|
|
3005
|
+
subpages: z.optional(z.array(z.any())),
|
|
3006
|
+
extras: z.optional(z.object({
|
|
3007
|
+
links: z.optional(z.array(z.string())),
|
|
3008
|
+
imageLinks: z.optional(z.array(z.string()))
|
|
3009
|
+
}))
|
|
2982
3010
|
})),
|
|
2983
|
-
costDollars: z.object({
|
|
2984
|
-
total: z.
|
|
2985
|
-
search: z.record(z.string(), z.number())
|
|
2986
|
-
})
|
|
3011
|
+
costDollars: z.optional(z.object({
|
|
3012
|
+
total: z.optional(z.number()),
|
|
3013
|
+
search: z.optional(z.record(z.string(), z.number()))
|
|
3014
|
+
}))
|
|
2987
3015
|
}), z.object({
|
|
2988
3016
|
error: z.enum([
|
|
2989
3017
|
"api_error",
|
|
@@ -2994,7 +3022,7 @@ const exaSearchOutputSchema = lazySchema(() => zodSchema(z.union([z.object({
|
|
|
2994
3022
|
"execution_error",
|
|
2995
3023
|
"unknown"
|
|
2996
3024
|
]),
|
|
2997
|
-
statusCode: z.
|
|
3025
|
+
statusCode: z.optional(z.number()),
|
|
2998
3026
|
message: z.string()
|
|
2999
3027
|
})])));
|
|
3000
3028
|
const exaSearchToolFactory = createProviderExecutedToolFactory({
|
|
@@ -3014,45 +3042,45 @@ const parallelSearchModes = [
|
|
|
3014
3042
|
"agentic"
|
|
3015
3043
|
];
|
|
3016
3044
|
const parallelSearchInputSchema = lazySchema(() => zodSchema(z.object({
|
|
3017
|
-
objective: z.string()
|
|
3018
|
-
search_queries: z.array(z.string())
|
|
3019
|
-
mode: z.
|
|
3020
|
-
max_results: z.
|
|
3021
|
-
source_policy: z.object({
|
|
3022
|
-
include_domains: z.array(z.string())
|
|
3023
|
-
exclude_domains: z.array(z.string())
|
|
3024
|
-
after_date: z.
|
|
3025
|
-
})
|
|
3026
|
-
excerpts: z.object({
|
|
3027
|
-
max_chars_per_result: z.
|
|
3028
|
-
max_chars_total: z.
|
|
3029
|
-
})
|
|
3030
|
-
max_chars_total: z.
|
|
3031
|
-
fetch_policy: z.object({
|
|
3032
|
-
max_age_seconds: z.
|
|
3033
|
-
timeout_seconds: z.
|
|
3034
|
-
disable_cache_fallback: z.
|
|
3035
|
-
})
|
|
3036
|
-
location: z.
|
|
3045
|
+
objective: z.describe(z.string(), "Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."),
|
|
3046
|
+
search_queries: z.describe(z.optional(z.array(z.string())), "Provide 2-3 concise keyword queries, 3-6 words each (max 5, 200 chars each). Strongly recommended; the search runs on these queries."),
|
|
3047
|
+
mode: z.describe(z.optional(z.enum(parallelSearchModes)), "Search mode: \"turbo\" and \"fast\" return quickly with shorter excerpts, \"basic\" is balanced (default), \"advanced\" is the most thorough. \"turbo\" supports English and Japanese only. \"one-shot\" and \"agentic\" are deprecated aliases of \"basic\" and \"advanced\"."),
|
|
3048
|
+
max_results: z.describe(z.optional(z.number()), "Maximum number of results to return (1-20). Defaults to 10 if not specified."),
|
|
3049
|
+
source_policy: z.describe(z.optional(z.object({
|
|
3050
|
+
include_domains: z.describe(z.optional(z.array(z.string())), "Domains or domain/path prefixes to restrict results to, without scheme or port. Example: ['wikipedia.org', 'docs.python.org/3']."),
|
|
3051
|
+
exclude_domains: z.describe(z.optional(z.array(z.string())), "Domains or domain/path prefixes to exclude, without scheme or port. Example: ['reddit.com']."),
|
|
3052
|
+
after_date: z.describe(z.optional(z.string()), "Only include results published on or after this date. Use an ISO 8601 calendar date formatted YYYY-MM-DD (e.g. 2025-01-01); do not include a time.")
|
|
3053
|
+
})), "Source policy for controlling which domains to include/exclude and freshness."),
|
|
3054
|
+
excerpts: z.describe(z.optional(z.object({
|
|
3055
|
+
max_chars_per_result: z.describe(z.optional(z.number()), "Maximum characters per result."),
|
|
3056
|
+
max_chars_total: z.describe(z.optional(z.number()), "Deprecated: use the top-level max_chars_total.")
|
|
3057
|
+
})), "Excerpt configuration for controlling result length."),
|
|
3058
|
+
max_chars_total: z.describe(z.optional(z.number()), "Maximum total characters across all result excerpts."),
|
|
3059
|
+
fetch_policy: z.describe(z.optional(z.object({
|
|
3060
|
+
max_age_seconds: z.describe(z.optional(z.number()), "Maximum age of cached content in seconds before a live fetch, minimum 600."),
|
|
3061
|
+
timeout_seconds: z.describe(z.optional(z.number()), "Timeout in seconds for a live fetch when content is not cached. Capped by the gateway tool timeout."),
|
|
3062
|
+
disable_cache_fallback: z.describe(z.optional(z.boolean()), "Return an error instead of older cached content when a live fetch fails.")
|
|
3063
|
+
})), "Fetch policy for controlling content freshness."),
|
|
3064
|
+
location: z.describe(z.optional(z.string()), "ISO 3166-1 alpha-2 country code to localize results, e.g. \"us\".")
|
|
3037
3065
|
})));
|
|
3038
3066
|
const parallelSearchOutputSchema = lazySchema(() => zodSchema(z.union([z.object({
|
|
3039
3067
|
search_id: z.string(),
|
|
3040
3068
|
results: z.array(z.object({
|
|
3041
3069
|
url: z.string(),
|
|
3042
|
-
title: z.
|
|
3043
|
-
publish_date: z.
|
|
3070
|
+
title: z.optional(z.nullable(z.string())),
|
|
3071
|
+
publish_date: z.optional(z.nullable(z.string())),
|
|
3044
3072
|
excerpts: z.array(z.string())
|
|
3045
3073
|
})),
|
|
3046
|
-
warnings: z.array(z.object({
|
|
3074
|
+
warnings: z.optional(z.nullable(z.array(z.object({
|
|
3047
3075
|
type: z.string(),
|
|
3048
3076
|
message: z.string(),
|
|
3049
|
-
detail: z.record(z.string(), z.unknown())
|
|
3050
|
-
}))
|
|
3051
|
-
usage: z.array(z.object({
|
|
3077
|
+
detail: z.optional(z.nullable(z.record(z.string(), z.unknown())))
|
|
3078
|
+
})))),
|
|
3079
|
+
usage: z.optional(z.nullable(z.array(z.object({
|
|
3052
3080
|
name: z.string(),
|
|
3053
|
-
count: z.
|
|
3054
|
-
}))
|
|
3055
|
-
session_id: z.
|
|
3081
|
+
count: z.optional(z.number())
|
|
3082
|
+
})))),
|
|
3083
|
+
session_id: z.optional(z.string())
|
|
3056
3084
|
}), gatewayToolErrorSchema()])));
|
|
3057
3085
|
const parallelSearchToolFactory = createProviderExecutedToolFactory({
|
|
3058
3086
|
id: "gateway.parallel_search",
|
|
@@ -3063,31 +3091,31 @@ const parallelSearch = (config = {}) => parallelSearchToolFactory(config);
|
|
|
3063
3091
|
//#endregion
|
|
3064
3092
|
//#region src/tool/perplexity-search.ts
|
|
3065
3093
|
const perplexitySearchInputSchema = lazySchema(() => zodSchema(z.object({
|
|
3066
|
-
query: z.union([z.string(), z.array(z.string())])
|
|
3067
|
-
max_results: z.
|
|
3068
|
-
max_tokens_per_page: z.
|
|
3069
|
-
max_tokens: z.
|
|
3070
|
-
country: z.
|
|
3071
|
-
search_domain_filter: z.array(z.string())
|
|
3072
|
-
search_language_filter: z.array(z.string())
|
|
3073
|
-
search_after_date: z.
|
|
3074
|
-
search_before_date: z.
|
|
3075
|
-
last_updated_after_filter: z.
|
|
3076
|
-
last_updated_before_filter: z.
|
|
3077
|
-
search_recency_filter: z.enum([
|
|
3094
|
+
query: z.describe(z.union([z.string(), z.array(z.string())]), "Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."),
|
|
3095
|
+
max_results: z.describe(z.optional(z.number()), "Maximum number of search results to return (1-20, default: 10)"),
|
|
3096
|
+
max_tokens_per_page: z.describe(z.optional(z.number()), "Maximum number of tokens to extract per search result page (256-2048, default: 2048)"),
|
|
3097
|
+
max_tokens: z.describe(z.optional(z.number()), "Maximum total tokens across all search results (default: 25000, max: 1000000)"),
|
|
3098
|
+
country: z.describe(z.optional(z.string()), "Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"),
|
|
3099
|
+
search_domain_filter: z.describe(z.optional(z.array(z.string())), "List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"),
|
|
3100
|
+
search_language_filter: z.describe(z.optional(z.array(z.string())), "List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"),
|
|
3101
|
+
search_after_date: z.describe(z.optional(z.string()), "Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),
|
|
3102
|
+
search_before_date: z.describe(z.optional(z.string()), "Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),
|
|
3103
|
+
last_updated_after_filter: z.describe(z.optional(z.string()), "Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),
|
|
3104
|
+
last_updated_before_filter: z.describe(z.optional(z.string()), "Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),
|
|
3105
|
+
search_recency_filter: z.describe(z.optional(z.enum([
|
|
3078
3106
|
"day",
|
|
3079
3107
|
"week",
|
|
3080
3108
|
"month",
|
|
3081
3109
|
"year"
|
|
3082
|
-
])
|
|
3110
|
+
])), "Filter results by relative time period. Cannot be used with search_after_date or search_before_date.")
|
|
3083
3111
|
})));
|
|
3084
3112
|
const perplexitySearchOutputSchema = lazySchema(() => zodSchema(z.union([z.object({
|
|
3085
3113
|
results: z.array(z.object({
|
|
3086
3114
|
title: z.string(),
|
|
3087
3115
|
url: z.string(),
|
|
3088
3116
|
snippet: z.string(),
|
|
3089
|
-
date: z.
|
|
3090
|
-
lastUpdated: z.
|
|
3117
|
+
date: z.optional(z.string()),
|
|
3118
|
+
lastUpdated: z.optional(z.string())
|
|
3091
3119
|
})),
|
|
3092
3120
|
id: z.string()
|
|
3093
3121
|
}), z.object({
|
|
@@ -3098,7 +3126,7 @@ const perplexitySearchOutputSchema = lazySchema(() => zodSchema(z.union([z.objec
|
|
|
3098
3126
|
"invalid_input",
|
|
3099
3127
|
"unknown"
|
|
3100
3128
|
]),
|
|
3101
|
-
statusCode: z.
|
|
3129
|
+
statusCode: z.optional(z.number()),
|
|
3102
3130
|
message: z.string()
|
|
3103
3131
|
})])));
|
|
3104
3132
|
const perplexitySearchToolFactory = createProviderExecutedToolFactory({
|
|
@@ -3110,75 +3138,75 @@ const perplexitySearch = (config = {}) => perplexitySearchToolFactory(config);
|
|
|
3110
3138
|
//#endregion
|
|
3111
3139
|
//#region src/tool/tako-search.ts
|
|
3112
3140
|
const takoDataSourceInputSchema = () => z.object({
|
|
3113
|
-
count: z.
|
|
3114
|
-
include_contents: z.
|
|
3115
|
-
mode: z.enum(["inline", "url"])
|
|
3116
|
-
content_format: z.enum([
|
|
3141
|
+
count: z.describe(z.optional(z.number()), "Maximum number of data results to return (1-20). When include_contents is true, each additional result adds its own data surcharge."),
|
|
3142
|
+
include_contents: z.describe(z.optional(z.boolean()), "Inline rows for each data result. This adds a data surcharge based on row count and dataset source. To estimate cost, search with include_contents disabled and inspect cards.content.export_pricing. This applies to every returned card; limit sources.data.count and sources.data.max_rows to control cost."),
|
|
3143
|
+
mode: z.describe(z.optional(z.enum(["inline", "url"])), "Requested data delivery mode. Search card data is always inline."),
|
|
3144
|
+
content_format: z.describe(z.optional(z.enum([
|
|
3117
3145
|
"card_json",
|
|
3118
3146
|
"csv",
|
|
3119
3147
|
"json_compact",
|
|
3120
3148
|
"json_records"
|
|
3121
|
-
])
|
|
3122
|
-
max_rows: z.
|
|
3123
|
-
node_ids: z.array(z.string())
|
|
3124
|
-
strict: z.
|
|
3149
|
+
])), "Serialization for inlined card data."),
|
|
3150
|
+
max_rows: z.describe(z.optional(z.number()), "Maximum rows to inline per result. Omit to use the allowance in cards.content.export_pricing. A data surcharge applies per 1,000 exported rows; lower values reduce cost."),
|
|
3151
|
+
node_ids: z.describe(z.optional(z.array(z.string())), "Data Graph node IDs to prioritize. Maximum 20."),
|
|
3152
|
+
strict: z.describe(z.optional(z.boolean()), "Only return cards matching node_ids. Requires a non-empty node_ids.")
|
|
3125
3153
|
});
|
|
3126
3154
|
const takoWebSourceInputSchema = () => z.object({
|
|
3127
|
-
count: z.
|
|
3128
|
-
include_contents: z.
|
|
3129
|
-
category: z.enum([
|
|
3155
|
+
count: z.describe(z.optional(z.number()), "Maximum number of web results to return (1-20)."),
|
|
3156
|
+
include_contents: z.describe(z.optional(z.boolean()), "Inline extracted web page text. This can add a data charge."),
|
|
3157
|
+
category: z.describe(z.optional(z.enum([
|
|
3130
3158
|
"finance",
|
|
3131
3159
|
"news",
|
|
3132
3160
|
"sports"
|
|
3133
|
-
])
|
|
3134
|
-
include_domains: z.array(z.string())
|
|
3135
|
-
exclude_domains: z.array(z.string())
|
|
3136
|
-
snippet_max_chars: z.
|
|
3137
|
-
highlights: z.
|
|
3138
|
-
article_content_max_chars: z.
|
|
3139
|
-
published_after: z.
|
|
3140
|
-
published_before: z.
|
|
3161
|
+
])), "Optional web-result category filter."),
|
|
3162
|
+
include_domains: z.describe(z.optional(z.array(z.string())), "Only return results from these bare domains."),
|
|
3163
|
+
exclude_domains: z.describe(z.optional(z.array(z.string())), "Exclude results from these bare domains."),
|
|
3164
|
+
snippet_max_chars: z.describe(z.optional(z.number()), "Maximum characters in each web-result snippet."),
|
|
3165
|
+
highlights: z.describe(z.optional(z.boolean()), "Include highlighted passages in web results. Defaults to true in AI Gateway."),
|
|
3166
|
+
article_content_max_chars: z.describe(z.optional(z.number()), "Maximum extracted characters per web page when including contents."),
|
|
3167
|
+
published_after: z.describe(z.optional(z.string()), "Keep results published on or after this ISO date (YYYY-MM-DD)."),
|
|
3168
|
+
published_before: z.describe(z.optional(z.string()), "Keep results published on or before this ISO date (YYYY-MM-DD).")
|
|
3141
3169
|
});
|
|
3142
3170
|
const takoSearchInputSchema = lazySchema(() => zodSchema(z.object({
|
|
3143
|
-
query: z.string()
|
|
3144
|
-
effort: z.enum([
|
|
3171
|
+
query: z.describe(z.string(), "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."),
|
|
3172
|
+
effort: z.describe(z.optional(z.enum([
|
|
3145
3173
|
"deep",
|
|
3146
3174
|
"fast",
|
|
3147
3175
|
"instant"
|
|
3148
|
-
])
|
|
3149
|
-
sources: z.object({
|
|
3150
|
-
data:
|
|
3151
|
-
web:
|
|
3152
|
-
})
|
|
3153
|
-
location: z.object({
|
|
3154
|
-
latitude: z.number()
|
|
3155
|
-
longitude: z.number()
|
|
3156
|
-
})
|
|
3157
|
-
country_code: z.
|
|
3158
|
-
locale: z.
|
|
3159
|
-
timezone: z.
|
|
3160
|
-
output_settings: z.object({
|
|
3161
|
-
image_dark_mode: z.
|
|
3162
|
-
force_refresh: z.
|
|
3163
|
-
})
|
|
3164
|
-
include_related: z.
|
|
3176
|
+
])), "Search effort. fast is the balanced default, instant favors cached results and low latency, and deep broadens retrieval with reranking at higher cost and latency."),
|
|
3177
|
+
sources: z.describe(z.optional(z.object({
|
|
3178
|
+
data: z.optional(takoDataSourceInputSchema()),
|
|
3179
|
+
web: z.optional(takoWebSourceInputSchema())
|
|
3180
|
+
})), "Sources to search. Omit to search both curated data and the web. When provided, only keys present are searched."),
|
|
3181
|
+
location: z.describe(z.optional(z.object({
|
|
3182
|
+
latitude: z.describe(z.number(), "Latitude between -90 and 90."),
|
|
3183
|
+
longitude: z.describe(z.number(), "Longitude between -180 and 180.")
|
|
3184
|
+
})), "End-user coordinates for localized results."),
|
|
3185
|
+
country_code: z.describe(z.optional(z.string()), "Two-letter ISO 3166-1 country code, such as 'US'."),
|
|
3186
|
+
locale: z.describe(z.optional(z.string()), "BCP-47 locale, such as 'en-US'."),
|
|
3187
|
+
timezone: z.describe(z.optional(z.string()), "IANA timezone, such as 'America/New_York'."),
|
|
3188
|
+
output_settings: z.describe(z.optional(z.object({
|
|
3189
|
+
image_dark_mode: z.describe(z.optional(z.boolean()), "Render card preview images in dark mode."),
|
|
3190
|
+
force_refresh: z.describe(z.optional(z.boolean()), "Instant-effort only. Request a refreshed instant result.")
|
|
3191
|
+
})), "Controls card rendering in the search response."),
|
|
3192
|
+
include_related: z.describe(z.optional(z.number()), "Maximum related search suggestions to include (1-20).")
|
|
3165
3193
|
})));
|
|
3166
|
-
const takoDatasetCellSchema = () => z.union([
|
|
3194
|
+
const takoDatasetCellSchema = () => z.nullable(z.union([
|
|
3167
3195
|
z.boolean(),
|
|
3168
3196
|
z.number(),
|
|
3169
3197
|
z.string()
|
|
3170
|
-
])
|
|
3171
|
-
const takoResultContentSchema = () => z.object({
|
|
3172
|
-
content_format: z.enum([
|
|
3198
|
+
]));
|
|
3199
|
+
const takoResultContentSchema = () => z.catchall(z.object({
|
|
3200
|
+
content_format: z.nullish(z.enum([
|
|
3173
3201
|
"card_json",
|
|
3174
3202
|
"csv",
|
|
3175
3203
|
"json_compact",
|
|
3176
3204
|
"json_records"
|
|
3177
|
-
])
|
|
3178
|
-
cost: z.
|
|
3179
|
-
data: z.
|
|
3180
|
-
records: z.array(z.record(z.string(), takoDatasetCellSchema()))
|
|
3181
|
-
dataset: z.object({
|
|
3205
|
+
])),
|
|
3206
|
+
cost: z.optional(z.number()),
|
|
3207
|
+
data: z.nullish(z.string()),
|
|
3208
|
+
records: z.nullish(z.array(z.record(z.string(), takoDatasetCellSchema()))),
|
|
3209
|
+
dataset: z.nullish(z.object({
|
|
3182
3210
|
columns: z.array(z.object({
|
|
3183
3211
|
name: z.string(),
|
|
3184
3212
|
type: z.enum([
|
|
@@ -3188,7 +3216,7 @@ const takoResultContentSchema = () => z.object({
|
|
|
3188
3216
|
"number",
|
|
3189
3217
|
"string"
|
|
3190
3218
|
]),
|
|
3191
|
-
unit: z.
|
|
3219
|
+
unit: z.nullish(z.string())
|
|
3192
3220
|
})),
|
|
3193
3221
|
rows: z.array(z.array(takoDatasetCellSchema())),
|
|
3194
3222
|
total_rows: z.number(),
|
|
@@ -3196,102 +3224,114 @@ const takoResultContentSchema = () => z.object({
|
|
|
3196
3224
|
ref: z.string(),
|
|
3197
3225
|
sources: z.array(z.object({
|
|
3198
3226
|
name: z.string(),
|
|
3199
|
-
index: z.enum(["data", "web"])
|
|
3227
|
+
index: z.optional(z.enum(["data", "web"]))
|
|
3200
3228
|
})),
|
|
3201
|
-
provenance: z.enum(["query", "web_extraction"])
|
|
3202
|
-
})
|
|
3203
|
-
card_data: z.object({}).
|
|
3204
|
-
card_data_schema: z.object({}).
|
|
3205
|
-
url: z.
|
|
3206
|
-
expires_at: z.
|
|
3207
|
-
total_rows: z.
|
|
3208
|
-
truncated: z.
|
|
3209
|
-
|
|
3229
|
+
provenance: z.optional(z.enum(["query", "web_extraction"]))
|
|
3230
|
+
})),
|
|
3231
|
+
card_data: z.nullish(z.catchall(z.object({}), z.unknown())),
|
|
3232
|
+
card_data_schema: z.nullish(z.catchall(z.object({}), z.unknown())),
|
|
3233
|
+
url: z.nullish(z.string()),
|
|
3234
|
+
expires_at: z.nullish(z.string()),
|
|
3235
|
+
total_rows: z.nullish(z.number()),
|
|
3236
|
+
truncated: z.optional(z.boolean()),
|
|
3237
|
+
premium_rows: z.nullish(z.record(z.string(), z.number())),
|
|
3238
|
+
redacted_cells: z.nullish(z.record(z.string(), z.array(z.number()))),
|
|
3239
|
+
total_matching: z.nullish(z.number()),
|
|
3240
|
+
export_pricing: z.nullish(z.catchall(z.object({
|
|
3210
3241
|
baseline_usd: z.number(),
|
|
3211
|
-
free_rows: z.number(),
|
|
3242
|
+
free_rows: z.optional(z.number()),
|
|
3212
3243
|
max_rows_ceiling: z.number(),
|
|
3213
|
-
row_cpm_usd: z.number()
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3244
|
+
row_cpm_usd: z.number(),
|
|
3245
|
+
premium_row_cpm_usd: z.nullish(z.record(z.string(), z.number())),
|
|
3246
|
+
variable_cost_max_usd: z.nullish(z.number())
|
|
3247
|
+
}), z.unknown())),
|
|
3248
|
+
manifest: z.nullish(z.array(z.object({
|
|
3249
|
+
dtype: z.nullish(z.enum([
|
|
3217
3250
|
"boolean",
|
|
3218
3251
|
"date",
|
|
3219
3252
|
"datetime",
|
|
3220
3253
|
"number",
|
|
3221
3254
|
"string"
|
|
3222
|
-
])
|
|
3223
|
-
entity: z.
|
|
3224
|
-
metric: z.
|
|
3225
|
-
name: z.
|
|
3226
|
-
unit: z.
|
|
3227
|
-
}))
|
|
3228
|
-
}).
|
|
3229
|
-
const takoCardSchema = () => z.object({
|
|
3230
|
-
card_id: z.
|
|
3231
|
-
title: z.
|
|
3232
|
-
description: z.
|
|
3233
|
-
semantic_description: z.
|
|
3234
|
-
webpage_url: z.
|
|
3235
|
-
image_url: z.
|
|
3236
|
-
embed_url: z.
|
|
3237
|
-
sources: z.array(z.object({
|
|
3238
|
-
source_name: z.
|
|
3239
|
-
source_description: z.
|
|
3255
|
+
])),
|
|
3256
|
+
entity: z.nullish(z.string()),
|
|
3257
|
+
metric: z.nullish(z.string()),
|
|
3258
|
+
name: z.nullish(z.string()),
|
|
3259
|
+
unit: z.nullish(z.string())
|
|
3260
|
+
})))
|
|
3261
|
+
}), z.unknown());
|
|
3262
|
+
const takoCardSchema = () => z.catchall(z.object({
|
|
3263
|
+
card_id: z.nullish(z.string()),
|
|
3264
|
+
title: z.nullish(z.string()),
|
|
3265
|
+
description: z.nullish(z.string()),
|
|
3266
|
+
semantic_description: z.nullish(z.string()),
|
|
3267
|
+
webpage_url: z.nullish(z.string()),
|
|
3268
|
+
image_url: z.nullish(z.string()),
|
|
3269
|
+
embed_url: z.nullish(z.string()),
|
|
3270
|
+
sources: z.nullish(z.array(z.object({
|
|
3271
|
+
source_name: z.nullish(z.string()),
|
|
3272
|
+
source_description: z.nullish(z.string()),
|
|
3240
3273
|
source_index: z.enum(["data", "web"]),
|
|
3241
|
-
source_text: z.
|
|
3242
|
-
url: z.
|
|
3243
|
-
}))
|
|
3244
|
-
methodologies: z.array(z.object({
|
|
3245
|
-
methodology_name: z.
|
|
3246
|
-
methodology_description: z.
|
|
3247
|
-
}))
|
|
3248
|
-
source_indexes: z.array(z.enum(["data", "web"]))
|
|
3249
|
-
card_type: z.
|
|
3250
|
-
relevance: z.enum([
|
|
3274
|
+
source_text: z.nullish(z.string()),
|
|
3275
|
+
url: z.nullish(z.string())
|
|
3276
|
+
}))),
|
|
3277
|
+
methodologies: z.nullish(z.array(z.object({
|
|
3278
|
+
methodology_name: z.nullable(z.string()),
|
|
3279
|
+
methodology_description: z.nullable(z.string())
|
|
3280
|
+
}))),
|
|
3281
|
+
source_indexes: z.nullish(z.array(z.enum(["data", "web"]))),
|
|
3282
|
+
card_type: z.nullish(z.string()),
|
|
3283
|
+
relevance: z.nullish(z.enum([
|
|
3251
3284
|
"High",
|
|
3252
3285
|
"Low",
|
|
3253
3286
|
"Medium"
|
|
3254
|
-
])
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3287
|
+
])),
|
|
3288
|
+
relevance_score: z.nullish(z.number()),
|
|
3289
|
+
content: z.nullish(takoResultContentSchema()),
|
|
3290
|
+
exportable: z.optional(z.boolean()),
|
|
3291
|
+
nodes: z.nullish(z.array(z.object({
|
|
3258
3292
|
id: z.string(),
|
|
3259
3293
|
type: z.enum(["entity", "metric"]),
|
|
3260
3294
|
name: z.string(),
|
|
3261
|
-
description: z.
|
|
3262
|
-
}))
|
|
3263
|
-
metric_definitions: z.array(z.object({
|
|
3295
|
+
description: z.nullish(z.string())
|
|
3296
|
+
}))),
|
|
3297
|
+
metric_definitions: z.nullish(z.array(z.object({
|
|
3264
3298
|
name: z.string(),
|
|
3265
3299
|
definition: z.string()
|
|
3266
|
-
}))
|
|
3267
|
-
data_freshness: z.object({
|
|
3268
|
-
coverage_end: z.
|
|
3269
|
-
data_as_of: z.
|
|
3270
|
-
last_updated: z.
|
|
3271
|
-
})
|
|
3272
|
-
|
|
3273
|
-
|
|
3300
|
+
}))),
|
|
3301
|
+
data_freshness: z.nullish(z.object({
|
|
3302
|
+
coverage_end: z.nullish(z.string()),
|
|
3303
|
+
data_as_of: z.nullish(z.string()),
|
|
3304
|
+
last_updated: z.nullish(z.string())
|
|
3305
|
+
})),
|
|
3306
|
+
placeholder: z.nullish(z.catchall(z.object({
|
|
3307
|
+
withheld_source: z.string(),
|
|
3308
|
+
reason: z.nullish(z.enum(["not_served", "over_cap"]))
|
|
3309
|
+
}), z.unknown()))
|
|
3310
|
+
}), z.unknown());
|
|
3311
|
+
const takoWebResultSchema = () => z.catchall(z.object({
|
|
3274
3312
|
title: z.string(),
|
|
3275
3313
|
url: z.string(),
|
|
3276
|
-
snippet: z.
|
|
3277
|
-
source_name: z.
|
|
3278
|
-
publish_date: z.
|
|
3279
|
-
content:
|
|
3280
|
-
}).
|
|
3281
|
-
const takoSearchOutputSchema = lazySchema(() => zodSchema(z.union([z.object({
|
|
3314
|
+
snippet: z.nullish(z.string()),
|
|
3315
|
+
source_name: z.nullish(z.string()),
|
|
3316
|
+
publish_date: z.nullish(z.string()),
|
|
3317
|
+
content: z.nullish(takoResultContentSchema())
|
|
3318
|
+
}), z.unknown());
|
|
3319
|
+
const takoSearchOutputSchema = lazySchema(() => zodSchema(z.union([z.catchall(z.object({
|
|
3282
3320
|
request_id: z.string(),
|
|
3283
|
-
cards: z.array(takoCardSchema())
|
|
3284
|
-
web_results: z.array(takoWebResultSchema())
|
|
3285
|
-
usage: z.object({
|
|
3321
|
+
cards: z.optional(z.array(takoCardSchema())),
|
|
3322
|
+
web_results: z.optional(z.array(takoWebResultSchema())),
|
|
3323
|
+
usage: z.nullish(z.catchall(z.object({
|
|
3286
3324
|
total_cost_usd: z.number(),
|
|
3287
|
-
compute: z.object({ cost_usd: z.number() }).
|
|
3288
|
-
data: z.object({
|
|
3325
|
+
compute: z.nullish(z.catchall(z.object({ cost_usd: z.number() }), z.unknown())),
|
|
3326
|
+
data: z.nullish(z.catchall(z.object({
|
|
3289
3327
|
cost_usd: z.number(),
|
|
3290
|
-
datasets: z.number()
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
})
|
|
3328
|
+
datasets: z.number(),
|
|
3329
|
+
data_points: z.nullish(z.number())
|
|
3330
|
+
}), z.unknown())),
|
|
3331
|
+
variable_cost: z.nullish(z.catchall(z.object({ cost_usd: z.number() }), z.unknown()))
|
|
3332
|
+
}), z.unknown())),
|
|
3333
|
+
related: z.nullish(z.array(z.catchall(z.object({}), z.unknown())))
|
|
3334
|
+
}), z.unknown()), gatewayToolErrorSchema()])));
|
|
3295
3335
|
const takoSearchToolFactory = createProviderExecutedToolFactory({
|
|
3296
3336
|
id: "gateway.tako_search",
|
|
3297
3337
|
inputSchema: takoSearchInputSchema,
|
|
@@ -3370,14 +3410,14 @@ async function getVercelRequestId() {
|
|
|
3370
3410
|
}
|
|
3371
3411
|
//#endregion
|
|
3372
3412
|
//#region src/version.ts
|
|
3373
|
-
const VERSION = "4.0.
|
|
3413
|
+
const VERSION = "4.0.142";
|
|
3374
3414
|
//#endregion
|
|
3375
3415
|
//#region src/gateway-provider.ts
|
|
3376
3416
|
const AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
3377
3417
|
/** Response shape of `POST /v1/realtime/client-secrets`. `expiresAt` is epoch seconds. */
|
|
3378
3418
|
const gatewayClientSecretResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
3379
3419
|
token: z.string(),
|
|
3380
|
-
expiresAt: z.
|
|
3420
|
+
expiresAt: z.nullish(z.number())
|
|
3381
3421
|
})));
|
|
3382
3422
|
/**
|
|
3383
3423
|
* Create a remote provider instance.
|