@ai-sdk/google 3.0.0-beta.80 → 3.0.0-beta.81

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 3.0.0-beta.81
4
+
5
+ ### Patch Changes
6
+
7
+ - 0ad470b: feat(provider/google): add enterpriseWebSearch tool
8
+
3
9
  ## 3.0.0-beta.80
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -190,6 +190,17 @@ declare const googleTools: {
190
190
  mode?: "MODE_DYNAMIC" | "MODE_UNSPECIFIED";
191
191
  dynamicThreshold?: number;
192
192
  }>;
193
+ /**
194
+ * Creates an Enterprise Web Search tool for grounding responses using a compliance-focused web index.
195
+ * Designed for highly-regulated industries (finance, healthcare, public sector).
196
+ * Does not log customer data and supports VPC service controls.
197
+ * Must have name "enterprise_web_search".
198
+ *
199
+ * @note Only available on Vertex AI. Requires Gemini 2.0 or newer.
200
+ *
201
+ * @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
202
+ */
203
+ enterpriseWebSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
193
204
  /**
194
205
  * Creates a Google Maps grounding tool that gives the model access to Google Maps data.
195
206
  * Must have name "google_maps".
package/dist/index.d.ts CHANGED
@@ -190,6 +190,17 @@ declare const googleTools: {
190
190
  mode?: "MODE_DYNAMIC" | "MODE_UNSPECIFIED";
191
191
  dynamicThreshold?: number;
192
192
  }>;
193
+ /**
194
+ * Creates an Enterprise Web Search tool for grounding responses using a compliance-focused web index.
195
+ * Designed for highly-regulated industries (finance, healthcare, public sector).
196
+ * Does not log customer data and supports VPC service controls.
197
+ * Must have name "enterprise_web_search".
198
+ *
199
+ * @note Only available on Vertex AI. Requires Gemini 2.0 or newer.
200
+ *
201
+ * @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
202
+ */
203
+ enterpriseWebSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
193
204
  /**
194
205
  * Creates a Google Maps grounding tool that gives the model access to Google Maps data.
195
206
  * Must have name "google_maps".
package/dist/index.js CHANGED
@@ -27,10 +27,10 @@ __export(src_exports, {
27
27
  module.exports = __toCommonJS(src_exports);
28
28
 
29
29
  // src/google-provider.ts
30
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
30
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/version.ts
33
- var VERSION = true ? "3.0.0-beta.80" : "0.0.0-test";
33
+ var VERSION = true ? "3.0.0-beta.81" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -682,6 +682,17 @@ function prepareTools({
682
682
  googleTools2.push({ googleSearchRetrieval: {} });
683
683
  }
684
684
  break;
685
+ case "google.enterprise_web_search":
686
+ if (isGemini2orNewer) {
687
+ googleTools2.push({ enterpriseWebSearch: {} });
688
+ } else {
689
+ toolWarnings.push({
690
+ type: "unsupported",
691
+ feature: `provider-defined tool ${tool.id}`,
692
+ details: "Enterprise Web Search requires Gemini 2.0 or newer."
693
+ });
694
+ }
695
+ break;
685
696
  case "google.url_context":
686
697
  if (isGemini2orNewer) {
687
698
  googleTools2.push({ urlContext: {} });
@@ -1586,72 +1597,80 @@ var codeExecution = (0, import_provider_utils7.createProviderToolFactoryWithOutp
1586
1597
  })
1587
1598
  });
1588
1599
 
1589
- // src/tool/file-search.ts
1600
+ // src/tool/enterprise-web-search.ts
1590
1601
  var import_provider_utils8 = require("@ai-sdk/provider-utils");
1591
1602
  var import_v47 = require("zod/v4");
1592
- var fileSearchArgsBaseSchema = import_v47.z.object({
1603
+ var enterpriseWebSearch = (0, import_provider_utils8.createProviderToolFactory)({
1604
+ id: "google.enterprise_web_search",
1605
+ inputSchema: (0, import_provider_utils8.lazySchema)(() => (0, import_provider_utils8.zodSchema)(import_v47.z.object({})))
1606
+ });
1607
+
1608
+ // src/tool/file-search.ts
1609
+ var import_provider_utils9 = require("@ai-sdk/provider-utils");
1610
+ var import_v48 = require("zod/v4");
1611
+ var fileSearchArgsBaseSchema = import_v48.z.object({
1593
1612
  /** The names of the file_search_stores to retrieve from.
1594
1613
  * Example: `fileSearchStores/my-file-search-store-123`
1595
1614
  */
