@ai-sdk/google 2.0.47 → 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 +12 -0
- package/dist/index.d.mts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +83 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +85 -50
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +12 -1
- package/dist/internal/index.d.ts +12 -1
- package/dist/internal/index.js +62 -31
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +72 -37
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -3,7 +3,7 @@ import { Resolvable, FetchFunction, InferValidator } from '@ai-sdk/provider-util
|
|
|
3
3
|
import { LanguageModelV2 } from '@ai-sdk/provider';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
|
|
6
|
-
type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image-preview' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-04-17' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'gemini-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
|
|
6
|
+
type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image-preview' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-04-17' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'gemini-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
|
|
7
7
|
|
|
8
8
|
type GoogleGenerativeAIConfig = {
|
|
9
9
|
provider: string;
|
|
@@ -191,6 +191,17 @@ declare const googleTools: {
|
|
|
191
191
|
mode?: "MODE_DYNAMIC" | "MODE_UNSPECIFIED";
|
|
192
192
|
dynamicThreshold?: number;
|
|
193
193
|
}>;
|
|
194
|
+
/**
|
|
195
|
+
* Creates an Enterprise Web Search tool for grounding responses using a compliance-focused web index.
|
|
196
|
+
* Designed for highly-regulated industries (finance, healthcare, public sector).
|
|
197
|
+
* Does not log customer data and supports VPC service controls.
|
|
198
|
+
* Must have name "enterprise_web_search".
|
|
199
|
+
*
|
|
200
|
+
* @note Only available on Vertex AI. Requires Gemini 2.0 or newer.
|
|
201
|
+
*
|
|
202
|
+
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
|
|
203
|
+
*/
|
|
204
|
+
enterpriseWebSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {}>;
|
|
194
205
|
/**
|
|
195
206
|
* Creates a Google Maps grounding tool that gives the model access to Google Maps data.
|
|
196
207
|
* Must have name "google_maps".
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Resolvable, FetchFunction, InferValidator } from '@ai-sdk/provider-util
|
|
|
3
3
|
import { LanguageModelV2 } from '@ai-sdk/provider';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
|
|
6
|
-
type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image-preview' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-04-17' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'gemini-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
|
|
6
|
+
type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image-preview' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-04-17' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'gemini-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
|
|
7
7
|
|
|
8
8
|
type GoogleGenerativeAIConfig = {
|
|
9
9
|
provider: string;
|
|
@@ -191,6 +191,17 @@ declare const googleTools: {
|
|
|
191
191
|
mode?: "MODE_DYNAMIC" | "MODE_UNSPECIFIED";
|
|
192
192
|
dynamicThreshold?: number;
|
|
193
193
|
}>;
|
|
194
|
+
/**
|
|
195
|
+
* Creates an Enterprise Web Search tool for grounding responses using a compliance-focused web index.
|
|
196
|
+
* Designed for highly-regulated industries (finance, healthcare, public sector).
|
|
197
|
+
* Does not log customer data and supports VPC service controls.
|
|
198
|
+
* Must have name "enterprise_web_search".
|
|
199
|
+
*
|
|
200
|
+
* @note Only available on Vertex AI. Requires Gemini 2.0 or newer.
|
|
201
|
+
*
|
|
202
|
+
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
|
|
203
|
+
*/
|
|
204
|
+
enterpriseWebSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {}>;
|
|
194
205
|
/**
|
|
195
206
|
* Creates a Google Maps grounding tool that gives the model access to Google Maps data.
|
|
196
207
|
* Must have name "google_maps".
|
package/dist/internal/index.js
CHANGED
|
@@ -333,7 +333,7 @@ var googleGenerativeAIProviderOptions = (0, import_provider_utils3.lazySchema)(
|
|
|
333
333
|
thinkingBudget: import_v42.z.number().optional(),
|
|
334
334
|
includeThoughts: import_v42.z.boolean().optional(),
|
|
335
335
|
// https://ai.google.dev/gemini-api/docs/gemini-3?thinking=high#thinking_level
|
|
336
|
-
thinkingLevel: import_v42.z.enum(["low", "medium", "high"]).optional()
|
|
336
|
+
thinkingLevel: import_v42.z.enum(["minimal", "low", "medium", "high"]).optional()
|
|
337
337
|
}).optional(),
|
|
338
338
|
/**
|
|
339
339
|
* Optional.
|
|
@@ -496,6 +496,17 @@ function prepareTools({
|
|
|
496
496
|
googleTools2.push({ googleSearchRetrieval: {} });
|
|
497
497
|
}
|
|
498
498
|
break;
|
|
499
|
+
case "google.enterprise_web_search":
|
|
500
|
+
if (isGemini2orNewer) {
|
|
501
|
+
googleTools2.push({ enterpriseWebSearch: {} });
|
|
502
|
+
} else {
|
|
503
|
+
toolWarnings.push({
|
|
504
|
+
type: "unsupported-tool",
|
|
505
|
+
tool,
|
|
506
|
+
details: "Enterprise Web Search requires Gemini 2.0 or newer."
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
break;
|
|
499
510
|
case "google.url_context":
|
|
500
511
|
if (isGemini2orNewer) {
|
|
501
512
|
googleTools2.push({ urlContext: {} });
|
|
@@ -1380,77 +1391,86 @@ var codeExecution = (0, import_provider_utils5.createProviderDefinedToolFactoryW
|
|
|
1380
1391
|
})
|
|
1381
1392
|
});
|
|
1382
1393
|
|
|
1383
|
-
// src/tool/
|
|
1394
|
+
// src/tool/enterprise-web-search.ts
|
|
1384
1395
|
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1385
1396
|
var import_v45 = require("zod/v4");
|
|
1386
|
-
var
|
|
1397
|
+
var enterpriseWebSearch = (0, import_provider_utils6.createProviderDefinedToolFactory)({
|
|
1398
|
+
id: "google.enterprise_web_search",
|
|
1399
|
+
name: "enterprise_web_search",
|
|
1400
|
+
inputSchema: (0, import_provider_utils6.lazySchema)(() => (0, import_provider_utils6.zodSchema)(import_v45.z.object({})))
|
|
1401
|
+
});
|
|
1402
|
+
|
|
1403
|
+
// src/tool/file-search.ts
|
|
1404
|
+
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1405
|
+
var import_v46 = require("zod/v4");
|
|
1406
|
+
var fileSearchArgsBaseSchema = import_v46.z.object({
|
|
1387
1407
|
/** The names of the file_search_stores to retrieve from.
|
|
1388
1408
|
* Example: `fileSearchStores/my-file-search-store-123`
|
|
1389
1409
|
*/
|
|
1390
|
-
fileSearchStoreNames:
|
|
1410
|
+
fileSearchStoreNames: import_v46.z.array(import_v46.z.string()).describe(
|
|
1391
1411
|
"The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
|
|
1392
1412
|
),
|
|
1393
1413
|
/** The number of file search retrieval chunks to retrieve. */
|
|
1394
|
-
topK:
|
|
1414
|
+
topK: import_v46.z.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
|
|
1395
1415
|
/** Metadata filter to apply to the file search retrieval documents.
|
|
1396
1416
|
* See https://google.aip.dev/160 for the syntax of the filter expression.
|
|
1397
1417
|
*/
|
|
1398
|
-
metadataFilter:
|
|
1418
|
+
metadataFilter: import_v46.z.string().describe(
|
|
1399
1419
|
"Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
|
|
1400
1420
|
).optional()
|
|
1401
1421
|
}).passthrough();
|
|
1402
|
-
var fileSearchArgsSchema = (0,
|
|
1403
|
-
() => (0,
|
|
1422
|
+
var fileSearchArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
1423
|
+
() => (0, import_provider_utils7.zodSchema)(fileSearchArgsBaseSchema)
|
|
1404
1424
|
);
|
|
1405
|
-
var fileSearch = (0,
|
|
1425
|
+
var fileSearch = (0, import_provider_utils7.createProviderDefinedToolFactory)({
|
|
1406
1426
|
id: "google.file_search",
|
|
1407
1427
|
name: "file_search",
|
|
1408
1428
|
inputSchema: fileSearchArgsSchema
|
|
1409
1429
|
});
|
|
1410
1430
|
|
|
1411
1431
|
// src/tool/google-maps.ts
|
|
1412
|
-
var
|
|
1413
|
-
var
|
|
1414
|
-
var googleMaps = (0,
|
|
1432
|
+
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1433
|
+
var import_v47 = require("zod/v4");
|
|
1434
|
+
var googleMaps = (0, import_provider_utils8.createProviderDefinedToolFactory)({
|
|
1415
1435
|
id: "google.google_maps",
|
|
1416
1436
|
name: "google_maps",
|
|
1417
|
-
inputSchema: (0,
|
|
1437
|
+
inputSchema: (0, import_provider_utils8.lazySchema)(() => (0, import_provider_utils8.zodSchema)(import_v47.z.object({})))
|
|
1418
1438
|
});
|
|
1419
1439
|
|
|
1420
1440
|
// src/tool/google-search.ts
|
|
1421
|
-
var
|
|
1422
|
-
var
|
|
1423
|
-
var googleSearch = (0,
|
|
1441
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1442
|
+
var import_v48 = require("zod/v4");
|
|
1443
|
+
var googleSearch = (0, import_provider_utils9.createProviderDefinedToolFactory)({
|
|
1424
1444
|
id: "google.google_search",
|
|
1425
1445
|
name: "google_search",
|
|
1426
|
-
inputSchema: (0,
|
|
1427
|
-
() => (0,
|
|
1428
|
-
|
|
1429
|
-
mode:
|
|
1430
|
-
dynamicThreshold:
|
|
1446
|
+
inputSchema: (0, import_provider_utils9.lazySchema)(
|
|
1447
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1448
|
+
import_v48.z.object({
|
|
1449
|
+
mode: import_v48.z.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
|
|
1450
|
+
dynamicThreshold: import_v48.z.number().default(1)
|
|
1431
1451
|
})
|
|
1432
1452
|
)
|
|
1433
1453
|
)
|
|
1434
1454
|
});
|
|
1435
1455
|
|
|
1436
1456
|
// src/tool/url-context.ts
|
|
1437
|
-
var
|
|
1438
|
-
var
|
|
1439
|
-
var urlContext = (0,
|
|
1457
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1458
|
+
var import_v49 = require("zod/v4");
|
|
1459
|
+
var urlContext = (0, import_provider_utils10.createProviderDefinedToolFactory)({
|
|
1440
1460
|
id: "google.url_context",
|
|
1441
1461
|
name: "url_context",
|
|
1442
|
-
inputSchema: (0,
|
|
1462
|
+
inputSchema: (0, import_provider_utils10.lazySchema)(() => (0, import_provider_utils10.zodSchema)(import_v49.z.object({})))
|
|
1443
1463
|
});
|
|
1444
1464
|
|
|
1445
1465
|
// src/tool/vertex-rag-store.ts
|
|
1446
|
-
var
|
|
1447
|
-
var
|
|
1448
|
-
var vertexRagStore = (0,
|
|
1466
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1467
|
+
var import_v410 = require("zod/v4");
|
|
1468
|
+
var vertexRagStore = (0, import_provider_utils11.createProviderDefinedToolFactory)({
|
|
1449
1469
|
id: "google.vertex_rag_store",
|
|
1450
1470
|
name: "vertex_rag_store",
|
|
1451
|
-
inputSchema:
|
|
1452
|
-
ragCorpus:
|
|
1453
|
-
topK:
|
|
1471
|
+
inputSchema: import_v410.z.object({
|
|
1472
|
+
ragCorpus: import_v410.z.string(),
|
|
1473
|
+
topK: import_v410.z.number().optional()
|
|
1454
1474
|
})
|
|
1455
1475
|
});
|
|
1456
1476
|
|
|
@@ -1461,6 +1481,17 @@ var googleTools = {
|
|
|
1461
1481
|
* Must have name "google_search".
|
|
1462
1482
|
*/
|
|
1463
1483
|
googleSearch,
|
|
1484
|
+
/**
|
|
1485
|
+
* Creates an Enterprise Web Search tool for grounding responses using a compliance-focused web index.
|
|
1486
|
+
* Designed for highly-regulated industries (finance, healthcare, public sector).
|
|
1487
|
+
* Does not log customer data and supports VPC service controls.
|
|
1488
|
+
* Must have name "enterprise_web_search".
|
|
1489
|
+
*
|
|
1490
|
+
* @note Only available on Vertex AI. Requires Gemini 2.0 or newer.
|
|
1491
|
+
*
|
|
1492
|
+
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
|
|
1493
|
+
*/
|
|
1494
|
+
enterpriseWebSearch,
|
|
1464
1495
|
/**
|
|
1465
1496
|
* Creates a Google Maps grounding tool that gives the model access to Google Maps data.
|
|
1466
1497
|
* Must have name "google_maps".
|