@ai-sdk/google 3.0.0-beta.76 → 3.0.0-beta.78

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
@@ -7,7 +7,7 @@ import {
7
7
  } from "@ai-sdk/provider-utils";
8
8
 
9
9
  // src/version.ts
10
- var VERSION = true ? "3.0.0-beta.76" : "0.0.0-test";
10
+ var VERSION = true ? "3.0.0-beta.78" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -621,6 +621,18 @@ var googleGenerativeAIProviderOptions = lazySchema4(
621
621
  "21:9"
622
622
  ]).optional(),
623
623
  imageSize: z4.enum(["1K", "2K", "4K"]).optional()
624
+ }).optional(),
625
+ /**
626
+ * Optional. Configuration for grounding retrieval.
627
+ * Used to provide location context for Google Maps and Google Search grounding.
628
+ *
629
+ * https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
630
+ */
631
+ retrievalConfig: z4.object({
632
+ latLng: z4.object({
633
+ latitude: z4.number(),
634
+ longitude: z4.number()
635
+ }).optional()
624
636
  }).optional()
625
637
  })
626
638
  )
@@ -731,6 +743,17 @@ function prepareTools({
731
743
  });
732
744
  }
733
745
  break;
746
+ case "google.google_maps":
747
+ if (isGemini2orNewer) {
748
+ googleTools2.push({ googleMaps: {} });
749
+ } else {
750
+ toolWarnings.push({
751
+ type: "unsupported",
752
+ feature: `provider-defined tool ${tool.id}`,
753
+ details: "The Google Maps grounding tool is not supported with Gemini models other than Gemini 2 or newer."
754
+ });
755
+ }
756
+ break;
734
757
  default:
735
758
  toolWarnings.push({
736
759
  type: "unsupported",
@@ -940,7 +963,10 @@ var GoogleGenerativeAILanguageModel = class {
940
963
  systemInstruction: isGemmaModel ? void 0 : systemInstruction,
941
964
  safetySettings: googleOptions == null ? void 0 : googleOptions.safetySettings,
942
965
  tools: googleTools2,
943
- toolConfig: googleToolConfig,
966
+ toolConfig: (googleOptions == null ? void 0 : googleOptions.retrievalConfig) ? {
967
+ ...googleToolConfig,
968
+ retrievalConfig: googleOptions.retrievalConfig
969
+ } : googleToolConfig,
944
970
  cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
945
971
  labels: googleOptions == null ? void 0 : googleOptions.labels
946
972
  },
@@ -1331,7 +1357,7 @@ function extractSources({
1331
1357
  groundingMetadata,
1332
1358
  generateId: generateId3
1333
1359
  }) {
1334
- var _a, _b, _c, _d;
1360
+ var _a, _b, _c, _d, _e;
1335
1361
  if (!(groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks)) {
1336
1362
  return void 0;
1337
1363
  }
@@ -1397,6 +1423,16 @@ function extractSources({
1397
1423
  filename: fileSearchStore.split("/").pop()
1398
1424
  });
1399
1425
  }
1426
+ } else if (chunk.maps != null) {
1427
+ if (chunk.maps.uri) {
1428
+ sources.push({
1429
+ type: "source",
1430
+ sourceType: "url",
1431
+ id: generateId3(),
1432
+ url: chunk.maps.uri,
1433
+ title: (_e = chunk.maps.title) != null ? _e : void 0
1434
+ });
1435
+ }
1400
1436
  }
1401
1437
  }
1402
1438
  return sources.length > 0 ? sources : void 0;
@@ -1413,6 +1449,12 @@ var getGroundingMetadataSchema = () => z5.object({
1413
1449
  title: z5.string().nullish(),
1414
1450
  text: z5.string().nullish(),
1415
1451
  fileSearchStore: z5.string().nullish()
1452
+ }).nullish(),
1453
+ maps: z5.object({
1454
+ uri: z5.string().nullish(),
1455
+ title: z5.string().nullish(),
1456
+ text: z5.string().nullish(),
1457
+ placeId: z5.string().nullish()
1416
1458
  }).nullish()
1417
1459
  })
1418
1460
  ).nullish(),
@@ -1583,20 +1625,32 @@ var fileSearch = createProviderToolFactory({
1583
1625
  inputSchema: fileSearchArgsSchema
1584
1626
  });
1585
1627
 
1586
- // src/tool/google-search.ts
1628
+ // src/tool/google-maps.ts
1587
1629
  import {
1588
1630
  createProviderToolFactory as createProviderToolFactory2,
1589
1631
  lazySchema as lazySchema7,
1590
1632
  zodSchema as zodSchema7
1591
1633
  } from "@ai-sdk/provider-utils";
1592
1634
  import { z as z8 } from "zod/v4";
