@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/CHANGELOG.md +13 -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 +2 -2
|
@@ -45,6 +45,12 @@ declare const getGroundingMetadataSchema: () => z.ZodObject<{
|
|
|
45
45
|
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
46
|
fileSearchStore: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
47
|
}, z.core.$strip>>>;
|
|
48
|
+
maps: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
49
|
+
uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
51
|
+
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
+
placeId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
}, z.core.$strip>>>;
|
|
48
54
|
}, z.core.$strip>>>>;
|
|
49
55
|
groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
50
56
|
segment: z.ZodObject<{
|
|
@@ -123,6 +129,12 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
123
129
|
text?: string | null | undefined;
|
|
124
130
|
fileSearchStore?: string | null | undefined;
|
|
125
131
|
} | null | undefined;
|
|
132
|
+
maps?: {
|
|
133
|
+
uri?: string | null | undefined;
|
|
134
|
+
title?: string | null | undefined;
|
|
135
|
+
text?: string | null | undefined;
|
|
136
|
+
placeId?: string | null | undefined;
|
|
137
|
+
} | null | undefined;
|
|
126
138
|
}[] | null | undefined;
|
|
127
139
|
groundingSupports?: {
|
|
128
140
|
segment: {
|
|
@@ -180,6 +192,14 @@ declare const googleTools: {
|
|
|
180
192
|
mode?: "MODE_DYNAMIC" | "MODE_UNSPECIFIED";
|
|
181
193
|
dynamicThreshold?: number;
|
|
182
194
|
}>;
|
|
195
|
+
/**
|
|
196
|
+
* Creates a Google Maps grounding tool that gives the model access to Google Maps data.
|
|
197
|
+
* Must have name "google_maps".
|
|
198
|
+
*
|
|
199
|
+
* @see https://ai.google.dev/gemini-api/docs/maps-grounding
|
|
200
|
+
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
|
|
201
|
+
*/
|
|
202
|
+
googleMaps: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
|
|
183
203
|
/**
|
|
184
204
|
* Creates a URL context tool that gives Google direct access to real-time web content.
|
|
185
205
|
* Must have name "url_context".
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -45,6 +45,12 @@ declare const getGroundingMetadataSchema: () => z.ZodObject<{
|
|
|
45
45
|
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
46
|
fileSearchStore: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
47
|
}, z.core.$strip>>>;
|
|
48
|
+
maps: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
49
|
+
uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
51
|
+
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
+
placeId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
}, z.core.$strip>>>;
|
|
48
54
|
}, z.core.$strip>>>>;
|
|
49
55
|
groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
50
56
|
segment: z.ZodObject<{
|
|
@@ -123,6 +129,12 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
123
129
|
text?: string | null | undefined;
|
|
124
130
|
fileSearchStore?: string | null | undefined;
|
|
125
131
|
} | null | undefined;
|
|
132
|
+
maps?: {
|
|
133
|
+
uri?: string | null | undefined;
|
|
134
|
+
title?: string | null | undefined;
|
|
135
|
+
text?: string | null | undefined;
|
|
136
|
+
placeId?: string | null | undefined;
|
|
137
|
+
} | null | undefined;
|
|
126
138
|
}[] | null | undefined;
|
|
127
139
|
groundingSupports?: {
|
|
128
140
|
segment: {
|
|
@@ -180,6 +192,14 @@ declare const googleTools: {
|
|
|
180
192
|
mode?: "MODE_DYNAMIC" | "MODE_UNSPECIFIED";
|
|
181
193
|
dynamicThreshold?: number;
|
|
182
194
|
}>;
|
|
195
|
+
/**
|
|
196
|
+
* Creates a Google Maps grounding tool that gives the model access to Google Maps data.
|
|
197
|
+
* Must have name "google_maps".
|
|
198
|
+
*
|
|
199
|
+
* @see https://ai.google.dev/gemini-api/docs/maps-grounding
|
|
200
|
+
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
|
|
201
|
+
*/
|
|
202
|
+
googleMaps: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
|
|
183
203
|
/**
|
|
184
204
|
* Creates a URL context tool that gives Google direct access to real-time web content.
|
|
185
205
|
* Must have name "url_context".
|
package/dist/internal/index.js
CHANGED
|
@@ -458,6 +458,18 @@ var googleGenerativeAIProviderOptions = (0, import_provider_utils3.lazySchema)(
|
|
|
458
458
|
"21:9"
|
|
459
459
|
]).optional(),
|
|
460
460
|
imageSize: import_v42.z.enum(["1K", "2K", "4K"]).optional()
|
|
461
|
+
}).optional(),
|
|
462
|
+
/**
|
|
463
|
+
* Optional. Configuration for grounding retrieval.
|
|
464
|
+
* Used to provide location context for Google Maps and Google Search grounding.
|
|
465
|
+
*
|
|
466
|
+
* https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
|
|
467
|
+
*/
|
|
468
|
+
retrievalConfig: import_v42.z.object({
|
|
469
|
+
latLng: import_v42.z.object({
|
|
470
|
+
latitude: import_v42.z.number(),
|
|
471
|
+
longitude: import_v42.z.number()
|
|
472
|
+
}).optional()
|
|
461
473
|
}).optional()
|
|
462
474
|
})
|
|
463
475
|
)
|
|
@@ -566,6 +578,17 @@ function prepareTools({
|
|
|
566
578
|
});
|
|
567
579
|
}
|
|
568
580
|
break;
|
|
581
|
+
case "google.google_maps":
|
|
582
|
+
if (isGemini2orNewer) {
|
|
583
|
+
googleTools2.push({ googleMaps: {} });
|
|
584
|
+
} else {
|
|
585
|
+
toolWarnings.push({
|
|
586
|
+
type: "unsupported",
|
|
587
|
+
feature: `provider-defined tool ${tool.id}`,
|
|
588
|
+
details: "The Google Maps grounding tool is not supported with Gemini models other than Gemini 2 or newer."
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
break;
|
|
569
592
|
default:
|
|
570
593
|
toolWarnings.push({
|
|
571
594
|
type: "unsupported",
|
|
@@ -775,7 +798,10 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
775
798
|
systemInstruction: isGemmaModel ? void 0 : systemInstruction,
|
|
776
799
|
safetySettings: googleOptions == null ? void 0 : googleOptions.safetySettings,
|
|
777
800
|
tools: googleTools2,
|
|
778
|
-
toolConfig:
|
|
801
|
+
toolConfig: (googleOptions == null ? void 0 : googleOptions.retrievalConfig) ? {
|
|
802
|
+
...googleToolConfig,
|
|
803
|
+
retrievalConfig: googleOptions.retrievalConfig
|
|
804
|
+
} : googleToolConfig,
|
|
779
805
|
cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
|
|
780
806
|
labels: googleOptions == null ? void 0 : googleOptions.labels
|
|
781
807
|
},
|
|
@@ -1166,7 +1192,7 @@ function extractSources({
|
|
|
1166
1192
|
groundingMetadata,
|
|
1167
1193
|
generateId: generateId2
|
|
1168
1194
|
}) {
|
|
1169
|
-
var _a, _b, _c, _d;
|
|
1195
|
+
var _a, _b, _c, _d, _e;
|
|
1170
1196
|
if (!(groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks)) {
|
|
1171
1197
|
return void 0;
|
|
1172
1198
|
}
|
|
@@ -1232,6 +1258,16 @@ function extractSources({
|
|
|
1232
1258
|
filename: fileSearchStore.split("/").pop()
|
|
1233
1259
|
});
|
|
1234
1260
|
}
|
|
1261
|
+
} else if (chunk.maps != null) {
|
|
1262
|
+
if (chunk.maps.uri) {
|
|
1263
|
+
sources.push({
|
|
1264
|
+
type: "source",
|
|
1265
|
+
sourceType: "url",
|
|
1266
|
+
id: generateId2(),
|
|
1267
|
+
url: chunk.maps.uri,
|
|
1268
|
+
title: (_e = chunk.maps.title) != null ? _e : void 0
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1235
1271
|
}
|
|
1236
1272
|
}
|
|
1237
1273
|
return sources.length > 0 ? sources : void 0;
|
|
@@ -1248,6 +1284,12 @@ var getGroundingMetadataSchema = () => import_v43.z.object({
|
|
|
1248
1284
|
title: import_v43.z.string().nullish(),
|
|
1249
1285
|
text: import_v43.z.string().nullish(),
|
|
1250
1286
|
fileSearchStore: import_v43.z.string().nullish()
|
|
1287
|
+
}).nullish(),
|
|
1288
|
+
maps: import_v43.z.object({
|
|
1289
|
+
uri: import_v43.z.string().nullish(),
|
|
1290
|
+
title: import_v43.z.string().nullish(),
|
|
1291
|
+
text: import_v43.z.string().nullish(),
|
|
1292
|
+
placeId: import_v43.z.string().nullish()
|
|
1251
1293
|
}).nullish()
|
|
1252
1294
|
})
|
|
1253
1295
|
).nullish(),
|
|
@@ -1414,37 +1456,45 @@ var fileSearch = (0, import_provider_utils6.createProviderToolFactory)({
|
|
|
1414
1456
|
inputSchema: fileSearchArgsSchema
|
|
1415
1457
|
});
|
|
1416
1458
|
|
|
1417
|
-
// src/tool/google-
|
|
1459
|
+
// src/tool/google-maps.ts
|
|
1418
1460
|
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1419
1461
|
var import_v46 = require("zod/v4");
|
|
1420
|
-
var
|
|
1462
|
+
var googleMaps = (0, import_provider_utils7.createProviderToolFactory)({
|
|
1463
|
+
id: "google.google_maps",
|
|
1464
|
+
inputSchema: (0, import_provider_utils7.lazySchema)(() => (0, import_provider_utils7.zodSchema)(import_v46.z.object({})))
|
|
1465
|
+
});
|
|
1466
|
+
|
|
1467
|
+
// src/tool/google-search.ts
|
|
1468
|
+
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1469
|
+
var import_v47 = require("zod/v4");
|
|
1470
|
+
var googleSearch = (0, import_provider_utils8.createProviderToolFactory)({
|
|
1421
1471
|
id: "google.google_search",
|
|
1422
|
-
inputSchema: (0,
|
|
1423
|
-
() => (0,
|
|
1424
|
-
|
|
1425
|
-
mode:
|
|
1426
|
-
dynamicThreshold:
|
|
1472
|
+
inputSchema: (0, import_provider_utils8.lazySchema)(
|
|
1473
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1474
|
+
import_v47.z.object({
|
|
1475
|
+
mode: import_v47.z.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
|
|
1476
|
+
dynamicThreshold: import_v47.z.number().default(1)
|
|
1427
1477
|
})
|
|
1428
1478
|
)
|
|
1429
1479
|
)
|
|
1430
1480
|
});
|
|
1431
1481
|
|
|
1432
1482
|
// src/tool/url-context.ts
|
|
1433
|
-
var
|
|
1434
|
-
var
|
|
1435
|
-
var urlContext = (0,
|
|
1483
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1484
|
+
var import_v48 = require("zod/v4");
|
|
1485
|
+
var urlContext = (0, import_provider_utils9.createProviderToolFactory)({
|
|
1436
1486
|
id: "google.url_context",
|
|
1437
|
-
inputSchema: (0,
|
|
1487
|
+
inputSchema: (0, import_provider_utils9.lazySchema)(() => (0, import_provider_utils9.zodSchema)(import_v48.z.object({})))
|
|
1438
1488
|
});
|
|
1439
1489
|
|
|
1440
1490
|
// src/tool/vertex-rag-store.ts
|
|
1441
|
-
var
|
|
1442
|
-
var
|
|
1443
|
-
var vertexRagStore = (0,
|
|
1491
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1492
|
+
var import_v49 = require("zod/v4");
|
|
1493
|
+
var vertexRagStore = (0, import_provider_utils10.createProviderToolFactory)({
|
|
1444
1494
|
id: "google.vertex_rag_store",
|
|
1445
|
-
inputSchema:
|
|
1446
|
-
ragCorpus:
|
|
1447
|
-
topK:
|
|
1495
|
+
inputSchema: import_v49.z.object({
|
|
1496
|
+
ragCorpus: import_v49.z.string(),
|
|
1497
|
+
topK: import_v49.z.number().optional()
|
|
1448
1498
|
})
|
|
1449
1499
|
});
|
|
1450
1500
|
|
|
@@ -1455,6 +1505,14 @@ var googleTools = {
|
|
|
1455
1505
|
* Must have name "google_search".
|
|
1456
1506
|
*/
|
|
1457
1507
|
googleSearch,
|
|
1508
|
+
/**
|
|
1509
|
+
* Creates a Google Maps grounding tool that gives the model access to Google Maps data.
|
|
1510
|
+
* Must have name "google_maps".
|
|
1511
|
+
*
|
|
1512
|
+
* @see https://ai.google.dev/gemini-api/docs/maps-grounding
|
|
1513
|
+
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
|
|
1514
|
+
*/
|
|
1515
|
+
googleMaps,
|
|
1458
1516
|
/**
|
|
1459
1517
|
* Creates a URL context tool that gives Google direct access to real-time web content.
|
|
1460
1518
|
* Must have name "url_context".
|