@ai-sdk/gateway 3.0.226 → 3.0.227
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/index.d.mts +72 -14
- package/dist/index.d.ts +72 -14
- package/dist/index.js +392 -308
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +398 -306
- package/dist/index.mjs.map +1 -1
- package/docs/00-ai-gateway.mdx +94 -0
- package/package.json +1 -1
- package/src/errors/as-gateway-error.ts +9 -0
- package/src/gateway-language-model-settings.ts +2 -3
- package/src/gateway-tools.ts +14 -0
- package/src/tool/deepseek-fetch.ts +69 -0
- package/src/tool/deepseek-search.ts +119 -0
- package/src/tool/gateway-tool-error.ts +39 -0
- package/src/tool/parallel-search.ts +6 -32
- package/src/tool/tako-search.ts +6 -25
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(index_exports);
|
|
37
37
|
|
|
38
38
|
// src/gateway-provider.ts
|
|
39
|
-
var
|
|
39
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
40
40
|
|
|
41
41
|
// src/errors/as-gateway-error.ts
|
|
42
42
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -525,6 +525,9 @@ function isTimeoutError(error) {
|
|
|
525
525
|
}
|
|
526
526
|
async function asGatewayError(error, authMethod) {
|
|
527
527
|
var _a11;
|
|
528
|
+
if ((error instanceof Error || typeof DOMException === "function" && error instanceof DOMException) && (error.name === "AbortError" || error.name === "TimeoutError")) {
|
|
529
|
+
throw error;
|
|
530
|
+
}
|
|
528
531
|
if (GatewayError.isInstance(error)) {
|
|
529
532
|
return error;
|
|
530
533
|
}
|
|
@@ -1986,18 +1989,115 @@ var browserbaseSearchToolFactory = (0, import_provider_utils17.createProviderToo
|
|
|
1986
1989
|
});
|
|
1987
1990
|
var browserbaseSearch = (config = {}) => browserbaseSearchToolFactory(config);
|
|
1988
1991
|
|
|
1989
|
-
// src/tool/
|
|
1992
|
+
// src/tool/deepseek-fetch.ts
|
|
1990
1993
|
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
1994
|
+
var import_zod4 = require("zod");
|
|
1995
|
+
|
|
1996
|
+
// src/tool/gateway-tool-error.ts
|
|
1991
1997
|
var import_zod3 = require("zod");
|
|
1992
|
-
var
|
|
1998
|
+
var gatewayToolErrorSchema = () => import_zod3.z.object({
|
|
1999
|
+
error: import_zod3.z.enum([
|
|
2000
|
+
"api_error",
|
|
2001
|
+
"configuration_error",
|
|
2002
|
+
"execution_error",
|
|
2003
|
+
"gateway_rate_limit",
|
|
2004
|
+
"invalid_input",
|
|
2005
|
+
"rate_limit",
|
|
2006
|
+
"timeout",
|
|
2007
|
+
"unknown",
|
|
2008
|
+
"unknown_tool"
|
|
2009
|
+
]),
|
|
2010
|
+
message: import_zod3.z.string(),
|
|
2011
|
+
statusCode: import_zod3.z.number().optional(),
|
|
2012
|
+
retryAfter: import_zod3.z.string().optional(),
|
|
2013
|
+
statusText: import_zod3.z.string().optional()
|
|
2014
|
+
}).passthrough();
|
|
2015
|
+
|
|
2016
|
+
// src/tool/deepseek-fetch.ts
|
|
2017
|
+
var deepseekFetchInputSchema = (0, import_provider_utils18.lazySchema)(
|
|
1993
2018
|
() => (0, import_provider_utils18.zodSchema)(
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
2019
|
+
import_zod4.z.object({
|
|
2020
|
+
url: import_zod4.z.string().describe(
|
|
2021
|
+
"URL to fetch, at most 8192 characters; HTTP(S) only, without a username or password."
|
|
2022
|
+
)
|
|
2023
|
+
})
|
|
2024
|
+
)
|
|
2025
|
+
);
|
|
2026
|
+
var deepseekFetchOutputSchema = (0, import_provider_utils18.lazySchema)(
|
|
2027
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
2028
|
+
import_zod4.z.union([
|
|
2029
|
+
import_zod4.z.object({
|
|
2030
|
+
title: import_zod4.z.string().nullish(),
|
|
2031
|
+
content: import_zod4.z.string()
|
|
2032
|
+
}).passthrough(),
|
|
2033
|
+
gatewayToolErrorSchema()
|
|
2034
|
+
])
|
|
2035
|
+
)
|
|
2036
|
+
);
|
|
2037
|
+
var deepseekFetchToolFactory = (0, import_provider_utils18.createProviderToolFactoryWithOutputSchema)({
|
|
2038
|
+
id: "gateway.deepseek_fetch",
|
|
2039
|
+
inputSchema: deepseekFetchInputSchema,
|
|
2040
|
+
outputSchema: deepseekFetchOutputSchema
|
|
2041
|
+
});
|
|
2042
|
+
var deepseekFetch = (config = {}) => deepseekFetchToolFactory(config);
|
|
2043
|
+
|
|
2044
|
+
// src/tool/deepseek-search.ts
|
|
2045
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
2046
|
+
var import_zod5 = require("zod");
|
|
2047
|
+
var deepseekSearchInputSchema = (0, import_provider_utils19.lazySchema)(
|
|
2048
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
2049
|
+
import_zod5.z.object({
|
|
2050
|
+
query: import_zod5.z.string().describe(
|
|
2051
|
+
"Web search query, 1 to 128 Unicode characters. Supports site:, -site:, lang:, after:, before:, and quoted phrases."
|
|
2052
|
+
),
|
|
2053
|
+
count: import_zod5.z.number().int().optional().describe("Number of results, 1 to 50 (default: 10)."),
|
|
2054
|
+
need_content: import_zod5.z.boolean().optional().describe("Include available page content (default: false)."),
|
|
2055
|
+
ori_question: import_zod5.z.string().nullable().optional().describe("Original user question, 1 to 128 Unicode characters.")
|
|
2056
|
+
})
|
|
2057
|
+
)
|
|
2058
|
+
);
|
|
2059
|
+
var deepseekSearchOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
2060
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
2061
|
+
import_zod5.z.union([
|
|
2062
|
+
import_zod5.z.object({
|
|
2063
|
+
results: import_zod5.z.array(
|
|
2064
|
+
import_zod5.z.object({
|
|
2065
|
+
authority: import_zod5.z.number().nullish(),
|
|
2066
|
+
content: import_zod5.z.string().nullish(),
|
|
2067
|
+
date: import_zod5.z.string().nullish(),
|
|
2068
|
+
rerank_score: import_zod5.z.number().nullish(),
|
|
2069
|
+
site_icon: import_zod5.z.string().nullish(),
|
|
2070
|
+
site_name: import_zod5.z.string().nullish(),
|
|
2071
|
+
snippet: import_zod5.z.string().nullish(),
|
|
2072
|
+
summary: import_zod5.z.string().nullish(),
|
|
2073
|
+
title: import_zod5.z.string().nullish(),
|
|
2074
|
+
url: import_zod5.z.string().nullish()
|
|
2075
|
+
}).passthrough()
|
|
2076
|
+
)
|
|
2077
|
+
}).passthrough(),
|
|
2078
|
+
gatewayToolErrorSchema()
|
|
2079
|
+
])
|
|
2080
|
+
)
|
|
2081
|
+
);
|
|
2082
|
+
var deepseekSearchToolFactory = (0, import_provider_utils19.createProviderToolFactoryWithOutputSchema)({
|
|
2083
|
+
id: "gateway.deepseek_search",
|
|
2084
|
+
inputSchema: deepseekSearchInputSchema,
|
|
2085
|
+
outputSchema: deepseekSearchOutputSchema
|
|
2086
|
+
});
|
|
2087
|
+
var deepseekSearch = (config = {}) => deepseekSearchToolFactory(config);
|
|
2088
|
+
|
|
2089
|
+
// src/tool/exa-search.ts
|
|
2090
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
2091
|
+
var import_zod6 = require("zod");
|
|
2092
|
+
var exaSearchInputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2093
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2094
|
+
import_zod6.z.object({
|
|
2095
|
+
query: import_zod6.z.string().describe("Natural-language web search query. This is required."),
|
|
2096
|
+
type: import_zod6.z.enum(["auto", "fast", "instant"]).optional().describe(
|
|
1997
2097
|
"Search method. Use auto for the default balance of speed and quality."
|
|
1998
2098
|
),
|
|
1999
|
-
num_results:
|
|
2000
|
-
category:
|
|
2099
|
+
num_results: import_zod6.z.number().optional().describe("Maximum number of results to return (1-100, default: 10)."),
|
|
2100
|
+
category: import_zod6.z.enum([
|
|
2001
2101
|
"company",
|
|
2002
2102
|
"people",
|
|
2003
2103
|
"research paper",
|
|
@@ -2005,20 +2105,20 @@ var exaSearchInputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
2005
2105
|
"personal site",
|
|
2006
2106
|
"financial report"
|
|
2007
2107
|
]).optional().describe("Optional content category to focus results."),
|
|
2008
|
-
user_location:
|
|
2009
|
-
include_domains:
|
|
2010
|
-
exclude_domains:
|
|
2011
|
-
start_published_date:
|
|
2012
|
-
end_published_date:
|
|
2013
|
-
contents:
|
|
2014
|
-
text:
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
max_characters:
|
|
2018
|
-
include_html_tags:
|
|
2019
|
-
verbosity:
|
|
2020
|
-
include_sections:
|
|
2021
|
-
|
|
2108
|
+
user_location: import_zod6.z.string().optional().describe("Two-letter ISO country code such as 'US'."),
|
|
2109
|
+
include_domains: import_zod6.z.array(import_zod6.z.string()).optional().describe("Only return results from these domains."),
|
|
2110
|
+
exclude_domains: import_zod6.z.array(import_zod6.z.string()).optional().describe("Exclude results from these domains."),
|
|
2111
|
+
start_published_date: import_zod6.z.string().optional().describe("Only return links published after this ISO 8601 date."),
|
|
2112
|
+
end_published_date: import_zod6.z.string().optional().describe("Only return links published before this ISO 8601 date."),
|
|
2113
|
+
contents: import_zod6.z.object({
|
|
2114
|
+
text: import_zod6.z.union([
|
|
2115
|
+
import_zod6.z.boolean(),
|
|
2116
|
+
import_zod6.z.object({
|
|
2117
|
+
max_characters: import_zod6.z.number().optional(),
|
|
2118
|
+
include_html_tags: import_zod6.z.boolean().optional(),
|
|
2119
|
+
verbosity: import_zod6.z.enum(["compact", "standard", "full"]).optional(),
|
|
2120
|
+
include_sections: import_zod6.z.array(
|
|
2121
|
+
import_zod6.z.enum([
|
|
2022
2122
|
"header",
|
|
2023
2123
|
"navigation",
|
|
2024
2124
|
"banner",
|
|
@@ -2028,8 +2128,8 @@ var exaSearchInputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
2028
2128
|
"metadata"
|
|
2029
2129
|
])
|
|
2030
2130
|
).optional(),
|
|
2031
|
-
exclude_sections:
|
|
2032
|
-
|
|
2131
|
+
exclude_sections: import_zod6.z.array(
|
|
2132
|
+
import_zod6.z.enum([
|
|
2033
2133
|
"header",
|
|
2034
2134
|
"navigation",
|
|
2035
2135
|
"banner",
|
|
@@ -2041,59 +2141,59 @@ var exaSearchInputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
2041
2141
|
).optional()
|
|
2042
2142
|
})
|
|
2043
2143
|
]).optional(),
|
|
2044
|
-
highlights:
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
query:
|
|
2048
|
-
max_characters:
|
|
2144
|
+
highlights: import_zod6.z.union([
|
|
2145
|
+
import_zod6.z.boolean(),
|
|
2146
|
+
import_zod6.z.object({
|
|
2147
|
+
query: import_zod6.z.string().optional(),
|
|
2148
|
+
max_characters: import_zod6.z.number().optional()
|
|
2049
2149
|
})
|
|
2050
2150
|
]).optional(),
|
|
2051
|
-
max_age_hours:
|
|
2052
|
-
livecrawl_timeout:
|
|
2053
|
-
subpages:
|
|
2054
|
-
subpage_target:
|
|
2055
|
-
extras:
|
|
2056
|
-
links:
|
|
2057
|
-
image_links:
|
|
2151
|
+
max_age_hours: import_zod6.z.number().optional(),
|
|
2152
|
+
livecrawl_timeout: import_zod6.z.number().optional(),
|
|
2153
|
+
subpages: import_zod6.z.number().optional(),
|
|
2154
|
+
subpage_target: import_zod6.z.union([import_zod6.z.string(), import_zod6.z.array(import_zod6.z.string())]).optional(),
|
|
2155
|
+
extras: import_zod6.z.object({
|
|
2156
|
+
links: import_zod6.z.number().optional(),
|
|
2157
|
+
image_links: import_zod6.z.number().optional()
|
|
2058
2158
|
}).optional()
|
|
2059
2159
|
}).optional().describe("Controls extracted page content and freshness.")
|
|
2060
2160
|
})
|
|
2061
2161
|
)
|
|
2062
2162
|
);
|
|
2063
|
-
var exaSearchOutputSchema = (0,
|
|
2064
|
-
() => (0,
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
requestId:
|
|
2068
|
-
searchType:
|
|
2069
|
-
resolvedSearchType:
|
|
2070
|
-
results:
|
|
2071
|
-
|
|
2072
|
-
title:
|
|
2073
|
-
url:
|
|
2074
|
-
id:
|
|
2075
|
-
publishedDate:
|
|
2076
|
-
author:
|
|
2077
|
-
image:
|
|
2078
|
-
favicon:
|
|
2079
|
-
text:
|
|
2080
|
-
highlights:
|
|
2081
|
-
highlightScores:
|
|
2082
|
-
summary:
|
|
2083
|
-
subpages:
|
|
2084
|
-
extras:
|
|
2085
|
-
links:
|
|
2086
|
-
imageLinks:
|
|
2163
|
+
var exaSearchOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2164
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2165
|
+
import_zod6.z.union([
|
|
2166
|
+
import_zod6.z.object({
|
|
2167
|
+
requestId: import_zod6.z.string(),
|
|
2168
|
+
searchType: import_zod6.z.string().optional(),
|
|
2169
|
+
resolvedSearchType: import_zod6.z.string().optional(),
|
|
2170
|
+
results: import_zod6.z.array(
|
|
2171
|
+
import_zod6.z.object({
|
|
2172
|
+
title: import_zod6.z.string(),
|
|
2173
|
+
url: import_zod6.z.string(),
|
|
2174
|
+
id: import_zod6.z.string(),
|
|
2175
|
+
publishedDate: import_zod6.z.string().nullable().optional(),
|
|
2176
|
+
author: import_zod6.z.string().nullable().optional(),
|
|
2177
|
+
image: import_zod6.z.string().nullable().optional(),
|
|
2178
|
+
favicon: import_zod6.z.string().nullable().optional(),
|
|
2179
|
+
text: import_zod6.z.string().optional(),
|
|
2180
|
+
highlights: import_zod6.z.array(import_zod6.z.string()).optional(),
|
|
2181
|
+
highlightScores: import_zod6.z.array(import_zod6.z.number()).optional(),
|
|
2182
|
+
summary: import_zod6.z.string().optional(),
|
|
2183
|
+
subpages: import_zod6.z.array(import_zod6.z.any()).optional(),
|
|
2184
|
+
extras: import_zod6.z.object({
|
|
2185
|
+
links: import_zod6.z.array(import_zod6.z.string()).optional(),
|
|
2186
|
+
imageLinks: import_zod6.z.array(import_zod6.z.string()).optional()
|
|
2087
2187
|
}).optional()
|
|
2088
2188
|
})
|
|
2089
2189
|
),
|
|
2090
|
-
costDollars:
|
|
2091
|
-
total:
|
|
2092
|
-
search:
|
|
2190
|
+
costDollars: import_zod6.z.object({
|
|
2191
|
+
total: import_zod6.z.number().optional(),
|
|
2192
|
+
search: import_zod6.z.record(import_zod6.z.number()).optional()
|
|
2093
2193
|
}).optional()
|
|
2094
2194
|
}),
|
|
2095
|
-
|
|
2096
|
-
error:
|
|
2195
|
+
import_zod6.z.object({
|
|
2196
|
+
error: import_zod6.z.enum([
|
|
2097
2197
|
"api_error",
|
|
2098
2198
|
"rate_limit",
|
|
2099
2199
|
"timeout",
|
|
@@ -2102,13 +2202,13 @@ var exaSearchOutputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
2102
2202
|
"execution_error",
|
|
2103
2203
|
"unknown"
|
|
2104
2204
|
]),
|
|
2105
|
-
statusCode:
|
|
2106
|
-
message:
|
|
2205
|
+
statusCode: import_zod6.z.number().optional(),
|
|
2206
|
+
message: import_zod6.z.string()
|
|
2107
2207
|
})
|
|
2108
2208
|
])
|
|
2109
2209
|
)
|
|
2110
2210
|
);
|
|
2111
|
-
var exaSearchToolFactory = (0,
|
|
2211
|
+
var exaSearchToolFactory = (0, import_provider_utils20.createProviderToolFactoryWithOutputSchema)({
|
|
2112
2212
|
id: "gateway.exa_search",
|
|
2113
2213
|
inputSchema: exaSearchInputSchema,
|
|
2114
2214
|
outputSchema: exaSearchOutputSchema
|
|
@@ -2116,8 +2216,8 @@ var exaSearchToolFactory = (0, import_provider_utils18.createProviderToolFactory
|
|
|
2116
2216
|
var exaSearch = (config = {}) => exaSearchToolFactory(config);
|
|
2117
2217
|
|
|
2118
2218
|
// src/tool/parallel-search.ts
|
|
2119
|
-
var
|
|
2120
|
-
var
|
|
2219
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2220
|
+
var import_zod7 = require("zod");
|
|
2121
2221
|
var parallelSearchModes = [
|
|
2122
2222
|
"turbo",
|
|
2123
2223
|
"fast",
|
|
@@ -2126,100 +2226,86 @@ var parallelSearchModes = [
|
|
|
2126
2226
|
"one-shot",
|
|
2127
2227
|
"agentic"
|
|
2128
2228
|
];
|
|
2129
|
-
var parallelSearchInputSchema = (0,
|
|
2130
|
-
() => (0,
|
|
2131
|
-
|
|
2132
|
-
objective:
|
|
2229
|
+
var parallelSearchInputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2230
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2231
|
+
import_zod7.z.object({
|
|
2232
|
+
objective: import_zod7.z.string().describe(
|
|
2133
2233
|
"Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
|
|
2134
2234
|
),
|
|
2135
|
-
search_queries:
|
|
2235
|
+
search_queries: import_zod7.z.array(import_zod7.z.string()).optional().describe(
|
|
2136
2236
|
"Provide 2-3 concise keyword queries, 3-6 words each (max 5, 200 chars each). Strongly recommended; the search runs on these queries."
|
|
2137
2237
|
),
|
|
2138
|
-
mode:
|
|
2238
|
+
mode: import_zod7.z.enum(parallelSearchModes).optional().describe(
|
|
2139
2239
|
'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".'
|
|
2140
2240
|
),
|
|
2141
|
-
max_results:
|
|
2241
|
+
max_results: import_zod7.z.number().optional().describe(
|
|
2142
2242
|
"Maximum number of results to return (1-20). Defaults to 10 if not specified."
|
|
2143
2243
|
),
|
|
2144
|
-
source_policy:
|
|
2145
|
-
include_domains:
|
|
2244
|
+
source_policy: import_zod7.z.object({
|
|
2245
|
+
include_domains: import_zod7.z.array(import_zod7.z.string()).optional().describe(
|
|
2146
2246
|
"Domains or domain/path prefixes to restrict results to, without scheme or port. Example: ['wikipedia.org', 'docs.python.org/3']."
|
|
2147
2247
|
),
|
|
2148
|
-
exclude_domains:
|
|
2248
|
+
exclude_domains: import_zod7.z.array(import_zod7.z.string()).optional().describe(
|
|
2149
2249
|
"Domains or domain/path prefixes to exclude, without scheme or port. Example: ['reddit.com']."
|
|
2150
2250
|
),
|
|
2151
|
-
after_date:
|
|
2251
|
+
after_date: import_zod7.z.string().optional().describe(
|
|
2152
2252
|
"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."
|
|
2153
2253
|
)
|
|
2154
2254
|
}).optional().describe(
|
|
2155
2255
|
"Source policy for controlling which domains to include/exclude and freshness."
|
|
2156
2256
|
),
|
|
2157
|
-
excerpts:
|
|
2158
|
-
max_chars_per_result:
|
|
2159
|
-
max_chars_total:
|
|
2257
|
+
excerpts: import_zod7.z.object({
|
|
2258
|
+
max_chars_per_result: import_zod7.z.number().optional().describe("Maximum characters per result."),
|
|
2259
|
+
max_chars_total: import_zod7.z.number().optional().describe("Deprecated: use the top-level max_chars_total.")
|
|
2160
2260
|
}).optional().describe("Excerpt configuration for controlling result length."),
|
|
2161
|
-
max_chars_total:
|
|
2162
|
-
fetch_policy:
|
|
2163
|
-
max_age_seconds:
|
|
2261
|
+
max_chars_total: import_zod7.z.number().optional().describe("Maximum total characters across all result excerpts."),
|
|
2262
|
+
fetch_policy: import_zod7.z.object({
|
|
2263
|
+
max_age_seconds: import_zod7.z.number().optional().describe(
|
|
2164
2264
|
"Maximum age of cached content in seconds before a live fetch, minimum 600."
|
|
2165
2265
|
),
|
|
2166
|
-
timeout_seconds:
|
|
2266
|
+
timeout_seconds: import_zod7.z.number().optional().describe(
|
|
2167
2267
|
"Timeout in seconds for a live fetch when content is not cached. Capped by the gateway tool timeout."
|
|
2168
2268
|
),
|
|
2169
|
-
disable_cache_fallback:
|
|
2269
|
+
disable_cache_fallback: import_zod7.z.boolean().optional().describe(
|
|
2170
2270
|
"Return an error instead of older cached content when a live fetch fails."
|
|
2171
2271
|
)
|
|
2172
2272
|
}).optional().describe("Fetch policy for controlling content freshness."),
|
|
2173
|
-
location:
|
|
2273
|
+
location: import_zod7.z.string().optional().describe(
|
|
2174
2274
|
'ISO 3166-1 alpha-2 country code to localize results, e.g. "us".'
|
|
2175
2275
|
)
|
|
2176
2276
|
})
|
|
2177
2277
|
)
|
|
2178
2278
|
);
|
|
2179
|
-
var parallelSearchOutputSchema = (0,
|
|
2180
|
-
() => (0,
|
|
2181
|
-
|
|
2279
|
+
var parallelSearchOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2280
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2281
|
+
import_zod7.z.union([
|
|
2182
2282
|
// Success response (Parallel's response, passed through by the gateway)
|
|
2183
|
-
|
|
2184
|
-
search_id:
|
|
2185
|
-
results:
|
|
2186
|
-
|
|
2187
|
-
url:
|
|
2188
|
-
title:
|
|
2189
|
-
publish_date:
|
|
2190
|
-
excerpts:
|
|
2283
|
+
import_zod7.z.object({
|
|
2284
|
+
search_id: import_zod7.z.string(),
|
|
2285
|
+
results: import_zod7.z.array(
|
|
2286
|
+
import_zod7.z.object({
|
|
2287
|
+
url: import_zod7.z.string(),
|
|
2288
|
+
title: import_zod7.z.string().nullable().optional(),
|
|
2289
|
+
publish_date: import_zod7.z.string().nullable().optional(),
|
|
2290
|
+
excerpts: import_zod7.z.array(import_zod7.z.string())
|
|
2191
2291
|
})
|
|
2192
2292
|
),
|
|
2193
|
-
warnings:
|
|
2194
|
-
|
|
2195
|
-
type:
|
|
2196
|
-
message:
|
|
2197
|
-
detail:
|
|
2293
|
+
warnings: import_zod7.z.array(
|
|
2294
|
+
import_zod7.z.object({
|
|
2295
|
+
type: import_zod7.z.string(),
|
|
2296
|
+
message: import_zod7.z.string(),
|
|
2297
|
+
detail: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.unknown()).nullable().optional()
|
|
2198
2298
|
})
|
|
2199
2299
|
).nullable().optional(),
|
|
2200
|
-
usage:
|
|
2201
|
-
session_id:
|
|
2300
|
+
usage: import_zod7.z.array(import_zod7.z.object({ name: import_zod7.z.string(), count: import_zod7.z.number().optional() })).nullable().optional(),
|
|
2301
|
+
session_id: import_zod7.z.string().optional()
|
|
2202
2302
|
}),
|
|
2203
2303
|
// Error response
|
|
2204
|
-
|
|
2205
|
-
error: import_zod4.z.enum([
|
|
2206
|
-
"api_error",
|
|
2207
|
-
"configuration_error",
|
|
2208
|
-
"execution_error",
|
|
2209
|
-
"gateway_rate_limit",
|
|
2210
|
-
"invalid_input",
|
|
2211
|
-
"rate_limit",
|
|
2212
|
-
"timeout",
|
|
2213
|
-
"unknown",
|
|
2214
|
-
"unknown_tool"
|
|
2215
|
-
]),
|
|
2216
|
-
statusCode: import_zod4.z.number().optional(),
|
|
2217
|
-
message: import_zod4.z.string()
|
|
2218
|
-
})
|
|
2304
|
+
gatewayToolErrorSchema()
|
|
2219
2305
|
])
|
|
2220
2306
|
)
|
|
2221
2307
|
);
|
|
2222
|
-
var parallelSearchToolFactory = (0,
|
|
2308
|
+
var parallelSearchToolFactory = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchema)({
|
|
2223
2309
|
id: "gateway.parallel_search",
|
|
2224
2310
|
inputSchema: parallelSearchInputSchema,
|
|
2225
2311
|
outputSchema: parallelSearchOutputSchema
|
|
@@ -2227,82 +2313,82 @@ var parallelSearchToolFactory = (0, import_provider_utils19.createProviderToolFa
|
|
|
2227
2313
|
var parallelSearch = (config = {}) => parallelSearchToolFactory(config);
|
|
2228
2314
|
|
|
2229
2315
|
// src/tool/perplexity-search.ts
|
|
2230
|
-
var
|
|
2231
|
-
var
|
|
2232
|
-
var perplexitySearchInputSchema = (0,
|
|
2233
|
-
() => (0,
|
|
2234
|
-
|
|
2235
|
-
query:
|
|
2316
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2317
|
+
var import_zod8 = require("zod");
|
|
2318
|
+
var perplexitySearchInputSchema = (0, import_provider_utils22.lazySchema)(
|
|
2319
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2320
|
+
import_zod8.z.object({
|
|
2321
|
+
query: import_zod8.z.union([import_zod8.z.string(), import_zod8.z.array(import_zod8.z.string())]).describe(
|
|
2236
2322
|
"Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."
|
|
2237
2323
|
),
|
|
2238
|
-
max_results:
|
|
2324
|
+
max_results: import_zod8.z.number().optional().describe(
|
|
2239
2325
|
"Maximum number of search results to return (1-20, default: 10)"
|
|
2240
2326
|
),
|
|
2241
|
-
max_tokens_per_page:
|
|
2327
|
+
max_tokens_per_page: import_zod8.z.number().optional().describe(
|
|
2242
2328
|
"Maximum number of tokens to extract per search result page (256-2048, default: 2048)"
|
|
2243
2329
|
),
|
|
2244
|
-
max_tokens:
|
|
2330
|
+
max_tokens: import_zod8.z.number().optional().describe(
|
|
2245
2331
|
"Maximum total tokens across all search results (default: 25000, max: 1000000)"
|
|
2246
2332
|
),
|
|
2247
|
-
country:
|
|
2333
|
+
country: import_zod8.z.string().optional().describe(
|
|
2248
2334
|
"Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"
|
|
2249
2335
|
),
|
|
2250
|
-
search_domain_filter:
|
|
2336
|
+
search_domain_filter: import_zod8.z.array(import_zod8.z.string()).optional().describe(
|
|
2251
2337
|
"List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"
|
|
2252
2338
|
),
|
|
2253
|
-
search_language_filter:
|
|
2339
|
+
search_language_filter: import_zod8.z.array(import_zod8.z.string()).optional().describe(
|
|
2254
2340
|
"List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"
|
|
2255
2341
|
),
|
|
2256
|
-
search_after_date:
|
|
2342
|
+
search_after_date: import_zod8.z.string().optional().describe(
|
|
2257
2343
|
"Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
|
|
2258
2344
|
),
|
|
2259
|
-
search_before_date:
|
|
2345
|
+
search_before_date: import_zod8.z.string().optional().describe(
|
|
2260
2346
|
"Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
|
|
2261
2347
|
),
|
|
2262
|
-
last_updated_after_filter:
|
|
2348
|
+
last_updated_after_filter: import_zod8.z.string().optional().describe(
|
|
2263
2349
|
"Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
|
|
2264
2350
|
),
|
|
2265
|
-
last_updated_before_filter:
|
|
2351
|
+
last_updated_before_filter: import_zod8.z.string().optional().describe(
|
|
2266
2352
|
"Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
|
|
2267
2353
|
),
|
|
2268
|
-
search_recency_filter:
|
|
2354
|
+
search_recency_filter: import_zod8.z.enum(["day", "week", "month", "year"]).optional().describe(
|
|
2269
2355
|
"Filter results by relative time period. Cannot be used with search_after_date or search_before_date."
|
|
2270
2356
|
)
|
|
2271
2357
|
})
|
|
2272
2358
|
)
|
|
2273
2359
|
);
|
|
2274
|
-
var perplexitySearchOutputSchema = (0,
|
|
2275
|
-
() => (0,
|
|
2276
|
-
|
|
2360
|
+
var perplexitySearchOutputSchema = (0, import_provider_utils22.lazySchema)(
|
|
2361
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2362
|
+
import_zod8.z.union([
|
|
2277
2363
|
// Success response
|
|
2278
|
-
|
|
2279
|
-
results:
|
|
2280
|
-
|
|
2281
|
-
title:
|
|
2282
|
-
url:
|
|
2283
|
-
snippet:
|
|
2284
|
-
date:
|
|
2285
|
-
lastUpdated:
|
|
2364
|
+
import_zod8.z.object({
|
|
2365
|
+
results: import_zod8.z.array(
|
|
2366
|
+
import_zod8.z.object({
|
|
2367
|
+
title: import_zod8.z.string(),
|
|
2368
|
+
url: import_zod8.z.string(),
|
|
2369
|
+
snippet: import_zod8.z.string(),
|
|
2370
|
+
date: import_zod8.z.string().optional(),
|
|
2371
|
+
lastUpdated: import_zod8.z.string().optional()
|
|
2286
2372
|
})
|
|
2287
2373
|
),
|
|
2288
|
-
id:
|
|
2374
|
+
id: import_zod8.z.string()
|
|
2289
2375
|
}),
|
|
2290
2376
|
// Error response
|
|
2291
|
-
|
|
2292
|
-
error:
|
|
2377
|
+
import_zod8.z.object({
|
|
2378
|
+
error: import_zod8.z.enum([
|
|
2293
2379
|
"api_error",
|
|
2294
2380
|
"rate_limit",
|
|
2295
2381
|
"timeout",
|
|
2296
2382
|
"invalid_input",
|
|
2297
2383
|
"unknown"
|
|
2298
2384
|
]),
|
|
2299
|
-
statusCode:
|
|
2300
|
-
message:
|
|
2385
|
+
statusCode: import_zod8.z.number().optional(),
|
|
2386
|
+
message: import_zod8.z.string()
|
|
2301
2387
|
})
|
|
2302
2388
|
])
|
|
2303
2389
|
)
|
|
2304
2390
|
);
|
|
2305
|
-
var perplexitySearchToolFactory = (0,
|
|
2391
|
+
var perplexitySearchToolFactory = (0, import_provider_utils22.createProviderToolFactoryWithOutputSchema)({
|
|
2306
2392
|
id: "gateway.perplexity_search",
|
|
2307
2393
|
inputSchema: perplexitySearchInputSchema,
|
|
2308
2394
|
outputSchema: perplexitySearchOutputSchema
|
|
@@ -2310,209 +2396,197 @@ var perplexitySearchToolFactory = (0, import_provider_utils20.createProviderTool
|
|
|
2310
2396
|
var perplexitySearch = (config = {}) => perplexitySearchToolFactory(config);
|
|
2311
2397
|
|
|
2312
2398
|
// src/tool/tako-search.ts
|
|
2313
|
-
var
|
|
2314
|
-
var
|
|
2315
|
-
var takoDataSourceInputSchema = () =>
|
|
2316
|
-
count:
|
|
2399
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
2400
|
+
var import_zod9 = require("zod");
|
|
2401
|
+
var takoDataSourceInputSchema = () => import_zod9.z.object({
|
|
2402
|
+
count: import_zod9.z.number().optional().describe(
|
|
2317
2403
|
"Maximum number of data results to return (1-20). When include_contents is true, each additional result adds its own data surcharge."
|
|
2318
2404
|
),
|
|
2319
|
-
include_contents:
|
|
2405
|
+
include_contents: import_zod9.z.boolean().optional().describe(
|
|
2320
2406
|
"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."
|
|
2321
2407
|
),
|
|
2322
|
-
mode:
|
|
2408
|
+
mode: import_zod9.z.enum(["inline", "url"]).optional().describe(
|
|
2323
2409
|
"Requested data delivery mode. Search card data is always inline."
|
|
2324
2410
|
),
|
|
2325
|
-
content_format:
|
|
2326
|
-
max_rows:
|
|
2411
|
+
content_format: import_zod9.z.enum(["card_json", "csv", "json_compact", "json_records"]).optional().describe("Serialization for inlined card data."),
|
|
2412
|
+
max_rows: import_zod9.z.number().optional().describe(
|
|
2327
2413
|
"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."
|
|
2328
2414
|
),
|
|
2329
|
-
node_ids:
|
|
2330
|
-
strict:
|
|
2415
|
+
node_ids: import_zod9.z.array(import_zod9.z.string()).optional().describe("Data Graph node IDs to prioritize. Maximum 20."),
|
|
2416
|
+
strict: import_zod9.z.boolean().optional().describe(
|
|
2331
2417
|
"Only return cards matching node_ids. Requires a non-empty node_ids."
|
|
2332
2418
|
)
|
|
2333
2419
|
});
|
|
2334
|
-
var takoWebSourceInputSchema = () =>
|
|
2335
|
-
count:
|
|
2336
|
-
include_contents:
|
|
2337
|
-
category:
|
|
2338
|
-
include_domains:
|
|
2339
|
-
exclude_domains:
|
|
2340
|
-
snippet_max_chars:
|
|
2341
|
-
highlights:
|
|
2420
|
+
var takoWebSourceInputSchema = () => import_zod9.z.object({
|
|
2421
|
+
count: import_zod9.z.number().optional().describe("Maximum number of web results to return (1-20)."),
|
|
2422
|
+
include_contents: import_zod9.z.boolean().optional().describe("Inline extracted web page text. This can add a data charge."),
|
|
2423
|
+
category: import_zod9.z.enum(["finance", "news", "sports"]).optional().describe("Optional web-result category filter."),
|
|
2424
|
+
include_domains: import_zod9.z.array(import_zod9.z.string()).optional().describe("Only return results from these bare domains."),
|
|
2425
|
+
exclude_domains: import_zod9.z.array(import_zod9.z.string()).optional().describe("Exclude results from these bare domains."),
|
|
2426
|
+
snippet_max_chars: import_zod9.z.number().optional().describe("Maximum characters in each web-result snippet."),
|
|
2427
|
+
highlights: import_zod9.z.boolean().optional().describe(
|
|
2342
2428
|
"Include highlighted passages in web results. Defaults to true in AI Gateway."
|
|
2343
2429
|
),
|
|
2344
|
-
article_content_max_chars:
|
|
2430
|
+
article_content_max_chars: import_zod9.z.number().optional().describe(
|
|
2345
2431
|
"Maximum extracted characters per web page when including contents."
|
|
2346
2432
|
),
|
|
2347
|
-
published_after:
|
|
2433
|
+
published_after: import_zod9.z.string().optional().describe(
|
|
2348
2434
|
"Keep results published on or after this ISO date (YYYY-MM-DD)."
|
|
2349
2435
|
),
|
|
2350
|
-
published_before:
|
|
2436
|
+
published_before: import_zod9.z.string().optional().describe(
|
|
2351
2437
|
"Keep results published on or before this ISO date (YYYY-MM-DD)."
|
|
2352
2438
|
)
|
|
2353
2439
|
});
|
|
2354
|
-
var takoSearchInputSchema = (0,
|
|
2355
|
-
() => (0,
|
|
2356
|
-
|
|
2357
|
-
query:
|
|
2440
|
+
var takoSearchInputSchema = (0, import_provider_utils23.lazySchema)(
|
|
2441
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2442
|
+
import_zod9.z.object({
|
|
2443
|
+
query: import_zod9.z.string().describe(
|
|
2358
2444
|
'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.'
|
|
2359
2445
|
),
|
|
2360
|
-
effort:
|
|
2446
|
+
effort: import_zod9.z.enum(["deep", "fast", "instant"]).optional().describe(
|
|
2361
2447
|
"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."
|
|
2362
2448
|
),
|
|
2363
|
-
sources:
|
|
2449
|
+
sources: import_zod9.z.object({
|
|
2364
2450
|
data: takoDataSourceInputSchema().optional(),
|
|
2365
2451
|
web: takoWebSourceInputSchema().optional()
|
|
2366
2452
|
}).optional().describe(
|
|
2367
2453
|
"Sources to search. Omit to search both curated data and the web. When provided, only keys present are searched."
|
|
2368
2454
|
),
|
|
2369
|
-
location:
|
|
2370
|
-
latitude:
|
|
2371
|
-
longitude:
|
|
2455
|
+
location: import_zod9.z.object({
|
|
2456
|
+
latitude: import_zod9.z.number().describe("Latitude between -90 and 90."),
|
|
2457
|
+
longitude: import_zod9.z.number().describe("Longitude between -180 and 180.")
|
|
2372
2458
|
}).optional().describe("End-user coordinates for localized results."),
|
|
2373
|
-
country_code:
|
|
2374
|
-
locale:
|
|
2375
|
-
timezone:
|
|
2376
|
-
output_settings:
|
|
2377
|
-
image_dark_mode:
|
|
2378
|
-
force_refresh:
|
|
2459
|
+
country_code: import_zod9.z.string().optional().describe("Two-letter ISO 3166-1 country code, such as 'US'."),
|
|
2460
|
+
locale: import_zod9.z.string().optional().describe("BCP-47 locale, such as 'en-US'."),
|
|
2461
|
+
timezone: import_zod9.z.string().optional().describe("IANA timezone, such as 'America/New_York'."),
|
|
2462
|
+
output_settings: import_zod9.z.object({
|
|
2463
|
+
image_dark_mode: import_zod9.z.boolean().optional().describe("Render card preview images in dark mode."),
|
|
2464
|
+
force_refresh: import_zod9.z.boolean().optional().describe(
|
|
2379
2465
|
"Instant-effort only. Request a refreshed instant result."
|
|
2380
2466
|
)
|
|
2381
2467
|
}).optional().describe("Controls card rendering in the search response."),
|
|
2382
|
-
include_related:
|
|
2468
|
+
include_related: import_zod9.z.number().optional().describe("Maximum related search suggestions to include (1-20).")
|
|
2383
2469
|
})
|
|
2384
2470
|
)
|
|
2385
2471
|
);
|
|
2386
|
-
var takoDatasetCellSchema = () =>
|
|
2387
|
-
var takoResultContentSchema = () =>
|
|
2388
|
-
content_format:
|
|
2389
|
-
cost:
|
|
2390
|
-
data:
|
|
2391
|
-
records:
|
|
2392
|
-
dataset:
|
|
2393
|
-
columns:
|
|
2394
|
-
|
|
2395
|
-
name:
|
|
2396
|
-
type:
|
|
2397
|
-
unit:
|
|
2472
|
+
var takoDatasetCellSchema = () => import_zod9.z.union([import_zod9.z.boolean(), import_zod9.z.number(), import_zod9.z.string()]).nullable();
|
|
2473
|
+
var takoResultContentSchema = () => import_zod9.z.object({
|
|
2474
|
+
content_format: import_zod9.z.enum(["card_json", "csv", "json_compact", "json_records"]).nullish(),
|
|
2475
|
+
cost: import_zod9.z.number().optional(),
|
|
2476
|
+
data: import_zod9.z.string().nullish(),
|
|
2477
|
+
records: import_zod9.z.array(import_zod9.z.record(import_zod9.z.string(), takoDatasetCellSchema())).nullish(),
|
|
2478
|
+
dataset: import_zod9.z.object({
|
|
2479
|
+
columns: import_zod9.z.array(
|
|
2480
|
+
import_zod9.z.object({
|
|
2481
|
+
name: import_zod9.z.string(),
|
|
2482
|
+
type: import_zod9.z.enum(["boolean", "date", "datetime", "number", "string"]),
|
|
2483
|
+
unit: import_zod9.z.string().nullish()
|
|
2398
2484
|
})
|
|
2399
2485
|
),
|
|
2400
|
-
rows:
|
|
2401
|
-
total_rows:
|
|
2402
|
-
truncated:
|
|
2403
|
-
ref:
|
|
2404
|
-
sources:
|
|
2405
|
-
|
|
2406
|
-
name:
|
|
2407
|
-
index:
|
|
2486
|
+
rows: import_zod9.z.array(import_zod9.z.array(takoDatasetCellSchema())),
|
|
2487
|
+
total_rows: import_zod9.z.number(),
|
|
2488
|
+
truncated: import_zod9.z.boolean(),
|
|
2489
|
+
ref: import_zod9.z.string(),
|
|
2490
|
+
sources: import_zod9.z.array(
|
|
2491
|
+
import_zod9.z.object({
|
|
2492
|
+
name: import_zod9.z.string(),
|
|
2493
|
+
index: import_zod9.z.enum(["data", "web"]).optional()
|
|
2408
2494
|
})
|
|
2409
2495
|
),
|
|
2410
|
-
provenance:
|
|
2496
|
+
provenance: import_zod9.z.enum(["query", "web_extraction"]).optional()
|
|
2411
2497
|
}).nullish(),
|
|
2412
|
-
card_data:
|
|
2413
|
-
card_data_schema:
|
|
2414
|
-
url:
|
|
2415
|
-
expires_at:
|
|
2416
|
-
total_rows:
|
|
2417
|
-
truncated:
|
|
2418
|
-
export_pricing:
|
|
2419
|
-
baseline_usd:
|
|
2420
|
-
free_rows:
|
|
2421
|
-
max_rows_ceiling:
|
|
2422
|
-
row_cpm_usd:
|
|
2498
|
+
card_data: import_zod9.z.object({}).passthrough().nullish(),
|
|
2499
|
+
card_data_schema: import_zod9.z.object({}).passthrough().nullish(),
|
|
2500
|
+
url: import_zod9.z.string().nullish(),
|
|
2501
|
+
expires_at: import_zod9.z.string().nullish(),
|
|
2502
|
+
total_rows: import_zod9.z.number().nullish(),
|
|
2503
|
+
truncated: import_zod9.z.boolean().optional(),
|
|
2504
|
+
export_pricing: import_zod9.z.object({
|
|
2505
|
+
baseline_usd: import_zod9.z.number(),
|
|
2506
|
+
free_rows: import_zod9.z.number(),
|
|
2507
|
+
max_rows_ceiling: import_zod9.z.number(),
|
|
2508
|
+
row_cpm_usd: import_zod9.z.number()
|
|
2423
2509
|
}).nullish(),
|
|
2424
|
-
manifest:
|
|
2425
|
-
|
|
2426
|
-
dtype:
|
|
2427
|
-
entity:
|
|
2428
|
-
metric:
|
|
2429
|
-
name:
|
|
2430
|
-
unit:
|
|
2510
|
+
manifest: import_zod9.z.array(
|
|
2511
|
+
import_zod9.z.object({
|
|
2512
|
+
dtype: import_zod9.z.enum(["boolean", "date", "datetime", "number", "string"]).nullish(),
|
|
2513
|
+
entity: import_zod9.z.string().nullish(),
|
|
2514
|
+
metric: import_zod9.z.string().nullish(),
|
|
2515
|
+
name: import_zod9.z.string().nullish(),
|
|
2516
|
+
unit: import_zod9.z.string().nullish()
|
|
2431
2517
|
})
|
|
2432
2518
|
).nullish()
|
|
2433
2519
|
}).passthrough();
|
|
2434
|
-
var takoCardSchema = () =>
|
|
2435
|
-
card_id:
|
|
2436
|
-
title:
|
|
2437
|
-
description:
|
|
2438
|
-
semantic_description:
|
|
2439
|
-
webpage_url:
|
|
2440
|
-
image_url:
|
|
2441
|
-
embed_url:
|
|
2442
|
-
sources:
|
|
2443
|
-
|
|
2444
|
-
source_name:
|
|
2445
|
-
source_description:
|
|
2446
|
-
source_index:
|
|
2447
|
-
source_text:
|
|
2448
|
-
url:
|
|
2520
|
+
var takoCardSchema = () => import_zod9.z.object({
|
|
2521
|
+
card_id: import_zod9.z.string().nullish(),
|
|
2522
|
+
title: import_zod9.z.string().nullish(),
|
|
2523
|
+
description: import_zod9.z.string().nullish(),
|
|
2524
|
+
semantic_description: import_zod9.z.string().nullish(),
|
|
2525
|
+
webpage_url: import_zod9.z.string().nullish(),
|
|
2526
|
+
image_url: import_zod9.z.string().nullish(),
|
|
2527
|
+
embed_url: import_zod9.z.string().nullish(),
|
|
2528
|
+
sources: import_zod9.z.array(
|
|
2529
|
+
import_zod9.z.object({
|
|
2530
|
+
source_name: import_zod9.z.string().nullish(),
|
|
2531
|
+
source_description: import_zod9.z.string().nullish(),
|
|
2532
|
+
source_index: import_zod9.z.enum(["data", "web"]),
|
|
2533
|
+
source_text: import_zod9.z.string().nullish(),
|
|
2534
|
+
url: import_zod9.z.string().nullish()
|
|
2449
2535
|
})
|
|
2450
2536
|
).nullish(),
|
|
2451
|
-
methodologies:
|
|
2452
|
-
|
|
2453
|
-
methodology_name:
|
|
2454
|
-
methodology_description:
|
|
2537
|
+
methodologies: import_zod9.z.array(
|
|
2538
|
+
import_zod9.z.object({
|
|
2539
|
+
methodology_name: import_zod9.z.string().nullable(),
|
|
2540
|
+
methodology_description: import_zod9.z.string().nullable()
|
|
2455
2541
|
})
|
|
2456
2542
|
).nullish(),
|
|
2457
|
-
source_indexes:
|
|
2458
|
-
card_type:
|
|
2459
|
-
relevance:
|
|
2543
|
+
source_indexes: import_zod9.z.array(import_zod9.z.enum(["data", "web"])).nullish(),
|
|
2544
|
+
card_type: import_zod9.z.string().nullish(),
|
|
2545
|
+
relevance: import_zod9.z.enum(["High", "Low", "Medium"]).nullish(),
|
|
2460
2546
|
content: takoResultContentSchema().nullish(),
|
|
2461
|
-
exportable:
|
|
2462
|
-
nodes:
|
|
2463
|
-
|
|
2464
|
-
id:
|
|
2465
|
-
type:
|
|
2466
|
-
name:
|
|
2467
|
-
description:
|
|
2547
|
+
exportable: import_zod9.z.boolean().optional(),
|
|
2548
|
+
nodes: import_zod9.z.array(
|
|
2549
|
+
import_zod9.z.object({
|
|
2550
|
+
id: import_zod9.z.string(),
|
|
2551
|
+
type: import_zod9.z.enum(["entity", "metric"]),
|
|
2552
|
+
name: import_zod9.z.string(),
|
|
2553
|
+
description: import_zod9.z.string().nullish()
|
|
2468
2554
|
})
|
|
2469
2555
|
).nullish(),
|
|
2470
|
-
metric_definitions:
|
|
2471
|
-
data_freshness:
|
|
2472
|
-
coverage_end:
|
|
2473
|
-
data_as_of:
|
|
2474
|
-
last_updated:
|
|
2556
|
+
metric_definitions: import_zod9.z.array(import_zod9.z.object({ name: import_zod9.z.string(), definition: import_zod9.z.string() })).nullish(),
|
|
2557
|
+
data_freshness: import_zod9.z.object({
|
|
2558
|
+
coverage_end: import_zod9.z.string().nullish(),
|
|
2559
|
+
data_as_of: import_zod9.z.string().nullish(),
|
|
2560
|
+
last_updated: import_zod9.z.string().nullish()
|
|
2475
2561
|
}).nullish()
|
|
2476
2562
|
}).passthrough();
|
|
2477
|
-
var takoWebResultSchema = () =>
|
|
2478
|
-
title:
|
|
2479
|
-
url:
|
|
2480
|
-
snippet:
|
|
2481
|
-
source_name:
|
|
2482
|
-
publish_date:
|
|
2563
|
+
var takoWebResultSchema = () => import_zod9.z.object({
|
|
2564
|
+
title: import_zod9.z.string(),
|
|
2565
|
+
url: import_zod9.z.string(),
|
|
2566
|
+
snippet: import_zod9.z.string().nullish(),
|
|
2567
|
+
source_name: import_zod9.z.string().nullish(),
|
|
2568
|
+
publish_date: import_zod9.z.string().nullish(),
|
|
2483
2569
|
content: takoResultContentSchema().nullish()
|
|
2484
2570
|
}).passthrough();
|
|
2485
|
-
var takoSearchOutputSchema = (0,
|
|
2486
|
-
() => (0,
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
request_id:
|
|
2490
|
-
cards:
|
|
2491
|
-
web_results:
|
|
2492
|
-
usage:
|
|
2493
|
-
total_cost_usd:
|
|
2494
|
-
compute:
|
|
2495
|
-
data:
|
|
2571
|
+
var takoSearchOutputSchema = (0, import_provider_utils23.lazySchema)(
|
|
2572
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2573
|
+
import_zod9.z.union([
|
|
2574
|
+
import_zod9.z.object({
|
|
2575
|
+
request_id: import_zod9.z.string(),
|
|
2576
|
+
cards: import_zod9.z.array(takoCardSchema()).optional(),
|
|
2577
|
+
web_results: import_zod9.z.array(takoWebResultSchema()).optional(),
|
|
2578
|
+
usage: import_zod9.z.object({
|
|
2579
|
+
total_cost_usd: import_zod9.z.number(),
|
|
2580
|
+
compute: import_zod9.z.object({ cost_usd: import_zod9.z.number() }).nullish(),
|
|
2581
|
+
data: import_zod9.z.object({ cost_usd: import_zod9.z.number(), datasets: import_zod9.z.number() }).nullish()
|
|
2496
2582
|
}).nullish(),
|
|
2497
|
-
related:
|
|
2583
|
+
related: import_zod9.z.array(import_zod9.z.object({}).passthrough()).nullish()
|
|
2498
2584
|
}).passthrough(),
|
|
2499
|
-
|
|
2500
|
-
error: import_zod6.z.enum([
|
|
2501
|
-
"api_error",
|
|
2502
|
-
"configuration_error",
|
|
2503
|
-
"execution_error",
|
|
2504
|
-
"invalid_input",
|
|
2505
|
-
"rate_limit",
|
|
2506
|
-
"timeout",
|
|
2507
|
-
"unknown_tool"
|
|
2508
|
-
]),
|
|
2509
|
-
statusCode: import_zod6.z.number().optional(),
|
|
2510
|
-
message: import_zod6.z.string()
|
|
2511
|
-
})
|
|
2585
|
+
gatewayToolErrorSchema()
|
|
2512
2586
|
])
|
|
2513
2587
|
)
|
|
2514
2588
|
);
|
|
2515
|
-
var takoSearchToolFactory = (0,
|
|
2589
|
+
var takoSearchToolFactory = (0, import_provider_utils23.createProviderToolFactoryWithOutputSchema)({
|
|
2516
2590
|
id: "gateway.tako_search",
|
|
2517
2591
|
inputSchema: takoSearchInputSchema,
|
|
2518
2592
|
outputSchema: takoSearchOutputSchema
|
|
@@ -2535,6 +2609,16 @@ var gatewayTools = {
|
|
|
2535
2609
|
* a browser session.
|
|
2536
2610
|
*/
|
|
2537
2611
|
browserbaseSearch,
|
|
2612
|
+
/**
|
|
2613
|
+
* Fetch a page as Markdown through DeepSeek's standalone Fetch API.
|
|
2614
|
+
* Executed by AI Gateway for any model, separate from native model web search.
|
|
2615
|
+
*/
|
|
2616
|
+
deepseekFetch,
|
|
2617
|
+
/**
|
|
2618
|
+
* Search the web through DeepSeek's standalone Search API.
|
|
2619
|
+
* Executed by AI Gateway for any model, separate from native model web search.
|
|
2620
|
+
*/
|
|
2621
|
+
deepseekSearch,
|
|
2538
2622
|
/**
|
|
2539
2623
|
* Search the web using Exa for current information and token-efficient
|
|
2540
2624
|
* excerpts optimized for agent workflows.
|
|
@@ -2580,7 +2664,7 @@ async function getVercelRequestId() {
|
|
|
2580
2664
|
}
|
|
2581
2665
|
|
|
2582
2666
|
// src/version.ts
|
|
2583
|
-
var VERSION = true ? "3.0.
|
|
2667
|
+
var VERSION = true ? "3.0.227" : "0.0.0-test";
|
|
2584
2668
|
|
|
2585
2669
|
// src/gateway-provider.ts
|
|
2586
2670
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
@@ -2590,11 +2674,11 @@ function createGatewayProvider(options = {}) {
|
|
|
2590
2674
|
let metadataCache = null;
|
|
2591
2675
|
const cacheRefreshMillis = (_a11 = options.metadataCacheRefreshMillis) != null ? _a11 : 1e3 * 60 * 5;
|
|
2592
2676
|
let lastFetchTime = 0;
|
|
2593
|
-
const baseURL = (_b11 = (0,
|
|
2677
|
+
const baseURL = (_b11 = (0, import_provider_utils24.withoutTrailingSlash)(options.baseURL)) != null ? _b11 : "https://ai-gateway.vercel.sh/v3/ai";
|
|
2594
2678
|
const getHeaders = async () => {
|
|
2595
2679
|
try {
|
|
2596
2680
|
const auth = await getGatewayAuthToken(options);
|
|
2597
|
-
return (0,
|
|
2681
|
+
return (0, import_provider_utils24.withUserAgentSuffix)(
|
|
2598
2682
|
{
|
|
2599
2683
|
Authorization: `Bearer ${auth.token}`,
|
|
2600
2684
|
"ai-gateway-protocol-version": AI_GATEWAY_PROTOCOL_VERSION,
|
|
@@ -2613,19 +2697,19 @@ function createGatewayProvider(options = {}) {
|
|
|
2613
2697
|
}
|
|
2614
2698
|
};
|
|
2615
2699
|
const createO11yHeaders = () => {
|
|
2616
|
-
const deploymentId = (0,
|
|
2700
|
+
const deploymentId = (0, import_provider_utils24.loadOptionalSetting)({
|
|
2617
2701
|
settingValue: void 0,
|
|
2618
2702
|
environmentVariableName: "VERCEL_DEPLOYMENT_ID"
|
|
2619
2703
|
});
|
|
2620
|
-
const environment = (0,
|
|
2704
|
+
const environment = (0, import_provider_utils24.loadOptionalSetting)({
|
|
2621
2705
|
settingValue: void 0,
|
|
2622
2706
|
environmentVariableName: "VERCEL_ENV"
|
|
2623
2707
|
});
|
|
2624
|
-
const region = (0,
|
|
2708
|
+
const region = (0, import_provider_utils24.loadOptionalSetting)({
|
|
2625
2709
|
settingValue: void 0,
|
|
2626
2710
|
environmentVariableName: "VERCEL_REGION"
|
|
2627
2711
|
});
|
|
2628
|
-
const projectId = (0,
|
|
2712
|
+
const projectId = (0, import_provider_utils24.loadOptionalSetting)({
|
|
2629
2713
|
settingValue: void 0,
|
|
2630
2714
|
environmentVariableName: "VERCEL_PROJECT_ID"
|
|
2631
2715
|
});
|
|
@@ -2791,7 +2875,7 @@ function createGatewayProvider(options = {}) {
|
|
|
2791
2875
|
}
|
|
2792
2876
|
var gateway = createGatewayProvider();
|
|
2793
2877
|
async function getGatewayAuthToken(options) {
|
|
2794
|
-
const apiKey = (0,
|
|
2878
|
+
const apiKey = (0, import_provider_utils24.loadOptionalSetting)({
|
|
2795
2879
|
settingValue: options.apiKey,
|
|
2796
2880
|
environmentVariableName: "AI_GATEWAY_API_KEY"
|
|
2797
2881
|
});
|