1593
- var googleSearch = createProviderToolFactory2({
1635
+ var googleMaps = createProviderToolFactory2({
1636
+ id: "google.google_maps",
1637
+ inputSchema: lazySchema7(() => zodSchema7(z8.object({})))
1638
+ });
1639
+
1640
+ // src/tool/google-search.ts
1641
+ import {
1642
+ createProviderToolFactory as createProviderToolFactory3,
1643
+ lazySchema as lazySchema8,
1644
+ zodSchema as zodSchema8
1645
+ } from "@ai-sdk/provider-utils";
1646
+ import { z as z9 } from "zod/v4";
1647
+ var googleSearch = createProviderToolFactory3({
1594
1648
  id: "google.google_search",
1595
- inputSchema: lazySchema7(
1596
- () => zodSchema7(
1597
- z8.object({
1598
- mode: z8.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
1599
- dynamicThreshold: z8.number().default(1)
1649
+ inputSchema: lazySchema8(
1650
+ () => zodSchema8(
1651
+ z9.object({
1652
+ mode: z9.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
1653
+ dynamicThreshold: z9.number().default(1)
1600
1654
  })
1601
1655
  )
1602
1656
  )
@@ -1604,24 +1658,24 @@ var googleSearch = createProviderToolFactory2({
1604
1658
 
1605
1659
  // src/tool/url-context.ts
1606
1660
  import {
1607
- createProviderToolFactory as createProviderToolFactory3,
1608
- lazySchema as lazySchema8,
1609
- zodSchema as zodSchema8
1661
+ createProviderToolFactory as createProviderToolFactory4,
1662
+ lazySchema as lazySchema9,
1663
+ zodSchema as zodSchema9
1610
1664
  } from "@ai-sdk/provider-utils";
1611
- import { z as z9 } from "zod/v4";
1612
- var urlContext = createProviderToolFactory3({
1665
+ import { z as z10 } from "zod/v4";
1666
+ var urlContext = createProviderToolFactory4({
1613
1667
  id: "google.url_context",
1614
- inputSchema: lazySchema8(() => zodSchema8(z9.object({})))
1668
+ inputSchema: lazySchema9(() => zodSchema9(z10.object({})))
1615
1669
  });
1616
1670
 
1617
1671
  // src/tool/vertex-rag-store.ts
1618
- import { createProviderToolFactory as createProviderToolFactory4 } from "@ai-sdk/provider-utils";
1619
- import { z as z10 } from "zod/v4";
1620
- var vertexRagStore = createProviderToolFactory4({
1672
+ import { createProviderToolFactory as createProviderToolFactory5 } from "@ai-sdk/provider-utils";
1673
+ import { z as z11 } from "zod/v4";
1674
+ var vertexRagStore = createProviderToolFactory5({
1621
1675
  id: "google.vertex_rag_store",
1622
- inputSchema: z10.object({
1623
- ragCorpus: z10.string(),
1624
- topK: z10.number().optional()
1676
+ inputSchema: z11.object({
1677
+ ragCorpus: z11.string(),
1678
+ topK: z11.number().optional()
1625
1679
  })
1626
1680
  });
1627
1681
 
@@ -1632,6 +1686,14 @@ var googleTools = {
1632
1686
  * Must have name "google_search".
1633
1687
  */
1634
1688
  googleSearch,
1689
+ /**
1690
+ * Creates a Google Maps grounding tool that gives the model access to Google Maps data.
1691
+ * Must have name "google_maps".
1692
+ *
1693
+ * @see https://ai.google.dev/gemini-api/docs/maps-grounding
1694
+ * @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
1695
+ */
1696
+ googleMaps,
1635
1697
  /**
1636
1698
  * Creates a URL context tool that gives Google direct access to real-time web content.
1637
1699
  * Must have name "url_context".
@@ -1670,13 +1732,13 @@ var googleTools = {
1670
1732
  import {
1671
1733
  combineHeaders as combineHeaders3,
1672
1734
  createJsonResponseHandler as createJsonResponseHandler3,
1673
- lazySchema as lazySchema9,
1735
+ lazySchema as lazySchema10,
1674
1736
  parseProviderOptions as parseProviderOptions3,
1675
1737
  postJsonToApi as postJsonToApi3,
1676
1738
  resolve as resolve3,
1677
- zodSchema as zodSchema9
1739
+ zodSchema as zodSchema10
1678
1740
  } from "@ai-sdk/provider-utils";
1679
- import { z as z11 } from "zod/v4";
1741
+ import { z as z12 } from "zod/v4";
1680
1742
  var GoogleGenerativeAIImageModel = class {
1681
1743
  constructor(modelId, settings, config) {
1682
1744
  this.modelId = modelId;
@@ -1768,18 +1830,18 @@ var GoogleGenerativeAIImageModel = class {
1768
1830
  };
1769
1831
  }
1770
1832
  };
1771
- var googleImageResponseSchema = lazySchema9(
1772
- () => zodSchema9(
1773
- z11.object({
1774
- predictions: z11.array(z11.object({ bytesBase64Encoded: z11.string() })).default([])
1833
+ var googleImageResponseSchema = lazySchema10(
1834
+ () => zodSchema10(
1835
+ z12.object({
1836
+ predictions: z12.array(z12.object({ bytesBase64Encoded: z12.string() })).default([])
1775
1837
  })
1776
1838
  )
1777
1839
  );
1778
- var googleImageProviderOptionsSchema = lazySchema9(
1779
- () => zodSchema9(
1780
- z11.object({
1781
- personGeneration: z11.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
1782
- aspectRatio: z11.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish()
1840
+ var googleImageProviderOptionsSchema = lazySchema10(
1841
+ () => zodSchema10(
1842
+ z12.object({
1843
+ personGeneration: z12.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
1844
+ aspectRatio: z12.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish()
1783
1845
  })
1784
1846
  )
1785
1847
  );