@ai-sdk/google 3.0.0-beta.76 → 3.0.0-beta.77
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.mts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +98 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +96 -34
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +20 -0
- package/dist/internal/index.d.ts +20 -0
- package/dist/internal/index.js +77 -19
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +83 -21
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/internal/index.mjs
CHANGED
|
@@ -445,6 +445,18 @@ var googleGenerativeAIProviderOptions = lazySchema2(
|
|
|
445
445
|
"21:9"
|
|
446
446
|
]).optional(),
|
|
447
447
|
imageSize: z2.enum(["1K", "2K", "4K"]).optional()
|
|
448
|
+
}).optional(),
|
|
449
|
+
/**
|
|
450
|
+
* Optional. Configuration for grounding retrieval.
|
|
451
|
+
* Used to provide location context for Google Maps and Google Search grounding.
|
|
452
|
+
*
|
|
453
|
+
* https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
|
|
454
|
+
*/
|
|
455
|
+
retrievalConfig: z2.object({
|
|
456
|
+
latLng: z2.object({
|
|
457
|
+
latitude: z2.number(),
|
|
458
|
+
longitude: z2.number()
|
|
459
|
+
}).optional()
|
|
448
460
|
}).optional()
|
|
449
461
|
})
|
|
450
462
|
)
|
|
@@ -555,6 +567,17 @@ function prepareTools({
|
|
|
555
567
|
});
|
|
556
568
|
}
|
|
557
569
|
break;
|
|
570
|
+
case "google.google_maps":
|
|
571
|
+
if (isGemini2orNewer) {
|
|
572
|
+
googleTools2.push({ googleMaps: {} });
|
|
573
|
+
} else {
|
|
574
|
+
toolWarnings.push({
|
|
575
|
+
type: "unsupported",
|
|
576
|
+
feature: `provider-defined tool ${tool.id}`,
|
|
577
|
+
details: "The Google Maps grounding tool is not supported with Gemini models other than Gemini 2 or newer."
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
break;
|
|
558
581
|
default:
|
|
559
582
|
toolWarnings.push({
|
|
560
583
|
type: "unsupported",
|
|
@@ -764,7 +787,10 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
764
787
|
systemInstruction: isGemmaModel ? void 0 : systemInstruction,
|
|
765
788
|
safetySettings: googleOptions == null ? void 0 : googleOptions.safetySettings,
|
|
766
789
|
tools: googleTools2,
|
|
767
|
-
toolConfig:
|
|
790
|
+
toolConfig: (googleOptions == null ? void 0 : googleOptions.retrievalConfig) ? {
|
|
791
|
+
...googleToolConfig,
|
|
792
|
+
retrievalConfig: googleOptions.retrievalConfig
|
|
793
|
+
} : googleToolConfig,
|
|
768
794
|
cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
|
|
769
795
|
labels: googleOptions == null ? void 0 : googleOptions.labels
|
|
770
796
|
},
|
|
@@ -1155,7 +1181,7 @@ function extractSources({
|
|
|
1155
1181
|
groundingMetadata,
|
|
1156
1182
|
generateId: generateId2
|
|
1157
1183
|
}) {
|
|
1158
|
-
var _a, _b, _c, _d;
|
|
1184
|
+
var _a, _b, _c, _d, _e;
|
|
1159
1185
|
if (!(groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks)) {
|
|
1160
1186
|
return void 0;
|
|
1161
1187
|
}
|
|
@@ -1221,6 +1247,16 @@ function extractSources({
|
|
|
1221
1247
|
filename: fileSearchStore.split("/").pop()
|
|
1222
1248
|
});
|
|
1223
1249
|
}
|
|
1250
|
+
} else if (chunk.maps != null) {
|
|
1251
|
+
if (chunk.maps.uri) {
|
|
1252
|
+
sources.push({
|
|
1253
|
+
type: "source",
|
|
1254
|
+
sourceType: "url",
|
|
1255
|
+
id: generateId2(),
|
|
1256
|
+
url: chunk.maps.uri,
|
|
1257
|
+
title: (_e = chunk.maps.title) != null ? _e : void 0
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1224
1260
|
}
|
|
1225
1261
|
}
|
|
1226
1262
|
return sources.length > 0 ? sources : void 0;
|
|
@@ -1237,6 +1273,12 @@ var getGroundingMetadataSchema = () => z3.object({
|
|
|
1237
1273
|
title: z3.string().nullish(),
|
|
1238
1274
|
text: z3.string().nullish(),
|
|
1239
1275
|
fileSearchStore: z3.string().nullish()
|
|
1276
|
+
}).nullish(),
|
|
1277
|
+
maps: z3.object({
|
|
1278
|
+
uri: z3.string().nullish(),
|
|
1279
|
+
title: z3.string().nullish(),
|
|
1280
|
+
text: z3.string().nullish(),
|
|
1281
|
+
placeId: z3.string().nullish()
|
|
1240
1282
|
}).nullish()
|
|
1241
1283
|
})
|
|
1242
1284
|
).nullish(),
|
|
@@ -1407,20 +1449,32 @@ var fileSearch = createProviderToolFactory({
|
|
|
1407
1449
|
inputSchema: fileSearchArgsSchema
|
|
1408
1450
|
});
|
|
1409
1451
|
|
|
1410
|
-
// src/tool/google-
|
|
1452
|
+
// src/tool/google-maps.ts
|
|
1411
1453
|
import {
|
|
1412
1454
|
createProviderToolFactory as createProviderToolFactory2,
|
|
1413
1455
|
lazySchema as lazySchema5,
|
|
1414
1456
|
zodSchema as zodSchema5
|
|
1415
1457
|
} from "@ai-sdk/provider-utils";
|
|
1416
1458
|
import { z as z6 } from "zod/v4";
|
|
1417
|
-
var
|
|
1459
|
+
var googleMaps = createProviderToolFactory2({
|
|
1460
|
+
id: "google.google_maps",
|
|
1461
|
+
inputSchema: lazySchema5(() => zodSchema5(z6.object({})))
|
|
1462
|
+
});
|
|
1463
|
+
|
|
1464
|
+
// src/tool/google-search.ts
|
|
1465
|
+
import {
|
|
1466
|
+
createProviderToolFactory as createProviderToolFactory3,
|
|
1467
|
+
lazySchema as lazySchema6,
|
|
1468
|
+
zodSchema as zodSchema6
|
|
1469
|
+
} from "@ai-sdk/provider-utils";
|
|
1470
|
+
import { z as z7 } from "zod/v4";
|
|
1471
|
+
var googleSearch = createProviderToolFactory3({
|
|
1418
1472
|
id: "google.google_search",
|
|
1419
|
-
inputSchema:
|
|
1420
|
-
() =>
|
|
1421
|
-
|
|
1422
|
-
mode:
|
|
1423
|
-
dynamicThreshold:
|
|
1473
|
+
inputSchema: lazySchema6(
|
|
1474
|
+
() => zodSchema6(
|
|
1475
|
+
z7.object({
|
|
1476
|
+
mode: z7.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
|
|
1477
|
+
dynamicThreshold: z7.number().default(1)
|
|
1424
1478
|
})
|
|
1425
1479
|
)
|
|
1426
1480
|
)
|
|
@@ -1428,24 +1482,24 @@ var googleSearch = createProviderToolFactory2({
|
|
|
1428
1482
|
|
|
1429
1483
|
// src/tool/url-context.ts
|
|
1430
1484
|
import {
|
|
1431
|
-
createProviderToolFactory as
|
|
1432
|
-
lazySchema as
|
|
1433
|
-
zodSchema as
|
|
1485
|
+
createProviderToolFactory as createProviderToolFactory4,
|
|
1486
|
+
lazySchema as lazySchema7,
|
|
1487
|
+
zodSchema as zodSchema7
|
|
1434
1488
|
} from "@ai-sdk/provider-utils";
|
|
1435
|
-
import { z as
|
|
1436
|
-
var urlContext =
|
|
1489
|
+
import { z as z8 } from "zod/v4";
|
|
1490
|
+
var urlContext = createProviderToolFactory4({
|
|
1437
1491
|
id: "google.url_context",
|
|
1438
|
-
inputSchema:
|
|
1492
|
+
inputSchema: lazySchema7(() => zodSchema7(z8.object({})))
|
|
1439
1493
|
});
|
|
1440
1494
|
|
|
1441
1495
|
// src/tool/vertex-rag-store.ts
|
|
1442
|
-
import { createProviderToolFactory as
|
|
1443
|
-
import { z as
|
|
1444
|
-
var vertexRagStore =
|
|
1496
|
+
import { createProviderToolFactory as createProviderToolFactory5 } from "@ai-sdk/provider-utils";
|
|
1497
|
+
import { z as z9 } from "zod/v4";
|
|
1498
|
+
var vertexRagStore = createProviderToolFactory5({
|
|
1445
1499
|
id: "google.vertex_rag_store",
|
|
1446
|
-
inputSchema:
|
|
1447
|
-
ragCorpus:
|
|
1448
|
-
topK:
|
|
1500
|
+
inputSchema: z9.object({
|
|
1501
|
+
ragCorpus: z9.string(),
|
|
1502
|
+
topK: z9.number().optional()
|
|
1449
1503
|
})
|
|
1450
1504
|
});
|
|
1451
1505
|
|
|
@@ -1456,6 +1510,14 @@ var googleTools = {
|
|
|
1456
1510
|
* Must have name "google_search".
|
|
1457
1511
|
*/
|
|
1458
1512
|
googleSearch,
|
|
1513
|
+
/**
|
|
1514
|
+
* Creates a Google Maps grounding tool that gives the model access to Google Maps data.
|
|
1515
|
+
* Must have name "google_maps".
|
|
1516
|
+
*
|
|
1517
|
+
* @see https://ai.google.dev/gemini-api/docs/maps-grounding
|
|
1518
|
+
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
|
|
1519
|
+
*/
|
|
1520
|
+
googleMaps,
|
|
1459
1521
|
/**
|
|
1460
1522
|
* Creates a URL context tool that gives Google direct access to real-time web content.
|
|
1461
1523
|
* Must have name "url_context".
|