1596
- fileSearchStoreNames: import_v47.z.array(import_v47.z.string()).describe(
1615
+ fileSearchStoreNames: import_v48.z.array(import_v48.z.string()).describe(
1597
1616
  "The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
1598
1617
  ),
1599
1618
  /** The number of file search retrieval chunks to retrieve. */
1600
- topK: import_v47.z.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
1619
+ topK: import_v48.z.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
1601
1620
  /** Metadata filter to apply to the file search retrieval documents.
1602
1621
  * See https://google.aip.dev/160 for the syntax of the filter expression.
1603
1622
  */
1604
- metadataFilter: import_v47.z.string().describe(
1623
+ metadataFilter: import_v48.z.string().describe(
1605
1624
  "Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
1606
1625
  ).optional()
1607
1626
  }).passthrough();
1608
- var fileSearchArgsSchema = (0, import_provider_utils8.lazySchema)(
1609
- () => (0, import_provider_utils8.zodSchema)(fileSearchArgsBaseSchema)
1627
+ var fileSearchArgsSchema = (0, import_provider_utils9.lazySchema)(
1628
+ () => (0, import_provider_utils9.zodSchema)(fileSearchArgsBaseSchema)
1610
1629
  );
1611
- var fileSearch = (0, import_provider_utils8.createProviderToolFactory)({
1630
+ var fileSearch = (0, import_provider_utils9.createProviderToolFactory)({
1612
1631
  id: "google.file_search",
1613
1632
  inputSchema: fileSearchArgsSchema
1614
1633
  });
1615
1634
 
1616
1635
  // src/tool/google-maps.ts
1617
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
1618
- var import_v48 = require("zod/v4");
1619
- var googleMaps = (0, import_provider_utils9.createProviderToolFactory)({
1636
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
1637
+ var import_v49 = require("zod/v4");
1638
+ var googleMaps = (0, import_provider_utils10.createProviderToolFactory)({
1620
1639
  id: "google.google_maps",
1621
- inputSchema: (0, import_provider_utils9.lazySchema)(() => (0, import_provider_utils9.zodSchema)(import_v48.z.object({})))
1640
+ inputSchema: (0, import_provider_utils10.lazySchema)(() => (0, import_provider_utils10.zodSchema)(import_v49.z.object({})))
1622
1641
  });
1623
1642
 
1624
1643
  // src/tool/google-search.ts
1625
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
1626
- var import_v49 = require("zod/v4");
1627
- var googleSearch = (0, import_provider_utils10.createProviderToolFactory)({
1644
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
1645
+ var import_v410 = require("zod/v4");
1646
+ var googleSearch = (0, import_provider_utils11.createProviderToolFactory)({
1628
1647
  id: "google.google_search",
1629
- inputSchema: (0, import_provider_utils10.lazySchema)(
1630
- () => (0, import_provider_utils10.zodSchema)(
1631
- import_v49.z.object({
1632
- mode: import_v49.z.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
1633
- dynamicThreshold: import_v49.z.number().default(1)
1648
+ inputSchema: (0, import_provider_utils11.lazySchema)(
1649
+ () => (0, import_provider_utils11.zodSchema)(
1650
+ import_v410.z.object({
1651
+ mode: import_v410.z.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
1652
+ dynamicThreshold: import_v410.z.number().default(1)
1634
1653
  })
1635
1654
  )
1636
1655
  )
1637
1656
  });
1638
1657
 
1639
1658
  // src/tool/url-context.ts
1640
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
1641
- var import_v410 = require("zod/v4");
1642
- var urlContext = (0, import_provider_utils11.createProviderToolFactory)({
1659
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
1660
+ var import_v411 = require("zod/v4");
1661
+ var urlContext = (0, import_provider_utils12.createProviderToolFactory)({
1643
1662
  id: "google.url_context",
1644
- inputSchema: (0, import_provider_utils11.lazySchema)(() => (0, import_provider_utils11.zodSchema)(import_v410.z.object({})))
1663
+ inputSchema: (0, import_provider_utils12.lazySchema)(() => (0, import_provider_utils12.zodSchema)(import_v411.z.object({})))
1645
1664
  });
1646
1665
 
1647
1666
  // src/tool/vertex-rag-store.ts
1648
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
1649
- var import_v411 = require("zod/v4");
1650
- var vertexRagStore = (0, import_provider_utils12.createProviderToolFactory)({
1667
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
1668
+ var import_v412 = require("zod/v4");
1669
+ var vertexRagStore = (0, import_provider_utils13.createProviderToolFactory)({
1651
1670
  id: "google.vertex_rag_store",
1652
- inputSchema: import_v411.z.object({
1653
- ragCorpus: import_v411.z.string(),
1654
- topK: import_v411.z.number().optional()
1671
+ inputSchema: import_v412.z.object({
1672
+ ragCorpus: import_v412.z.string(),
1673
+ topK: import_v412.z.number().optional()
1655
1674
  })
1656
1675
  });
1657
1676
 
@@ -1662,6 +1681,17 @@ var googleTools = {
1662
1681
  * Must have name "google_search".
1663
1682
  */
1664
1683
  googleSearch,
1684
+ /**
1685
+ * Creates an Enterprise Web Search tool for grounding responses using a compliance-focused web index.
1686
+ * Designed for highly-regulated industries (finance, healthcare, public sector).
1687
+ * Does not log customer data and supports VPC service controls.
1688
+ * Must have name "enterprise_web_search".
1689
+ *
1690
+ * @note Only available on Vertex AI. Requires Gemini 2.0 or newer.
1691
+ *
1692
+ * @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
1693
+ */
1694
+ enterpriseWebSearch,
1665
1695
  /**
1666
1696
  * Creates a Google Maps grounding tool that gives the model access to Google Maps data.
1667
1697
  * Must have name "google_maps".
@@ -1705,8 +1735,8 @@ var googleTools = {
1705
1735
  };
1706
1736
 
1707
1737
  // src/google-generative-ai-image-model.ts
1708
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
1709
- var import_v412 = require("zod/v4");
1738
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
1739
+ var import_v413 = require("zod/v4");
1710
1740
  var GoogleGenerativeAIImageModel = class {
1711
1741
  constructor(modelId, settings, config) {
1712
1742
  this.modelId = modelId;
@@ -1748,7 +1778,7 @@ var GoogleGenerativeAIImageModel = class {
1748
1778
  details: "This model does not support the `seed` option through this provider."
1749
1779
  });
1750
1780
  }
1751
- const googleOptions = await (0, import_provider_utils13.parseProviderOptions)({
1781
+ const googleOptions = await (0, import_provider_utils14.parseProviderOptions)({
1752
1782
  provider: "google",
1753
1783
  providerOptions,
1754
1784
  schema: googleImageProviderOptionsSchema
@@ -1767,12 +1797,12 @@ var GoogleGenerativeAIImageModel = class {
1767
1797
  instances: [{ prompt }],
1768
1798
  parameters
1769
1799
  };
1770
- const { responseHeaders, value: response } = await (0, import_provider_utils13.postJsonToApi)({
1800
+ const { responseHeaders, value: response } = await (0, import_provider_utils14.postJsonToApi)({
1771
1801
  url: `${this.config.baseURL}/models/${this.modelId}:predict`,
1772
- headers: (0, import_provider_utils13.combineHeaders)(await (0, import_provider_utils13.resolve)(this.config.headers), headers),
1802
+ headers: (0, import_provider_utils14.combineHeaders)(await (0, import_provider_utils14.resolve)(this.config.headers), headers),
1773
1803
  body,
1774
1804
  failedResponseHandler: googleFailedResponseHandler,
1775
- successfulResponseHandler: (0, import_provider_utils13.createJsonResponseHandler)(
1805
+ successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
1776
1806
  googleImageResponseSchema
1777
1807
  ),
1778
1808
  abortSignal,
@@ -1798,18 +1828,18 @@ var GoogleGenerativeAIImageModel = class {
1798
1828
  };
1799
1829
  }
1800
1830
  };
1801
- var googleImageResponseSchema = (0, import_provider_utils13.lazySchema)(
1802
- () => (0, import_provider_utils13.zodSchema)(
1803
- import_v412.z.object({
1804
- predictions: import_v412.z.array(import_v412.z.object({ bytesBase64Encoded: import_v412.z.string() })).default([])
1831
+ var googleImageResponseSchema = (0, import_provider_utils14.lazySchema)(
1832
+ () => (0, import_provider_utils14.zodSchema)(
1833
+ import_v413.z.object({
1834
+ predictions: import_v413.z.array(import_v413.z.object({ bytesBase64Encoded: import_v413.z.string() })).default([])
1805
1835
  })
1806
1836
  )
1807
1837
  );
1808
- var googleImageProviderOptionsSchema = (0, import_provider_utils13.lazySchema)(
1809
- () => (0, import_provider_utils13.zodSchema)(
1810
- import_v412.z.object({
1811
- personGeneration: import_v412.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
1812
- aspectRatio: import_v412.z.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish()
1838
+ var googleImageProviderOptionsSchema = (0, import_provider_utils14.lazySchema)(
1839
+ () => (0, import_provider_utils14.zodSchema)(
1840
+ import_v413.z.object({
1841
+ personGeneration: import_v413.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
1842
+ aspectRatio: import_v413.z.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish()
1813
1843
  })
1814
1844
  )
1815
1845
  );
@@ -1817,11 +1847,11 @@ var googleImageProviderOptionsSchema = (0, import_provider_utils13.lazySchema)(
1817
1847
  // src/google-provider.ts
1818
1848
  function createGoogleGenerativeAI(options = {}) {
1819
1849
  var _a, _b;
1820
- const baseURL = (_a = (0, import_provider_utils14.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://generativelanguage.googleapis.com/v1beta";
1850
+ const baseURL = (_a = (0, import_provider_utils15.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://generativelanguage.googleapis.com/v1beta";
1821
1851
  const providerName = (_b = options.name) != null ? _b : "google.generative-ai";
1822
- const getHeaders = () => (0, import_provider_utils14.withUserAgentSuffix)(
1852
+ const getHeaders = () => (0, import_provider_utils15.withUserAgentSuffix)(
1823
1853
  {
1824
- "x-goog-api-key": (0, import_provider_utils14.loadApiKey)({
1854
+ "x-goog-api-key": (0, import_provider_utils15.loadApiKey)({
1825
1855
  apiKey: options.apiKey,
1826
1856
  environmentVariableName: "GOOGLE_GENERATIVE_AI_API_KEY",
1827
1857
  description: "Google Generative AI"
@@ -1836,7 +1866,7 @@ function createGoogleGenerativeAI(options = {}) {
1836
1866
  provider: providerName,
1837
1867
  baseURL,
1838
1868
  headers: getHeaders,
1839
- generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils14.generateId,
1869
+ generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils15.generateId,
1840
1870
  supportedUrls: () => ({
1841
1871
  "*": [
1842
1872
  // Google Generative Language "files" endpoint