@ai-sdk/gateway 3.0.136 → 3.0.138
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 +19 -0
- package/dist/index.d.mts +135 -0
- package/dist/index.d.ts +135 -0
- package/dist/index.js +219 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +217 -70
- package/dist/index.mjs.map +1 -1
- package/docs/00-ai-gateway.mdx +87 -0
- package/package.json +3 -3
- package/src/gateway-tools.ts +10 -0
- package/src/gateway-video-model.ts +2 -0
- package/src/tool/exa-search.ts +352 -0
- package/src/tool/parallel-search.ts +7 -3
package/dist/index.mjs
CHANGED
|
@@ -1281,6 +1281,7 @@ var GatewayVideoModel = class {
|
|
|
1281
1281
|
duration,
|
|
1282
1282
|
fps,
|
|
1283
1283
|
seed,
|
|
1284
|
+
generateAudio,
|
|
1284
1285
|
image,
|
|
1285
1286
|
providerOptions,
|
|
1286
1287
|
headers,
|
|
@@ -1306,6 +1307,7 @@ var GatewayVideoModel = class {
|
|
|
1306
1307
|
...duration && { duration },
|
|
1307
1308
|
...fps && { fps },
|
|
1308
1309
|
...seed && { seed },
|
|
1310
|
+
...generateAudio !== void 0 && { generateAudio },
|
|
1309
1311
|
...providerOptions && { providerOptions },
|
|
1310
1312
|
...image && { image: maybeEncodeVideoFile(image) }
|
|
1311
1313
|
},
|
|
@@ -1803,68 +1805,205 @@ var gatewayTranscriptionResponseSchema = z13.object({
|
|
|
1803
1805
|
providerMetadata: z13.record(z13.string(), providerMetadataEntrySchema4).optional()
|
|
1804
1806
|
});
|
|
1805
1807
|
|
|
1806
|
-
// src/tool/
|
|
1808
|
+
// src/tool/exa-search.ts
|
|
1807
1809
|
import {
|
|
1808
1810
|
createProviderToolFactoryWithOutputSchema,
|
|
1809
1811
|
lazySchema as lazySchema9,
|
|
1810
1812
|
zodSchema as zodSchema9
|
|
1811
1813
|
} from "@ai-sdk/provider-utils";
|
|
1812
1814
|
import { z as z14 } from "zod";
|
|
1813
|
-
var
|
|
1815
|
+
var exaSearchInputSchema = lazySchema9(
|
|
1814
1816
|
() => zodSchema9(
|
|
1815
1817
|
z14.object({
|
|
1816
|
-
|
|
1818
|
+
query: z14.string().describe("Natural-language web search query. This is required."),
|
|
1819
|
+
type: z14.enum(["auto", "fast", "instant"]).optional().describe(
|
|
1820
|
+
"Search method. Use auto for the default balance of speed and quality."
|
|
1821
|
+
),
|
|
1822
|
+
num_results: z14.number().optional().describe("Maximum number of results to return (1-100, default: 10)."),
|
|
1823
|
+
category: z14.enum([
|
|
1824
|
+
"company",
|
|
1825
|
+
"people",
|
|
1826
|
+
"research paper",
|
|
1827
|
+
"news",
|
|
1828
|
+
"personal site",
|
|
1829
|
+
"financial report"
|
|
1830
|
+
]).optional().describe("Optional content category to focus results."),
|
|
1831
|
+
user_location: z14.string().optional().describe("Two-letter ISO country code such as 'US'."),
|
|
1832
|
+
include_domains: z14.array(z14.string()).optional().describe("Only return results from these domains."),
|
|
1833
|
+
exclude_domains: z14.array(z14.string()).optional().describe("Exclude results from these domains."),
|
|
1834
|
+
start_published_date: z14.string().optional().describe("Only return links published after this ISO 8601 date."),
|
|
1835
|
+
end_published_date: z14.string().optional().describe("Only return links published before this ISO 8601 date."),
|
|
1836
|
+
contents: z14.object({
|
|
1837
|
+
text: z14.union([
|
|
1838
|
+
z14.boolean(),
|
|
1839
|
+
z14.object({
|
|
1840
|
+
max_characters: z14.number().optional(),
|
|
1841
|
+
include_html_tags: z14.boolean().optional(),
|
|
1842
|
+
verbosity: z14.enum(["compact", "standard", "full"]).optional(),
|
|
1843
|
+
include_sections: z14.array(
|
|
1844
|
+
z14.enum([
|
|
1845
|
+
"header",
|
|
1846
|
+
"navigation",
|
|
1847
|
+
"banner",
|
|
1848
|
+
"body",
|
|
1849
|
+
"sidebar",
|
|
1850
|
+
"footer",
|
|
1851
|
+
"metadata"
|
|
1852
|
+
])
|
|
1853
|
+
).optional(),
|
|
1854
|
+
exclude_sections: z14.array(
|
|
1855
|
+
z14.enum([
|
|
1856
|
+
"header",
|
|
1857
|
+
"navigation",
|
|
1858
|
+
"banner",
|
|
1859
|
+
"body",
|
|
1860
|
+
"sidebar",
|
|
1861
|
+
"footer",
|
|
1862
|
+
"metadata"
|
|
1863
|
+
])
|
|
1864
|
+
).optional()
|
|
1865
|
+
})
|
|
1866
|
+
]).optional(),
|
|
1867
|
+
highlights: z14.union([
|
|
1868
|
+
z14.boolean(),
|
|
1869
|
+
z14.object({
|
|
1870
|
+
query: z14.string().optional(),
|
|
1871
|
+
max_characters: z14.number().optional()
|
|
1872
|
+
})
|
|
1873
|
+
]).optional(),
|
|
1874
|
+
max_age_hours: z14.number().optional(),
|
|
1875
|
+
livecrawl_timeout: z14.number().optional(),
|
|
1876
|
+
subpages: z14.number().optional(),
|
|
1877
|
+
subpage_target: z14.union([z14.string(), z14.array(z14.string())]).optional(),
|
|
1878
|
+
extras: z14.object({
|
|
1879
|
+
links: z14.number().optional(),
|
|
1880
|
+
image_links: z14.number().optional()
|
|
1881
|
+
}).optional()
|
|
1882
|
+
}).optional().describe("Controls extracted page content and freshness.")
|
|
1883
|
+
})
|
|
1884
|
+
)
|
|
1885
|
+
);
|
|
1886
|
+
var exaSearchOutputSchema = lazySchema9(
|
|
1887
|
+
() => zodSchema9(
|
|
1888
|
+
z14.union([
|
|
1889
|
+
z14.object({
|
|
1890
|
+
requestId: z14.string(),
|
|
1891
|
+
searchType: z14.string().optional(),
|
|
1892
|
+
resolvedSearchType: z14.string().optional(),
|
|
1893
|
+
results: z14.array(
|
|
1894
|
+
z14.object({
|
|
1895
|
+
title: z14.string(),
|
|
1896
|
+
url: z14.string(),
|
|
1897
|
+
id: z14.string(),
|
|
1898
|
+
publishedDate: z14.string().nullable().optional(),
|
|
1899
|
+
author: z14.string().nullable().optional(),
|
|
1900
|
+
image: z14.string().nullable().optional(),
|
|
1901
|
+
favicon: z14.string().nullable().optional(),
|
|
1902
|
+
text: z14.string().optional(),
|
|
1903
|
+
highlights: z14.array(z14.string()).optional(),
|
|
1904
|
+
highlightScores: z14.array(z14.number()).optional(),
|
|
1905
|
+
summary: z14.string().optional(),
|
|
1906
|
+
subpages: z14.array(z14.any()).optional(),
|
|
1907
|
+
extras: z14.object({
|
|
1908
|
+
links: z14.array(z14.string()).optional(),
|
|
1909
|
+
imageLinks: z14.array(z14.string()).optional()
|
|
1910
|
+
}).optional()
|
|
1911
|
+
})
|
|
1912
|
+
),
|
|
1913
|
+
costDollars: z14.object({
|
|
1914
|
+
total: z14.number().optional(),
|
|
1915
|
+
search: z14.record(z14.number()).optional()
|
|
1916
|
+
}).optional()
|
|
1917
|
+
}),
|
|
1918
|
+
z14.object({
|
|
1919
|
+
error: z14.enum([
|
|
1920
|
+
"api_error",
|
|
1921
|
+
"rate_limit",
|
|
1922
|
+
"timeout",
|
|
1923
|
+
"invalid_input",
|
|
1924
|
+
"configuration_error",
|
|
1925
|
+
"execution_error",
|
|
1926
|
+
"unknown"
|
|
1927
|
+
]),
|
|
1928
|
+
statusCode: z14.number().optional(),
|
|
1929
|
+
message: z14.string()
|
|
1930
|
+
})
|
|
1931
|
+
])
|
|
1932
|
+
)
|
|
1933
|
+
);
|
|
1934
|
+
var exaSearchToolFactory = createProviderToolFactoryWithOutputSchema({
|
|
1935
|
+
id: "gateway.exa_search",
|
|
1936
|
+
inputSchema: exaSearchInputSchema,
|
|
1937
|
+
outputSchema: exaSearchOutputSchema
|
|
1938
|
+
});
|
|
1939
|
+
var exaSearch = (config = {}) => exaSearchToolFactory(config);
|
|
1940
|
+
|
|
1941
|
+
// src/tool/parallel-search.ts
|
|
1942
|
+
import {
|
|
1943
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
|
|
1944
|
+
lazySchema as lazySchema10,
|
|
1945
|
+
zodSchema as zodSchema10
|
|
1946
|
+
} from "@ai-sdk/provider-utils";
|
|
1947
|
+
import { z as z15 } from "zod";
|
|
1948
|
+
var parallelSearchInputSchema = lazySchema10(
|
|
1949
|
+
() => zodSchema10(
|
|
1950
|
+
z15.object({
|
|
1951
|
+
objective: z15.string().describe(
|
|
1817
1952
|
"Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
|
|
1818
1953
|
),
|
|
1819
|
-
search_queries:
|
|
1954
|
+
search_queries: z15.array(z15.string()).optional().describe(
|
|
1820
1955
|
"Optional search queries to supplement the objective. Maximum 200 characters per query."
|
|
1821
1956
|
),
|
|
1822
|
-
mode:
|
|
1957
|
+
mode: z15.enum(["one-shot", "agentic"]).optional().describe(
|
|
1823
1958
|
'Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'
|
|
1824
1959
|
),
|
|
1825
|
-
max_results:
|
|
1960
|
+
max_results: z15.number().optional().describe(
|
|
1826
1961
|
"Maximum number of results to return (1-20). Defaults to 10 if not specified."
|
|
1827
1962
|
),
|
|
1828
|
-
source_policy:
|
|
1829
|
-
include_domains:
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1963
|
+
source_policy: z15.object({
|
|
1964
|
+
include_domains: z15.array(z15.string()).optional().describe(
|
|
1965
|
+
"Limit results to these domains. Use plain domain names only \u2014 e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page)."
|
|
1966
|
+
),
|
|
1967
|
+
exclude_domains: z15.array(z15.string()).optional().describe(
|
|
1968
|
+
"Exclude results from these domains. Use plain domain names only \u2014 e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page)."
|
|
1969
|
+
),
|
|
1970
|
+
after_date: z15.string().optional().describe(
|
|
1971
|
+
"Only include results published after this date. Use an ISO 8601 calendar date formatted YYYY-MM-DD (e.g. 2025-01-01); do not include a time."
|
|
1833
1972
|
)
|
|
1834
1973
|
}).optional().describe(
|
|
1835
1974
|
"Source policy for controlling which domains to include/exclude and freshness."
|
|
1836
1975
|
),
|
|
1837
|
-
excerpts:
|
|
1838
|
-
max_chars_per_result:
|
|
1839
|
-
max_chars_total:
|
|
1976
|
+
excerpts: z15.object({
|
|
1977
|
+
max_chars_per_result: z15.number().optional().describe("Maximum characters per result."),
|
|
1978
|
+
max_chars_total: z15.number().optional().describe("Maximum total characters across all results.")
|
|
1840
1979
|
}).optional().describe("Excerpt configuration for controlling result length."),
|
|
1841
|
-
fetch_policy:
|
|
1842
|
-
max_age_seconds:
|
|
1980
|
+
fetch_policy: z15.object({
|
|
1981
|
+
max_age_seconds: z15.number().optional().describe(
|
|
1843
1982
|
"Maximum age in seconds for cached content. Set to 0 to always fetch fresh content."
|
|
1844
1983
|
)
|
|
1845
1984
|
}).optional().describe("Fetch policy for controlling content freshness.")
|
|
1846
1985
|
})
|
|
1847
1986
|
)
|
|
1848
1987
|
);
|
|
1849
|
-
var parallelSearchOutputSchema =
|
|
1850
|
-
() =>
|
|
1851
|
-
|
|
1988
|
+
var parallelSearchOutputSchema = lazySchema10(
|
|
1989
|
+
() => zodSchema10(
|
|
1990
|
+
z15.union([
|
|
1852
1991
|
// Success response
|
|
1853
|
-
|
|
1854
|
-
searchId:
|
|
1855
|
-
results:
|
|
1856
|
-
|
|
1857
|
-
url:
|
|
1858
|
-
title:
|
|
1859
|
-
excerpt:
|
|
1860
|
-
publishDate:
|
|
1861
|
-
relevanceScore:
|
|
1992
|
+
z15.object({
|
|
1993
|
+
searchId: z15.string(),
|
|
1994
|
+
results: z15.array(
|
|
1995
|
+
z15.object({
|
|
1996
|
+
url: z15.string(),
|
|
1997
|
+
title: z15.string(),
|
|
1998
|
+
excerpt: z15.string(),
|
|
1999
|
+
publishDate: z15.string().nullable().optional(),
|
|
2000
|
+
relevanceScore: z15.number().optional()
|
|
1862
2001
|
})
|
|
1863
2002
|
)
|
|
1864
2003
|
}),
|
|
1865
2004
|
// Error response
|
|
1866
|
-
|
|
1867
|
-
error:
|
|
2005
|
+
z15.object({
|
|
2006
|
+
error: z15.enum([
|
|
1868
2007
|
"api_error",
|
|
1869
2008
|
"rate_limit",
|
|
1870
2009
|
"timeout",
|
|
@@ -1872,13 +2011,13 @@ var parallelSearchOutputSchema = lazySchema9(
|
|
|
1872
2011
|
"configuration_error",
|
|
1873
2012
|
"unknown"
|
|
1874
2013
|
]),
|
|
1875
|
-
statusCode:
|
|
1876
|
-
message:
|
|
2014
|
+
statusCode: z15.number().optional(),
|
|
2015
|
+
message: z15.string()
|
|
1877
2016
|
})
|
|
1878
2017
|
])
|
|
1879
2018
|
)
|
|
1880
2019
|
);
|
|
1881
|
-
var parallelSearchToolFactory =
|
|
2020
|
+
var parallelSearchToolFactory = createProviderToolFactoryWithOutputSchema2({
|
|
1882
2021
|
id: "gateway.parallel_search",
|
|
1883
2022
|
inputSchema: parallelSearchInputSchema,
|
|
1884
2023
|
outputSchema: parallelSearchOutputSchema
|
|
@@ -1887,85 +2026,85 @@ var parallelSearch = (config = {}) => parallelSearchToolFactory(config);
|
|
|
1887
2026
|
|
|
1888
2027
|
// src/tool/perplexity-search.ts
|
|
1889
2028
|
import {
|
|
1890
|
-
createProviderToolFactoryWithOutputSchema as
|
|
1891
|
-
lazySchema as
|
|
1892
|
-
zodSchema as
|
|
2029
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
|
|
2030
|
+
lazySchema as lazySchema11,
|
|
2031
|
+
zodSchema as zodSchema11
|
|
1893
2032
|
} from "@ai-sdk/provider-utils";
|
|
1894
|
-
import { z as
|
|
1895
|
-
var perplexitySearchInputSchema =
|
|
1896
|
-
() =>
|
|
1897
|
-
|
|
1898
|
-
query:
|
|
2033
|
+
import { z as z16 } from "zod";
|
|
2034
|
+
var perplexitySearchInputSchema = lazySchema11(
|
|
2035
|
+
() => zodSchema11(
|
|
2036
|
+
z16.object({
|
|
2037
|
+
query: z16.union([z16.string(), z16.array(z16.string())]).describe(
|
|
1899
2038
|
"Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."
|
|
1900
2039
|
),
|
|
1901
|
-
max_results:
|
|
2040
|
+
max_results: z16.number().optional().describe(
|
|
1902
2041
|
"Maximum number of search results to return (1-20, default: 10)"
|
|
1903
2042
|
),
|
|
1904
|
-
max_tokens_per_page:
|
|
2043
|
+
max_tokens_per_page: z16.number().optional().describe(
|
|
1905
2044
|
"Maximum number of tokens to extract per search result page (256-2048, default: 2048)"
|
|
1906
2045
|
),
|
|
1907
|
-
max_tokens:
|
|
2046
|
+
max_tokens: z16.number().optional().describe(
|
|
1908
2047
|
"Maximum total tokens across all search results (default: 25000, max: 1000000)"
|
|
1909
2048
|
),
|
|
1910
|
-
country:
|
|
2049
|
+
country: z16.string().optional().describe(
|
|
1911
2050
|
"Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"
|
|
1912
2051
|
),
|
|
1913
|
-
search_domain_filter:
|
|
2052
|
+
search_domain_filter: z16.array(z16.string()).optional().describe(
|
|
1914
2053
|
"List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"
|
|
1915
2054
|
),
|
|
1916
|
-
search_language_filter:
|
|
2055
|
+
search_language_filter: z16.array(z16.string()).optional().describe(
|
|
1917
2056
|
"List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"
|
|
1918
2057
|
),
|
|
1919
|
-
search_after_date:
|
|
2058
|
+
search_after_date: z16.string().optional().describe(
|
|
1920
2059
|
"Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
|
|
1921
2060
|
),
|
|
1922
|
-
search_before_date:
|
|
2061
|
+
search_before_date: z16.string().optional().describe(
|
|
1923
2062
|
"Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
|
|
1924
2063
|
),
|
|
1925
|
-
last_updated_after_filter:
|
|
2064
|
+
last_updated_after_filter: z16.string().optional().describe(
|
|
1926
2065
|
"Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
|
|
1927
2066
|
),
|
|
1928
|
-
last_updated_before_filter:
|
|
2067
|
+
last_updated_before_filter: z16.string().optional().describe(
|
|
1929
2068
|
"Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
|
|
1930
2069
|
),
|
|
1931
|
-
search_recency_filter:
|
|
2070
|
+
search_recency_filter: z16.enum(["day", "week", "month", "year"]).optional().describe(
|
|
1932
2071
|
"Filter results by relative time period. Cannot be used with search_after_date or search_before_date."
|
|
1933
2072
|
)
|
|
1934
2073
|
})
|
|
1935
2074
|
)
|
|
1936
2075
|
);
|
|
1937
|
-
var perplexitySearchOutputSchema =
|
|
1938
|
-
() =>
|
|
1939
|
-
|
|
2076
|
+
var perplexitySearchOutputSchema = lazySchema11(
|
|
2077
|
+
() => zodSchema11(
|
|
2078
|
+
z16.union([
|
|
1940
2079
|
// Success response
|
|
1941
|
-
|
|
1942
|
-
results:
|
|
1943
|
-
|
|
1944
|
-
title:
|
|
1945
|
-
url:
|
|
1946
|
-
snippet:
|
|
1947
|
-
date:
|
|
1948
|
-
lastUpdated:
|
|
2080
|
+
z16.object({
|
|
2081
|
+
results: z16.array(
|
|
2082
|
+
z16.object({
|
|
2083
|
+
title: z16.string(),
|
|
2084
|
+
url: z16.string(),
|
|
2085
|
+
snippet: z16.string(),
|
|
2086
|
+
date: z16.string().optional(),
|
|
2087
|
+
lastUpdated: z16.string().optional()
|
|
1949
2088
|
})
|
|
1950
2089
|
),
|
|
1951
|
-
id:
|
|
2090
|
+
id: z16.string()
|
|
1952
2091
|
}),
|
|
1953
2092
|
// Error response
|
|
1954
|
-
|
|
1955
|
-
error:
|
|
2093
|
+
z16.object({
|
|
2094
|
+
error: z16.enum([
|
|
1956
2095
|
"api_error",
|
|
1957
2096
|
"rate_limit",
|
|
1958
2097
|
"timeout",
|
|
1959
2098
|
"invalid_input",
|
|
1960
2099
|
"unknown"
|
|
1961
2100
|
]),
|
|
1962
|
-
statusCode:
|
|
1963
|
-
message:
|
|
2101
|
+
statusCode: z16.number().optional(),
|
|
2102
|
+
message: z16.string()
|
|
1964
2103
|
})
|
|
1965
2104
|
])
|
|
1966
2105
|
)
|
|
1967
2106
|
);
|
|
1968
|
-
var perplexitySearchToolFactory =
|
|
2107
|
+
var perplexitySearchToolFactory = createProviderToolFactoryWithOutputSchema3({
|
|
1969
2108
|
id: "gateway.perplexity_search",
|
|
1970
2109
|
inputSchema: perplexitySearchInputSchema,
|
|
1971
2110
|
outputSchema: perplexitySearchOutputSchema
|
|
@@ -1974,6 +2113,14 @@ var perplexitySearch = (config = {}) => perplexitySearchToolFactory(config);
|
|
|
1974
2113
|
|
|
1975
2114
|
// src/gateway-tools.ts
|
|
1976
2115
|
var gatewayTools = {
|
|
2116
|
+
/**
|
|
2117
|
+
* Search the web using Exa for current information and token-efficient
|
|
2118
|
+
* excerpts optimized for agent workflows.
|
|
2119
|
+
*
|
|
2120
|
+
* Supports search type, category, domain, date, location, and content
|
|
2121
|
+
* extraction controls.
|
|
2122
|
+
*/
|
|
2123
|
+
exaSearch,
|
|
1977
2124
|
/**
|
|
1978
2125
|
* Search the web using Parallel AI's Search API for LLM-optimized excerpts.
|
|
1979
2126
|
*
|
|
@@ -2002,7 +2149,7 @@ async function getVercelRequestId() {
|
|
|
2002
2149
|
}
|
|
2003
2150
|
|
|
2004
2151
|
// src/version.ts
|
|
2005
|
-
var VERSION = true ? "3.0.
|
|
2152
|
+
var VERSION = true ? "3.0.138" : "0.0.0-test";
|
|
2006
2153
|
|
|
2007
2154
|
// src/gateway-provider.ts
|
|
2008
2155
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|