@ai-sdk/gateway 3.0.137 → 3.0.139

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/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,72 +1805,205 @@ var gatewayTranscriptionResponseSchema = z13.object({
1803
1805
  providerMetadata: z13.record(z13.string(), providerMetadataEntrySchema4).optional()
1804
1806
  });
1805
1807
 
1806
- // src/tool/parallel-search.ts
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 parallelSearchInputSchema = lazySchema9(
1815
+ var exaSearchInputSchema = lazySchema9(
1814
1816
  () => zodSchema9(
1815
1817
  z14.object({
1816
- objective: z14.string().describe(
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: z14.array(z14.string()).optional().describe(
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: z14.enum(["one-shot", "agentic"]).optional().describe(
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: z14.number().optional().describe(
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: z14.object({
1829
- include_domains: z14.array(z14.string()).optional().describe(
1963
+ source_policy: z15.object({
1964
+ include_domains: z15.array(z15.string()).optional().describe(
1830
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)."
1831
1966
  ),
1832
- exclude_domains: z14.array(z14.string()).optional().describe(
1967
+ exclude_domains: z15.array(z15.string()).optional().describe(
1833
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)."
1834
1969
  ),
1835
- after_date: z14.string().optional().describe(
1970
+ after_date: z15.string().optional().describe(
1836
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."
1837
1972
  )
1838
1973
  }).optional().describe(
1839
1974
  "Source policy for controlling which domains to include/exclude and freshness."
1840
1975
  ),
1841
- excerpts: z14.object({
1842
- max_chars_per_result: z14.number().optional().describe("Maximum characters per result."),
1843
- max_chars_total: z14.number().optional().describe("Maximum total characters across all results.")
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.")
1844
1979
  }).optional().describe("Excerpt configuration for controlling result length."),
1845
- fetch_policy: z14.object({
1846
- max_age_seconds: z14.number().optional().describe(
1980
+ fetch_policy: z15.object({
1981
+ max_age_seconds: z15.number().optional().describe(
1847
1982
  "Maximum age in seconds for cached content. Set to 0 to always fetch fresh content."
1848
1983
  )
1849
1984
  }).optional().describe("Fetch policy for controlling content freshness.")
1850
1985
  })
1851
1986
  )
1852
1987
  );
1853
- var parallelSearchOutputSchema = lazySchema9(
1854
- () => zodSchema9(
1855
- z14.union([
1988
+ var parallelSearchOutputSchema = lazySchema10(
1989
+ () => zodSchema10(
1990
+ z15.union([
1856
1991
  // Success response
1857
- z14.object({
1858
- searchId: z14.string(),
1859
- results: z14.array(
1860
- z14.object({
1861
- url: z14.string(),
1862
- title: z14.string(),
1863
- excerpt: z14.string(),
1864
- publishDate: z14.string().nullable().optional(),
1865
- relevanceScore: z14.number().optional()
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()
1866
2001
  })
1867
2002
  )
1868
2003
  }),
1869
2004
  // Error response
1870
- z14.object({
1871
- error: z14.enum([
2005
+ z15.object({
2006
+ error: z15.enum([
1872
2007
  "api_error",
1873
2008
  "rate_limit",
1874
2009
  "timeout",
@@ -1876,13 +2011,13 @@ var parallelSearchOutputSchema = lazySchema9(
1876
2011
  "configuration_error",
1877
2012
  "unknown"
1878
2013
  ]),
1879
- statusCode: z14.number().optional(),
1880
- message: z14.string()
2014
+ statusCode: z15.number().optional(),
2015
+ message: z15.string()
1881
2016
  })
1882
2017
  ])
1883
2018
  )
1884
2019
  );
1885
- var parallelSearchToolFactory = createProviderToolFactoryWithOutputSchema({
2020
+ var parallelSearchToolFactory = createProviderToolFactoryWithOutputSchema2({
1886
2021
  id: "gateway.parallel_search",
1887
2022
  inputSchema: parallelSearchInputSchema,
1888
2023
  outputSchema: parallelSearchOutputSchema
@@ -1891,85 +2026,85 @@ var parallelSearch = (config = {}) => parallelSearchToolFactory(config);
1891
2026
 
1892
2027
  // src/tool/perplexity-search.ts
1893
2028
  import {
1894
- createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
1895
- lazySchema as lazySchema10,
1896
- zodSchema as zodSchema10
2029
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
2030
+ lazySchema as lazySchema11,
2031
+ zodSchema as zodSchema11
1897
2032
  } from "@ai-sdk/provider-utils";
1898
- import { z as z15 } from "zod";
1899
- var perplexitySearchInputSchema = lazySchema10(
1900
- () => zodSchema10(
1901
- z15.object({
1902
- query: z15.union([z15.string(), z15.array(z15.string())]).describe(
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(
1903
2038
  "Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."
1904
2039
  ),
1905
- max_results: z15.number().optional().describe(
2040
+ max_results: z16.number().optional().describe(
1906
2041
  "Maximum number of search results to return (1-20, default: 10)"
1907
2042
  ),
1908
- max_tokens_per_page: z15.number().optional().describe(
2043
+ max_tokens_per_page: z16.number().optional().describe(
1909
2044
  "Maximum number of tokens to extract per search result page (256-2048, default: 2048)"
1910
2045
  ),
1911
- max_tokens: z15.number().optional().describe(
2046
+ max_tokens: z16.number().optional().describe(
1912
2047
  "Maximum total tokens across all search results (default: 25000, max: 1000000)"
1913
2048
  ),
1914
- country: z15.string().optional().describe(
2049
+ country: z16.string().optional().describe(
1915
2050
  "Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"
1916
2051
  ),
1917
- search_domain_filter: z15.array(z15.string()).optional().describe(
2052
+ search_domain_filter: z16.array(z16.string()).optional().describe(
1918
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']"
1919
2054
  ),
1920
- search_language_filter: z15.array(z15.string()).optional().describe(
2055
+ search_language_filter: z16.array(z16.string()).optional().describe(
1921
2056
  "List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"
1922
2057
  ),
1923
- search_after_date: z15.string().optional().describe(
2058
+ search_after_date: z16.string().optional().describe(
1924
2059
  "Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
1925
2060
  ),
1926
- search_before_date: z15.string().optional().describe(
2061
+ search_before_date: z16.string().optional().describe(
1927
2062
  "Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
1928
2063
  ),
1929
- last_updated_after_filter: z15.string().optional().describe(
2064
+ last_updated_after_filter: z16.string().optional().describe(
1930
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."
1931
2066
  ),
1932
- last_updated_before_filter: z15.string().optional().describe(
2067
+ last_updated_before_filter: z16.string().optional().describe(
1933
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."
1934
2069
  ),
1935
- search_recency_filter: z15.enum(["day", "week", "month", "year"]).optional().describe(
2070
+ search_recency_filter: z16.enum(["day", "week", "month", "year"]).optional().describe(
1936
2071
  "Filter results by relative time period. Cannot be used with search_after_date or search_before_date."
1937
2072
  )
1938
2073
  })
1939
2074
  )
1940
2075
  );
1941
- var perplexitySearchOutputSchema = lazySchema10(
1942
- () => zodSchema10(
1943
- z15.union([
2076
+ var perplexitySearchOutputSchema = lazySchema11(
2077
+ () => zodSchema11(
2078
+ z16.union([
1944
2079
  // Success response
1945
- z15.object({
1946
- results: z15.array(
1947
- z15.object({
1948
- title: z15.string(),
1949
- url: z15.string(),
1950
- snippet: z15.string(),
1951
- date: z15.string().optional(),
1952
- lastUpdated: z15.string().optional()
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()
1953
2088
  })
1954
2089
  ),
1955
- id: z15.string()
2090
+ id: z16.string()
1956
2091
  }),
1957
2092
  // Error response
1958
- z15.object({
1959
- error: z15.enum([
2093
+ z16.object({
2094
+ error: z16.enum([
1960
2095
  "api_error",
1961
2096
  "rate_limit",
1962
2097
  "timeout",
1963
2098
  "invalid_input",
1964
2099
  "unknown"
1965
2100
  ]),
1966
- statusCode: z15.number().optional(),
1967
- message: z15.string()
2101
+ statusCode: z16.number().optional(),
2102
+ message: z16.string()
1968
2103
  })
1969
2104
  ])
1970
2105
  )
1971
2106
  );
1972
- var perplexitySearchToolFactory = createProviderToolFactoryWithOutputSchema2({
2107
+ var perplexitySearchToolFactory = createProviderToolFactoryWithOutputSchema3({
1973
2108
  id: "gateway.perplexity_search",
1974
2109
  inputSchema: perplexitySearchInputSchema,
1975
2110
  outputSchema: perplexitySearchOutputSchema
@@ -1978,6 +2113,14 @@ var perplexitySearch = (config = {}) => perplexitySearchToolFactory(config);
1978
2113
 
1979
2114
  // src/gateway-tools.ts
1980
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,
1981
2124
  /**
1982
2125
  * Search the web using Parallel AI's Search API for LLM-optimized excerpts.
1983
2126
  *
@@ -2006,7 +2149,7 @@ async function getVercelRequestId() {
2006
2149
  }
2007
2150
 
2008
2151
  // src/version.ts
2009
- var VERSION = true ? "3.0.137" : "0.0.0-test";
2152
+ var VERSION = true ? "3.0.139" : "0.0.0-test";
2010
2153
 
2011
2154
  // src/gateway-provider.ts
2012
2155
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";