@ai-sdk/google 2.0.48 → 2.0.49
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 +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +82 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +84 -49
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +11 -0
- package/dist/internal/index.d.ts +11 -0
- package/dist/internal/index.js +61 -30
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +71 -36
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/internal/index.mjs
CHANGED
|
@@ -488,6 +488,17 @@ function prepareTools({
|
|
|
488
488
|
googleTools2.push({ googleSearchRetrieval: {} });
|
|
489
489
|
}
|
|
490
490
|
break;
|
|
491
|
+
case "google.enterprise_web_search":
|
|
492
|
+
if (isGemini2orNewer) {
|
|
493
|
+
googleTools2.push({ enterpriseWebSearch: {} });
|
|
494
|
+
} else {
|
|
495
|
+
toolWarnings.push({
|
|
496
|
+
type: "unsupported-tool",
|
|
497
|
+
tool,
|
|
498
|
+
details: "Enterprise Web Search requires Gemini 2.0 or newer."
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
break;
|
|
491
502
|
case "google.url_context":
|
|
492
503
|
if (isGemini2orNewer) {
|
|
493
504
|
googleTools2.push({ urlContext: {} });
|
|
@@ -1372,33 +1383,46 @@ var codeExecution = createProviderDefinedToolFactoryWithOutputSchema({
|
|
|
1372
1383
|
})
|
|
1373
1384
|
});
|
|
1374
1385
|
|
|
1375
|
-
// src/tool/
|
|
1386
|
+
// src/tool/enterprise-web-search.ts
|
|
1376
1387
|
import {
|
|
1377
1388
|
createProviderDefinedToolFactory,
|
|
1378
1389
|
lazySchema as lazySchema4,
|
|
1379
1390
|
zodSchema as zodSchema4
|
|
1380
1391
|
} from "@ai-sdk/provider-utils";
|
|
1381
1392
|
import { z as z5 } from "zod/v4";
|
|
1382
|
-
var
|
|
1393
|
+
var enterpriseWebSearch = createProviderDefinedToolFactory({
|
|
1394
|
+
id: "google.enterprise_web_search",
|
|
1395
|
+
name: "enterprise_web_search",
|
|
1396
|
+
inputSchema: lazySchema4(() => zodSchema4(z5.object({})))
|
|
1397
|
+
});
|
|
1398
|
+
|
|
1399
|
+
// src/tool/file-search.ts
|
|
1400
|
+
import {
|
|
1401
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
|
|
1402
|
+
lazySchema as lazySchema5,
|
|
1403
|
+
zodSchema as zodSchema5
|
|
1404
|
+
} from "@ai-sdk/provider-utils";
|
|
1405
|
+
import { z as z6 } from "zod/v4";
|
|
1406
|
+
var fileSearchArgsBaseSchema = z6.object({
|
|
1383
1407
|
/** The names of the file_search_stores to retrieve from.
|
|
1384
1408
|
* Example: `fileSearchStores/my-file-search-store-123`
|
|
1385
1409
|
*/
|
|
1386
|
-
fileSearchStoreNames:
|
|
1410
|
+
fileSearchStoreNames: z6.array(z6.string()).describe(
|
|
1387
1411
|
"The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
|
|
1388
1412
|
),
|
|
1389
1413
|
/** The number of file search retrieval chunks to retrieve. */
|
|
1390
|
-
topK:
|
|
1414
|
+
topK: z6.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
|
|
1391
1415
|
/** Metadata filter to apply to the file search retrieval documents.
|
|
1392
1416
|
* See https://google.aip.dev/160 for the syntax of the filter expression.
|
|
1393
1417
|
*/
|
|
1394
|
-
metadataFilter:
|
|
1418
|
+
metadataFilter: z6.string().describe(
|
|
1395
1419
|
"Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
|
|
1396
1420
|
).optional()
|
|
1397
1421
|
}).passthrough();
|
|
1398
|
-
var fileSearchArgsSchema =
|
|
1399
|
-
() =>
|
|
1422
|
+
var fileSearchArgsSchema = lazySchema5(
|
|
1423
|
+
() => zodSchema5(fileSearchArgsBaseSchema)
|
|
1400
1424
|
);
|
|
1401
|
-
var fileSearch =
|
|
1425
|
+
var fileSearch = createProviderDefinedToolFactory2({
|
|
1402
1426
|
id: "google.file_search",
|
|
1403
1427
|
name: "file_search",
|
|
1404
1428
|
inputSchema: fileSearchArgsSchema
|
|
@@ -1406,32 +1430,32 @@ var fileSearch = createProviderDefinedToolFactory({
|
|
|
1406
1430
|
|
|
1407
1431
|
// src/tool/google-maps.ts
|
|
1408
1432
|
import {
|
|
1409
|
-
createProviderDefinedToolFactory as
|
|
1410
|
-
lazySchema as
|
|
1411
|
-
zodSchema as
|
|
1433
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory3,
|
|
1434
|
+
lazySchema as lazySchema6,
|
|
1435
|
+
zodSchema as zodSchema6
|
|
1412
1436
|
} from "@ai-sdk/provider-utils";
|
|
1413
|
-
import { z as
|
|
1414
|
-
var googleMaps =
|
|
1437
|
+
import { z as z7 } from "zod/v4";
|
|
1438
|
+
var googleMaps = createProviderDefinedToolFactory3({
|
|
1415
1439
|
id: "google.google_maps",
|
|
1416
1440
|
name: "google_maps",
|
|
1417
|
-
inputSchema:
|
|
1441
|
+
inputSchema: lazySchema6(() => zodSchema6(z7.object({})))
|
|
1418
1442
|
});
|
|
1419
1443
|
|
|
1420
1444
|
// src/tool/google-search.ts
|
|
1421
1445
|
import {
|
|
1422
|
-
createProviderDefinedToolFactory as
|
|
1423
|
-
lazySchema as
|
|
1424
|
-
zodSchema as
|
|
1446
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory4,
|
|
1447
|
+
lazySchema as lazySchema7,
|
|
1448
|
+
zodSchema as zodSchema7
|
|
1425
1449
|
} from "@ai-sdk/provider-utils";
|
|
1426
|
-
import { z as
|
|
1427
|
-
var googleSearch =
|
|
1450
|
+
import { z as z8 } from "zod/v4";
|
|
1451
|
+
var googleSearch = createProviderDefinedToolFactory4({
|
|
1428
1452
|
id: "google.google_search",
|
|
1429
1453
|
name: "google_search",
|
|
1430
|
-
inputSchema:
|
|
1431
|
-
() =>
|
|
1432
|
-
|
|
1433
|
-
mode:
|
|
1434
|
-
dynamicThreshold:
|
|
1454
|
+
inputSchema: lazySchema7(
|
|
1455
|
+
() => zodSchema7(
|
|
1456
|
+
z8.object({
|
|
1457
|
+
mode: z8.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
|
|
1458
|
+
dynamicThreshold: z8.number().default(1)
|
|
1435
1459
|
})
|
|
1436
1460
|
)
|
|
1437
1461
|
)
|
|
@@ -1439,26 +1463,26 @@ var googleSearch = createProviderDefinedToolFactory3({
|
|
|
1439
1463
|
|
|
1440
1464
|
// src/tool/url-context.ts
|
|
1441
1465
|
import {
|
|
1442
|
-
createProviderDefinedToolFactory as
|
|
1443
|
-
lazySchema as
|
|
1444
|
-
zodSchema as
|
|
1466
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory5,
|
|
1467
|
+
lazySchema as lazySchema8,
|
|
1468
|
+
zodSchema as zodSchema8
|
|
1445
1469
|
} from "@ai-sdk/provider-utils";
|
|
1446
|
-
import { z as
|
|
1447
|
-
var urlContext =
|
|
1470
|
+
import { z as z9 } from "zod/v4";
|
|
1471
|
+
var urlContext = createProviderDefinedToolFactory5({
|
|
1448
1472
|
id: "google.url_context",
|
|
1449
1473
|
name: "url_context",
|
|
1450
|
-
inputSchema:
|
|
1474
|
+
inputSchema: lazySchema8(() => zodSchema8(z9.object({})))
|
|
1451
1475
|
});
|
|
1452
1476
|
|
|
1453
1477
|
// src/tool/vertex-rag-store.ts
|
|
1454
|
-
import { createProviderDefinedToolFactory as
|
|
1455
|
-
import { z as
|
|
1456
|
-
var vertexRagStore =
|
|
1478
|
+
import { createProviderDefinedToolFactory as createProviderDefinedToolFactory6 } from "@ai-sdk/provider-utils";
|
|
1479
|
+
import { z as z10 } from "zod/v4";
|
|
1480
|
+
var vertexRagStore = createProviderDefinedToolFactory6({
|
|
1457
1481
|
id: "google.vertex_rag_store",
|
|
1458
1482
|
name: "vertex_rag_store",
|
|
1459
|
-
inputSchema:
|
|
1460
|
-
ragCorpus:
|
|
1461
|
-
topK:
|
|
1483
|
+
inputSchema: z10.object({
|
|
1484
|
+
ragCorpus: z10.string(),
|
|
1485
|
+
topK: z10.number().optional()
|
|
1462
1486
|
})
|
|
1463
1487
|
});
|
|
1464
1488
|
|
|
@@ -1469,6 +1493,17 @@ var googleTools = {
|
|
|
1469
1493
|
* Must have name "google_search".
|
|
1470
1494
|
*/
|
|
1471
1495
|
googleSearch,
|
|
1496
|
+
/**
|
|
1497
|
+
* Creates an Enterprise Web Search tool for grounding responses using a compliance-focused web index.
|
|
1498
|
+
* Designed for highly-regulated industries (finance, healthcare, public sector).
|
|
1499
|
+
* Does not log customer data and supports VPC service controls.
|
|
1500
|
+
* Must have name "enterprise_web_search".
|
|
1501
|
+
*
|
|
1502
|
+
* @note Only available on Vertex AI. Requires Gemini 2.0 or newer.
|
|
1503
|
+
*
|
|
1504
|
+
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
|
|
1505
|
+
*/
|
|
1506
|
+
enterpriseWebSearch,
|
|
1472
1507
|
/**
|
|
1473
1508
|
* Creates a Google Maps grounding tool that gives the model access to Google Maps data.
|
|
1474
1509
|
* Must have name "google_maps".
|