@ai-sdk/gateway 4.0.0-beta.110 → 4.0.0-beta.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.d.ts +135 -0
- package/dist/index.js +215 -74
- package/dist/index.js.map +1 -1
- package/docs/00-ai-gateway.mdx +87 -0
- package/package.json +1 -1
- package/src/gateway-tools.ts +10 -0
- package/src/tool/exa-search.ts +352 -0
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -491,10 +491,145 @@ interface ParallelSearchInput {
|
|
|
491
491
|
type ParallelSearchOutput = ParallelSearchResponse | ParallelSearchError;
|
|
492
492
|
declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderExecutedToolFactory<ParallelSearchInput, ParallelSearchOutput, ParallelSearchConfig, {}>;
|
|
493
493
|
|
|
494
|
+
type ExaSearchType = 'auto' | 'fast' | 'instant';
|
|
495
|
+
type ExaSearchCategory = 'company' | 'people' | 'research paper' | 'news' | 'personal site' | 'financial report';
|
|
496
|
+
type ExaTextSection = 'header' | 'navigation' | 'banner' | 'body' | 'sidebar' | 'footer' | 'metadata';
|
|
497
|
+
interface ExaSearchTextConfig {
|
|
498
|
+
maxCharacters?: number;
|
|
499
|
+
includeHtmlTags?: boolean;
|
|
500
|
+
verbosity?: 'compact' | 'standard' | 'full';
|
|
501
|
+
includeSections?: ExaTextSection[];
|
|
502
|
+
excludeSections?: ExaTextSection[];
|
|
503
|
+
}
|
|
504
|
+
interface ExaSearchHighlightsConfig {
|
|
505
|
+
query?: string;
|
|
506
|
+
maxCharacters?: number;
|
|
507
|
+
}
|
|
508
|
+
interface ExaSearchExtrasConfig {
|
|
509
|
+
links?: number;
|
|
510
|
+
imageLinks?: number;
|
|
511
|
+
}
|
|
512
|
+
interface ExaSearchContentsConfig {
|
|
513
|
+
text?: boolean | ExaSearchTextConfig;
|
|
514
|
+
highlights?: boolean | ExaSearchHighlightsConfig;
|
|
515
|
+
maxAgeHours?: number;
|
|
516
|
+
livecrawlTimeout?: number;
|
|
517
|
+
subpages?: number;
|
|
518
|
+
subpageTarget?: string | string[];
|
|
519
|
+
extras?: ExaSearchExtrasConfig;
|
|
520
|
+
}
|
|
521
|
+
interface ExaSearchConfig {
|
|
522
|
+
/**
|
|
523
|
+
* Default search method. Exa defaults to auto when omitted.
|
|
524
|
+
*/
|
|
525
|
+
type?: ExaSearchType;
|
|
526
|
+
/**
|
|
527
|
+
* Default maximum number of results to return (1-100, default: 10).
|
|
528
|
+
*/
|
|
529
|
+
numResults?: number;
|
|
530
|
+
/**
|
|
531
|
+
* Default category filter for result types.
|
|
532
|
+
*/
|
|
533
|
+
category?: ExaSearchCategory;
|
|
534
|
+
/**
|
|
535
|
+
* Default two-letter ISO country code for location-aware search.
|
|
536
|
+
*/
|
|
537
|
+
userLocation?: string;
|
|
538
|
+
/**
|
|
539
|
+
* Default domains to include or exclude.
|
|
540
|
+
*/
|
|
541
|
+
includeDomains?: string[];
|
|
542
|
+
excludeDomains?: string[];
|
|
543
|
+
/**
|
|
544
|
+
* Default published date filters in ISO 8601 format.
|
|
545
|
+
*/
|
|
546
|
+
startPublishedDate?: string;
|
|
547
|
+
endPublishedDate?: string;
|
|
548
|
+
/**
|
|
549
|
+
* Default content extraction controls.
|
|
550
|
+
*/
|
|
551
|
+
contents?: ExaSearchContentsConfig;
|
|
552
|
+
}
|
|
553
|
+
interface ExaSearchResult {
|
|
554
|
+
title: string;
|
|
555
|
+
url: string;
|
|
556
|
+
id: string;
|
|
557
|
+
publishedDate?: string | null;
|
|
558
|
+
author?: string | null;
|
|
559
|
+
image?: string | null;
|
|
560
|
+
favicon?: string | null;
|
|
561
|
+
text?: string;
|
|
562
|
+
highlights?: string[];
|
|
563
|
+
highlightScores?: number[];
|
|
564
|
+
summary?: string;
|
|
565
|
+
subpages?: ExaSearchResult[];
|
|
566
|
+
extras?: {
|
|
567
|
+
links?: string[];
|
|
568
|
+
imageLinks?: string[];
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
interface ExaSearchResponse {
|
|
572
|
+
requestId: string;
|
|
573
|
+
searchType?: string;
|
|
574
|
+
resolvedSearchType?: string;
|
|
575
|
+
results: ExaSearchResult[];
|
|
576
|
+
costDollars?: {
|
|
577
|
+
total?: number;
|
|
578
|
+
search?: Record<string, number>;
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
interface ExaSearchError {
|
|
582
|
+
error: 'api_error' | 'rate_limit' | 'timeout' | 'invalid_input' | 'configuration_error' | 'execution_error' | 'unknown';
|
|
583
|
+
statusCode?: number;
|
|
584
|
+
message: string;
|
|
585
|
+
}
|
|
586
|
+
interface ExaSearchInput {
|
|
587
|
+
query: string;
|
|
588
|
+
type?: ExaSearchType;
|
|
589
|
+
num_results?: number;
|
|
590
|
+
category?: ExaSearchCategory;
|
|
591
|
+
user_location?: string;
|
|
592
|
+
include_domains?: string[];
|
|
593
|
+
exclude_domains?: string[];
|
|
594
|
+
start_published_date?: string;
|
|
595
|
+
end_published_date?: string;
|
|
596
|
+
contents?: {
|
|
597
|
+
text?: boolean | {
|
|
598
|
+
max_characters?: number;
|
|
599
|
+
include_html_tags?: boolean;
|
|
600
|
+
verbosity?: 'compact' | 'standard' | 'full';
|
|
601
|
+
include_sections?: ExaTextSection[];
|
|
602
|
+
exclude_sections?: ExaTextSection[];
|
|
603
|
+
};
|
|
604
|
+
highlights?: boolean | {
|
|
605
|
+
query?: string;
|
|
606
|
+
max_characters?: number;
|
|
607
|
+
};
|
|
608
|
+
max_age_hours?: number;
|
|
609
|
+
livecrawl_timeout?: number;
|
|
610
|
+
subpages?: number;
|
|
611
|
+
subpage_target?: string | string[];
|
|
612
|
+
extras?: {
|
|
613
|
+
links?: number;
|
|
614
|
+
image_links?: number;
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
type ExaSearchOutput = ExaSearchResponse | ExaSearchError;
|
|
619
|
+
declare const exaSearchToolFactory: _ai_sdk_provider_utils.ProviderExecutedToolFactory<ExaSearchInput, ExaSearchOutput, ExaSearchConfig, {}>;
|
|
620
|
+
|
|
494
621
|
/**
|
|
495
622
|
* Gateway-specific provider-defined tools.
|
|
496
623
|
*/
|
|
497
624
|
declare const gatewayTools: {
|
|
625
|
+
/**
|
|
626
|
+
* Search the web using Exa for current information and token-efficient
|
|
627
|
+
* excerpts optimized for agent workflows.
|
|
628
|
+
*
|
|
629
|
+
* Supports search type, category, domain, date, location, and content
|
|
630
|
+
* extraction controls.
|
|
631
|
+
*/
|
|
632
|
+
exaSearch: (config?: ExaSearchConfig) => ReturnType<typeof exaSearchToolFactory>;
|
|
498
633
|
/**
|
|
499
634
|
* Search the web using Parallel AI's Search API for LLM-optimized excerpts.
|
|
500
635
|
*
|
package/dist/index.js
CHANGED
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
withoutTrailingSlash,
|
|
62
62
|
withUserAgentSuffix
|
|
63
63
|
} from "@ai-sdk/provider-utils";
|
|
64
|
-
import { z as
|
|
64
|
+
import { z as z17 } from "zod/v4";
|
|
65
65
|
|
|
66
66
|
// src/errors/as-gateway-error.ts
|
|
67
67
|
import { APICallError } from "@ai-sdk/provider";
|
|
@@ -2009,68 +2009,201 @@ function toGatewayRealtimeUrl(baseURL, modelId) {
|
|
|
2009
2009
|
return url.toString();
|
|
2010
2010
|
}
|
|
2011
2011
|
|
|
2012
|
-
// src/tool/
|
|
2012
|
+
// src/tool/exa-search.ts
|
|
2013
2013
|
import {
|
|
2014
2014
|
createProviderExecutedToolFactory,
|
|
2015
2015
|
lazySchema as lazySchema9,
|
|
2016
2016
|
zodSchema as zodSchema9
|
|
2017
2017
|
} from "@ai-sdk/provider-utils";
|
|
2018
2018
|
import { z as z14 } from "zod";
|
|
2019
|
-
var
|
|
2019
|
+
var exaSearchInputSchema = lazySchema9(
|
|
2020
2020
|
() => zodSchema9(
|
|
2021
2021
|
z14.object({
|
|
2022
|
-
|
|
2022
|
+
query: z14.string().describe("Natural-language web search query. This is required."),
|
|
2023
|
+
type: z14.enum(["auto", "fast", "instant"]).optional().describe(
|
|
2024
|
+
"Search method. Use auto for the default balance of speed and quality."
|
|
2025
|
+
),
|
|
2026
|
+
num_results: z14.number().optional().describe("Maximum number of results to return (1-100, default: 10)."),
|
|
2027
|
+
category: z14.enum([
|
|
2028
|
+
"company",
|
|
2029
|
+
"people",
|
|
2030
|
+
"research paper",
|
|
2031
|
+
"news",
|
|
2032
|
+
"personal site",
|
|
2033
|
+
"financial report"
|
|
2034
|
+
]).optional().describe("Optional content category to focus results."),
|
|
2035
|
+
user_location: z14.string().optional().describe("Two-letter ISO country code such as 'US'."),
|
|
2036
|
+
include_domains: z14.array(z14.string()).optional().describe("Only return results from these domains."),
|
|
2037
|
+
exclude_domains: z14.array(z14.string()).optional().describe("Exclude results from these domains."),
|
|
2038
|
+
start_published_date: z14.string().optional().describe("Only return links published after this ISO 8601 date."),
|
|
2039
|
+
end_published_date: z14.string().optional().describe("Only return links published before this ISO 8601 date."),
|
|
2040
|
+
contents: z14.object({
|
|
2041
|
+
text: z14.union([
|
|
2042
|
+
z14.boolean(),
|
|
2043
|
+
z14.object({
|
|
2044
|
+
max_characters: z14.number().optional(),
|
|
2045
|
+
include_html_tags: z14.boolean().optional(),
|
|
2046
|
+
verbosity: z14.enum(["compact", "standard", "full"]).optional(),
|
|
2047
|
+
include_sections: z14.array(
|
|
2048
|
+
z14.enum([
|
|
2049
|
+
"header",
|
|
2050
|
+
"navigation",
|
|
2051
|
+
"banner",
|
|
2052
|
+
"body",
|
|
2053
|
+
"sidebar",
|
|
2054
|
+
"footer",
|
|
2055
|
+
"metadata"
|
|
2056
|
+
])
|
|
2057
|
+
).optional(),
|
|
2058
|
+
exclude_sections: z14.array(
|
|
2059
|
+
z14.enum([
|
|
2060
|
+
"header",
|
|
2061
|
+
"navigation",
|
|
2062
|
+
"banner",
|
|
2063
|
+
"body",
|
|
2064
|
+
"sidebar",
|
|
2065
|
+
"footer",
|
|
2066
|
+
"metadata"
|
|
2067
|
+
])
|
|
2068
|
+
).optional()
|
|
2069
|
+
})
|
|
2070
|
+
]).optional(),
|
|
2071
|
+
highlights: z14.union([
|
|
2072
|
+
z14.boolean(),
|
|
2073
|
+
z14.object({
|
|
2074
|
+
query: z14.string().optional(),
|
|
2075
|
+
max_characters: z14.number().optional()
|
|
2076
|
+
})
|
|
2077
|
+
]).optional(),
|
|
2078
|
+
max_age_hours: z14.number().optional(),
|
|
2079
|
+
livecrawl_timeout: z14.number().optional(),
|
|
2080
|
+
subpages: z14.number().optional(),
|
|
2081
|
+
subpage_target: z14.union([z14.string(), z14.array(z14.string())]).optional(),
|
|
2082
|
+
extras: z14.object({
|
|
2083
|
+
links: z14.number().optional(),
|
|
2084
|
+
image_links: z14.number().optional()
|
|
2085
|
+
}).optional()
|
|
2086
|
+
}).optional().describe("Controls extracted page content and freshness.")
|
|
2087
|
+
})
|
|
2088
|
+
)
|
|
2089
|
+
);
|
|
2090
|
+
var exaSearchOutputSchema = lazySchema9(
|
|
2091
|
+
() => zodSchema9(
|
|
2092
|
+
z14.union([
|
|
2093
|
+
z14.object({
|
|
2094
|
+
requestId: z14.string(),
|
|
2095
|
+
searchType: z14.string().optional(),
|
|
2096
|
+
resolvedSearchType: z14.string().optional(),
|
|
2097
|
+
results: z14.array(
|
|
2098
|
+
z14.object({
|
|
2099
|
+
title: z14.string(),
|
|
2100
|
+
url: z14.string(),
|
|
2101
|
+
id: z14.string(),
|
|
2102
|
+
publishedDate: z14.string().nullable().optional(),
|
|
2103
|
+
author: z14.string().nullable().optional(),
|
|
2104
|
+
image: z14.string().nullable().optional(),
|
|
2105
|
+
favicon: z14.string().nullable().optional(),
|
|
2106
|
+
text: z14.string().optional(),
|
|
2107
|
+
highlights: z14.array(z14.string()).optional(),
|
|
2108
|
+
highlightScores: z14.array(z14.number()).optional(),
|
|
2109
|
+
summary: z14.string().optional(),
|
|
2110
|
+
subpages: z14.array(z14.any()).optional(),
|
|
2111
|
+
extras: z14.object({
|
|
2112
|
+
links: z14.array(z14.string()).optional(),
|
|
2113
|
+
imageLinks: z14.array(z14.string()).optional()
|
|
2114
|
+
}).optional()
|
|
2115
|
+
})
|
|
2116
|
+
),
|
|
2117
|
+
costDollars: z14.object({
|
|
2118
|
+
total: z14.number().optional(),
|
|
2119
|
+
search: z14.record(z14.number()).optional()
|
|
2120
|
+
}).optional()
|
|
2121
|
+
}),
|
|
2122
|
+
z14.object({
|
|
2123
|
+
error: z14.enum([
|
|
2124
|
+
"api_error",
|
|
2125
|
+
"rate_limit",
|
|
2126
|
+
"timeout",
|
|
2127
|
+
"invalid_input",
|
|
2128
|
+
"configuration_error",
|
|
2129
|
+
"execution_error",
|
|
2130
|
+
"unknown"
|
|
2131
|
+
]),
|
|
2132
|
+
statusCode: z14.number().optional(),
|
|
2133
|
+
message: z14.string()
|
|
2134
|
+
})
|
|
2135
|
+
])
|
|
2136
|
+
)
|
|
2137
|
+
);
|
|
2138
|
+
var exaSearchToolFactory = createProviderExecutedToolFactory({
|
|
2139
|
+
id: "gateway.exa_search",
|
|
2140
|
+
inputSchema: exaSearchInputSchema,
|
|
2141
|
+
outputSchema: exaSearchOutputSchema
|
|
2142
|
+
});
|
|
2143
|
+
var exaSearch = (config = {}) => exaSearchToolFactory(config);
|
|
2144
|
+
|
|
2145
|
+
// src/tool/parallel-search.ts
|
|
2146
|
+
import {
|
|
2147
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
|
|
2148
|
+
lazySchema as lazySchema10,
|
|
2149
|
+
zodSchema as zodSchema10
|
|
2150
|
+
} from "@ai-sdk/provider-utils";
|
|
2151
|
+
import { z as z15 } from "zod";
|
|
2152
|
+
var parallelSearchInputSchema = lazySchema10(
|
|
2153
|
+
() => zodSchema10(
|
|
2154
|
+
z15.object({
|
|
2155
|
+
objective: z15.string().describe(
|
|
2023
2156
|
"Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
|
|
2024
2157
|
),
|
|
2025
|
-
search_queries:
|
|
2158
|
+
search_queries: z15.array(z15.string()).optional().describe(
|
|
2026
2159
|
"Optional search queries to supplement the objective. Maximum 200 characters per query."
|
|
2027
2160
|
),
|
|
2028
|
-
mode:
|
|
2161
|
+
mode: z15.enum(["one-shot", "agentic"]).optional().describe(
|
|
2029
2162
|
'Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'
|
|
2030
2163
|
),
|
|
2031
|
-
max_results:
|
|
2164
|
+
max_results: z15.number().optional().describe(
|
|
2032
2165
|
"Maximum number of results to return (1-20). Defaults to 10 if not specified."
|
|
2033
2166
|
),
|
|
2034
|
-
source_policy:
|
|
2035
|
-
include_domains:
|
|
2036
|
-
exclude_domains:
|
|
2037
|
-
after_date:
|
|
2167
|
+
source_policy: z15.object({
|
|
2168
|
+
include_domains: z15.array(z15.string()).optional().describe("List of domains to include in search results."),
|
|
2169
|
+
exclude_domains: z15.array(z15.string()).optional().describe("List of domains to exclude from search results."),
|
|
2170
|
+
after_date: z15.string().optional().describe(
|
|
2038
2171
|
"Only include results published after this date (ISO 8601 format)."
|
|
2039
2172
|
)
|
|
2040
2173
|
}).optional().describe(
|
|
2041
2174
|
"Source policy for controlling which domains to include/exclude and freshness."
|
|
2042
2175
|
),
|
|
2043
|
-
excerpts:
|
|
2044
|
-
max_chars_per_result:
|
|
2045
|
-
max_chars_total:
|
|
2176
|
+
excerpts: z15.object({
|
|
2177
|
+
max_chars_per_result: z15.number().optional().describe("Maximum characters per result."),
|
|
2178
|
+
max_chars_total: z15.number().optional().describe("Maximum total characters across all results.")
|
|
2046
2179
|
}).optional().describe("Excerpt configuration for controlling result length."),
|
|
2047
|
-
fetch_policy:
|
|
2048
|
-
max_age_seconds:
|
|
2180
|
+
fetch_policy: z15.object({
|
|
2181
|
+
max_age_seconds: z15.number().optional().describe(
|
|
2049
2182
|
"Maximum age in seconds for cached content. Set to 0 to always fetch fresh content."
|
|
2050
2183
|
)
|
|
2051
2184
|
}).optional().describe("Fetch policy for controlling content freshness.")
|
|
2052
2185
|
})
|
|
2053
2186
|
)
|
|
2054
2187
|
);
|
|
2055
|
-
var parallelSearchOutputSchema =
|
|
2056
|
-
() =>
|
|
2057
|
-
|
|
2188
|
+
var parallelSearchOutputSchema = lazySchema10(
|
|
2189
|
+
() => zodSchema10(
|
|
2190
|
+
z15.union([
|
|
2058
2191
|
// Success response
|
|
2059
|
-
|
|
2060
|
-
searchId:
|
|
2061
|
-
results:
|
|
2062
|
-
|
|
2063
|
-
url:
|
|
2064
|
-
title:
|
|
2065
|
-
excerpt:
|
|
2066
|
-
publishDate:
|
|
2067
|
-
relevanceScore:
|
|
2192
|
+
z15.object({
|
|
2193
|
+
searchId: z15.string(),
|
|
2194
|
+
results: z15.array(
|
|
2195
|
+
z15.object({
|
|
2196
|
+
url: z15.string(),
|
|
2197
|
+
title: z15.string(),
|
|
2198
|
+
excerpt: z15.string(),
|
|
2199
|
+
publishDate: z15.string().nullable().optional(),
|
|
2200
|
+
relevanceScore: z15.number().optional()
|
|
2068
2201
|
})
|
|
2069
2202
|
)
|
|
2070
2203
|
}),
|
|
2071
2204
|
// Error response
|
|
2072
|
-
|
|
2073
|
-
error:
|
|
2205
|
+
z15.object({
|
|
2206
|
+
error: z15.enum([
|
|
2074
2207
|
"api_error",
|
|
2075
2208
|
"rate_limit",
|
|
2076
2209
|
"timeout",
|
|
@@ -2078,13 +2211,13 @@ var parallelSearchOutputSchema = lazySchema9(
|
|
|
2078
2211
|
"configuration_error",
|
|
2079
2212
|
"unknown"
|
|
2080
2213
|
]),
|
|
2081
|
-
statusCode:
|
|
2082
|
-
message:
|
|
2214
|
+
statusCode: z15.number().optional(),
|
|
2215
|
+
message: z15.string()
|
|
2083
2216
|
})
|
|
2084
2217
|
])
|
|
2085
2218
|
)
|
|
2086
2219
|
);
|
|
2087
|
-
var parallelSearchToolFactory =
|
|
2220
|
+
var parallelSearchToolFactory = createProviderExecutedToolFactory2({
|
|
2088
2221
|
id: "gateway.parallel_search",
|
|
2089
2222
|
inputSchema: parallelSearchInputSchema,
|
|
2090
2223
|
outputSchema: parallelSearchOutputSchema
|
|
@@ -2093,85 +2226,85 @@ var parallelSearch = (config = {}) => parallelSearchToolFactory(config);
|
|
|
2093
2226
|
|
|
2094
2227
|
// src/tool/perplexity-search.ts
|
|
2095
2228
|
import {
|
|
2096
|
-
createProviderExecutedToolFactory as
|
|
2097
|
-
lazySchema as
|
|
2098
|
-
zodSchema as
|
|
2229
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
|
|
2230
|
+
lazySchema as lazySchema11,
|
|
2231
|
+
zodSchema as zodSchema11
|
|
2099
2232
|
} from "@ai-sdk/provider-utils";
|
|
2100
|
-
import { z as
|
|
2101
|
-
var perplexitySearchInputSchema =
|
|
2102
|
-
() =>
|
|
2103
|
-
|
|
2104
|
-
query:
|
|
2233
|
+
import { z as z16 } from "zod";
|
|
2234
|
+
var perplexitySearchInputSchema = lazySchema11(
|
|
2235
|
+
() => zodSchema11(
|
|
2236
|
+
z16.object({
|
|
2237
|
+
query: z16.union([z16.string(), z16.array(z16.string())]).describe(
|
|
2105
2238
|
"Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."
|
|
2106
2239
|
),
|
|
2107
|
-
max_results:
|
|
2240
|
+
max_results: z16.number().optional().describe(
|
|
2108
2241
|
"Maximum number of search results to return (1-20, default: 10)"
|
|
2109
2242
|
),
|
|
2110
|
-
max_tokens_per_page:
|
|
2243
|
+
max_tokens_per_page: z16.number().optional().describe(
|
|
2111
2244
|
"Maximum number of tokens to extract per search result page (256-2048, default: 2048)"
|
|
2112
2245
|
),
|
|
2113
|
-
max_tokens:
|
|
2246
|
+
max_tokens: z16.number().optional().describe(
|
|
2114
2247
|
"Maximum total tokens across all search results (default: 25000, max: 1000000)"
|
|
2115
2248
|
),
|
|
2116
|
-
country:
|
|
2249
|
+
country: z16.string().optional().describe(
|
|
2117
2250
|
"Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"
|
|
2118
2251
|
),
|
|
2119
|
-
search_domain_filter:
|
|
2252
|
+
search_domain_filter: z16.array(z16.string()).optional().describe(
|
|
2120
2253
|
"List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"
|
|
2121
2254
|
),
|
|
2122
|
-
search_language_filter:
|
|
2255
|
+
search_language_filter: z16.array(z16.string()).optional().describe(
|
|
2123
2256
|
"List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"
|
|
2124
2257
|
),
|
|
2125
|
-
search_after_date:
|
|
2258
|
+
search_after_date: z16.string().optional().describe(
|
|
2126
2259
|
"Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
|
|
2127
2260
|
),
|
|
2128
|
-
search_before_date:
|
|
2261
|
+
search_before_date: z16.string().optional().describe(
|
|
2129
2262
|
"Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
|
|
2130
2263
|
),
|
|
2131
|
-
last_updated_after_filter:
|
|
2264
|
+
last_updated_after_filter: z16.string().optional().describe(
|
|
2132
2265
|
"Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
|
|
2133
2266
|
),
|
|
2134
|
-
last_updated_before_filter:
|
|
2267
|
+
last_updated_before_filter: z16.string().optional().describe(
|
|
2135
2268
|
"Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
|
|
2136
2269
|
),
|
|
2137
|
-
search_recency_filter:
|
|
2270
|
+
search_recency_filter: z16.enum(["day", "week", "month", "year"]).optional().describe(
|
|
2138
2271
|
"Filter results by relative time period. Cannot be used with search_after_date or search_before_date."
|
|
2139
2272
|
)
|
|
2140
2273
|
})
|
|
2141
2274
|
)
|
|
2142
2275
|
);
|
|
2143
|
-
var perplexitySearchOutputSchema =
|
|
2144
|
-
() =>
|
|
2145
|
-
|
|
2276
|
+
var perplexitySearchOutputSchema = lazySchema11(
|
|
2277
|
+
() => zodSchema11(
|
|
2278
|
+
z16.union([
|
|
2146
2279
|
// Success response
|
|
2147
|
-
|
|
2148
|
-
results:
|
|
2149
|
-
|
|
2150
|
-
title:
|
|
2151
|
-
url:
|
|
2152
|
-
snippet:
|
|
2153
|
-
date:
|
|
2154
|
-
lastUpdated:
|
|
2280
|
+
z16.object({
|
|
2281
|
+
results: z16.array(
|
|
2282
|
+
z16.object({
|
|
2283
|
+
title: z16.string(),
|
|
2284
|
+
url: z16.string(),
|
|
2285
|
+
snippet: z16.string(),
|
|
2286
|
+
date: z16.string().optional(),
|
|
2287
|
+
lastUpdated: z16.string().optional()
|
|
2155
2288
|
})
|
|
2156
2289
|
),
|
|
2157
|
-
id:
|
|
2290
|
+
id: z16.string()
|
|
2158
2291
|
}),
|
|
2159
2292
|
// Error response
|
|
2160
|
-
|
|
2161
|
-
error:
|
|
2293
|
+
z16.object({
|
|
2294
|
+
error: z16.enum([
|
|
2162
2295
|
"api_error",
|
|
2163
2296
|
"rate_limit",
|
|
2164
2297
|
"timeout",
|
|
2165
2298
|
"invalid_input",
|
|
2166
2299
|
"unknown"
|
|
2167
2300
|
]),
|
|
2168
|
-
statusCode:
|
|
2169
|
-
message:
|
|
2301
|
+
statusCode: z16.number().optional(),
|
|
2302
|
+
message: z16.string()
|
|
2170
2303
|
})
|
|
2171
2304
|
])
|
|
2172
2305
|
)
|
|
2173
2306
|
);
|
|
2174
|
-
var perplexitySearchToolFactory =
|
|
2307
|
+
var perplexitySearchToolFactory = createProviderExecutedToolFactory3({
|
|
2175
2308
|
id: "gateway.perplexity_search",
|
|
2176
2309
|
inputSchema: perplexitySearchInputSchema,
|
|
2177
2310
|
outputSchema: perplexitySearchOutputSchema
|
|
@@ -2180,6 +2313,14 @@ var perplexitySearch = (config = {}) => perplexitySearchToolFactory(config);
|
|
|
2180
2313
|
|
|
2181
2314
|
// src/gateway-tools.ts
|
|
2182
2315
|
var gatewayTools = {
|
|
2316
|
+
/**
|
|
2317
|
+
* Search the web using Exa for current information and token-efficient
|
|
2318
|
+
* excerpts optimized for agent workflows.
|
|
2319
|
+
*
|
|
2320
|
+
* Supports search type, category, domain, date, location, and content
|
|
2321
|
+
* extraction controls.
|
|
2322
|
+
*/
|
|
2323
|
+
exaSearch,
|
|
2183
2324
|
/**
|
|
2184
2325
|
* Search the web using Parallel AI's Search API for LLM-optimized excerpts.
|
|
2185
2326
|
*
|
|
@@ -2208,13 +2349,13 @@ async function getVercelRequestId() {
|
|
|
2208
2349
|
}
|
|
2209
2350
|
|
|
2210
2351
|
// src/version.ts
|
|
2211
|
-
var VERSION = true ? "4.0.0-beta.
|
|
2352
|
+
var VERSION = true ? "4.0.0-beta.111" : "0.0.0-test";
|
|
2212
2353
|
|
|
2213
2354
|
// src/gateway-provider.ts
|
|
2214
2355
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
2215
|
-
var gatewayClientSecretResponseSchema =
|
|
2216
|
-
token:
|
|
2217
|
-
expiresAt:
|
|
2356
|
+
var gatewayClientSecretResponseSchema = z17.object({
|
|
2357
|
+
token: z17.string(),
|
|
2358
|
+
expiresAt: z17.number().nullish()
|
|
2218
2359
|
});
|
|
2219
2360
|
function createGateway(options = {}) {
|
|
2220
2361
|
var _a11, _b11;
|
|
@@ -2276,7 +2417,7 @@ function createGateway(options = {}) {
|
|
|
2276
2417
|
gatewayClientSecretResponseSchema
|
|
2277
2418
|
),
|
|
2278
2419
|
failedResponseHandler: createJsonErrorResponseHandler11({
|
|
2279
|
-
errorSchema:
|
|
2420
|
+
errorSchema: z17.any(),
|
|
2280
2421
|
errorToMessage: (data) => data
|
|
2281
2422
|
}),
|
|
2282
2423
|
fetch: options.fetch
|