@ai-sdk/google 2.1.0-beta.9 → 3.0.0-beta.15
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 +51 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +152 -137
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -15
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +2 -2
- package/dist/internal/index.d.ts +2 -2
- package/dist/internal/index.js +136 -121
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +16 -11
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,56 @@
|
|
1
1
|
# @ai-sdk/google
|
2
2
|
|
3
|
+
## 3.0.0-beta.15
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 95f65c2: chore: use import \* from zod/v4
|
8
|
+
- Updated dependencies [95f65c2]
|
9
|
+
- Updated dependencies [95f65c2]
|
10
|
+
- @ai-sdk/provider-utils@4.0.0-beta.11
|
11
|
+
|
12
|
+
## 3.0.0-beta.14
|
13
|
+
|
14
|
+
### Major Changes
|
15
|
+
|
16
|
+
- dee8b05: ai SDK 6 beta
|
17
|
+
|
18
|
+
### Patch Changes
|
19
|
+
|
20
|
+
- Updated dependencies [dee8b05]
|
21
|
+
- @ai-sdk/provider@3.0.0-beta.6
|
22
|
+
- @ai-sdk/provider-utils@4.0.0-beta.10
|
23
|
+
|
24
|
+
## 2.1.0-beta.13
|
25
|
+
|
26
|
+
### Patch Changes
|
27
|
+
|
28
|
+
- Updated dependencies [521c537]
|
29
|
+
- @ai-sdk/provider-utils@3.1.0-beta.9
|
30
|
+
|
31
|
+
## 2.1.0-beta.12
|
32
|
+
|
33
|
+
### Patch Changes
|
34
|
+
|
35
|
+
- Updated dependencies [e06565c]
|
36
|
+
- @ai-sdk/provider-utils@3.1.0-beta.8
|
37
|
+
|
38
|
+
## 2.1.0-beta.11
|
39
|
+
|
40
|
+
### Patch Changes
|
41
|
+
|
42
|
+
- 9a728c8: support latest gemini model id
|
43
|
+
|
44
|
+
## 2.1.0-beta.10
|
45
|
+
|
46
|
+
### Patch Changes
|
47
|
+
|
48
|
+
- e8109d3: feat: tool execution approval
|
49
|
+
- Updated dependencies [046aa3b]
|
50
|
+
- Updated dependencies [e8109d3]
|
51
|
+
- @ai-sdk/provider@2.1.0-beta.5
|
52
|
+
- @ai-sdk/provider-utils@3.1.0-beta.7
|
53
|
+
|
3
54
|
## 2.1.0-beta.9
|
4
55
|
|
5
56
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import * as z from 'zod/v4';
|
2
2
|
import { ProviderV3, LanguageModelV3, ImageModelV3, EmbeddingModelV3 } from '@ai-sdk/provider';
|
3
3
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
4
4
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
@@ -12,7 +12,7 @@ declare const googleErrorDataSchema: z.ZodObject<{
|
|
12
12
|
}, z.core.$strip>;
|
13
13
|
type GoogleErrorData = z.infer<typeof googleErrorDataSchema>;
|
14
14
|
|
15
|
-
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-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
|
15
|
+
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-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 & {});
|
16
16
|
declare const googleGenerativeAIProviderOptions: z.ZodObject<{
|
17
17
|
responseModalities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
18
18
|
TEXT: "TEXT";
|
package/dist/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import * as z from 'zod/v4';
|
2
2
|
import { ProviderV3, LanguageModelV3, ImageModelV3, EmbeddingModelV3 } from '@ai-sdk/provider';
|
3
3
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
4
4
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
@@ -12,7 +12,7 @@ declare const googleErrorDataSchema: z.ZodObject<{
|
|
12
12
|
}, z.core.$strip>;
|
13
13
|
type GoogleErrorData = z.infer<typeof googleErrorDataSchema>;
|
14
14
|
|
15
|
-
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-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
|
15
|
+
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-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 & {});
|
16
16
|
declare const googleGenerativeAIProviderOptions: z.ZodObject<{
|
17
17
|
responseModalities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
18
18
|
TEXT: "TEXT";
|
package/dist/index.js
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __create = Object.create;
|
2
3
|
var __defProp = Object.defineProperty;
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
8
|
var __export = (target, all) => {
|
7
9
|
for (var name in all)
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
15
17
|
}
|
16
18
|
return to;
|
17
19
|
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
29
|
|
20
30
|
// src/index.ts
|
@@ -30,21 +40,21 @@ module.exports = __toCommonJS(src_exports);
|
|
30
40
|
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
31
41
|
|
32
42
|
// src/version.ts
|
33
|
-
var VERSION = true ? "
|
43
|
+
var VERSION = true ? "3.0.0-beta.15" : "0.0.0-test";
|
34
44
|
|
35
45
|
// src/google-generative-ai-embedding-model.ts
|
36
46
|
var import_provider = require("@ai-sdk/provider");
|
37
47
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
38
|
-
var
|
48
|
+
var z3 = __toESM(require("zod/v4"));
|
39
49
|
|
40
50
|
// src/google-error.ts
|
41
51
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
42
|
-
var
|
43
|
-
var googleErrorDataSchema =
|
44
|
-
error:
|
45
|
-
code:
|
46
|
-
message:
|
47
|
-
status:
|
52
|
+
var z = __toESM(require("zod/v4"));
|
53
|
+
var googleErrorDataSchema = z.object({
|
54
|
+
error: z.object({
|
55
|
+
code: z.number().nullable(),
|
56
|
+
message: z.string(),
|
57
|
+
status: z.string()
|
48
58
|
})
|
49
59
|
});
|
50
60
|
var googleFailedResponseHandler = (0, import_provider_utils.createJsonErrorResponseHandler)({
|
@@ -53,13 +63,13 @@ var googleFailedResponseHandler = (0, import_provider_utils.createJsonErrorRespo
|
|
53
63
|
});
|
54
64
|
|
55
65
|
// src/google-generative-ai-embedding-options.ts
|
56
|
-
var
|
57
|
-
var googleGenerativeAIEmbeddingProviderOptions =
|
66
|
+
var z2 = __toESM(require("zod/v4"));
|
67
|
+
var googleGenerativeAIEmbeddingProviderOptions = z2.object({
|
58
68
|
/**
|
59
69
|
* Optional. Optional reduced dimension for the output embedding.
|
60
70
|
* If set, excessive values in the output embedding are truncated from the end.
|
61
71
|
*/
|
62
|
-
outputDimensionality:
|
72
|
+
outputDimensionality: z2.number().optional(),
|
63
73
|
/**
|
64
74
|
* Optional. Specifies the task type for generating embeddings.
|
65
75
|
* Supported task types:
|
@@ -72,7 +82,7 @@ var googleGenerativeAIEmbeddingProviderOptions = import_v42.z.object({
|
|
72
82
|
* - FACT_VERIFICATION: Optimized for verifying factual information.
|
73
83
|
* - CODE_RETRIEVAL_QUERY: Optimized for retrieving code blocks based on natural language queries.
|
74
84
|
*/
|
75
|
-
taskType:
|
85
|
+
taskType: z2.enum([
|
76
86
|
"SEMANTIC_SIMILARITY",
|
77
87
|
"CLASSIFICATION",
|
78
88
|
"CLUSTERING",
|
@@ -177,16 +187,16 @@ var GoogleGenerativeAIEmbeddingModel = class {
|
|
177
187
|
};
|
178
188
|
}
|
179
189
|
};
|
180
|
-
var googleGenerativeAITextEmbeddingResponseSchema =
|
181
|
-
embeddings:
|
190
|
+
var googleGenerativeAITextEmbeddingResponseSchema = z3.object({
|
191
|
+
embeddings: z3.array(z3.object({ values: z3.array(z3.number()) }))
|
182
192
|
});
|
183
|
-
var googleGenerativeAISingleEmbeddingResponseSchema =
|
184
|
-
embedding:
|
193
|
+
var googleGenerativeAISingleEmbeddingResponseSchema = z3.object({
|
194
|
+
embedding: z3.object({ values: z3.array(z3.number()) })
|
185
195
|
});
|
186
196
|
|
187
197
|
// src/google-generative-ai-language-model.ts
|
188
198
|
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
189
|
-
var
|
199
|
+
var z7 = __toESM(require("zod/v4"));
|
190
200
|
|
191
201
|
// src/convert-json-schema-to-openapi-schema.ts
|
192
202
|
function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
@@ -286,7 +296,7 @@ function isEmptyObjectSchema(jsonSchema) {
|
|
286
296
|
var import_provider2 = require("@ai-sdk/provider");
|
287
297
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
288
298
|
function convertToGoogleGenerativeAIMessages(prompt, options) {
|
289
|
-
var _a;
|
299
|
+
var _a, _b;
|
290
300
|
const systemInstructionParts = [];
|
291
301
|
const contents = [];
|
292
302
|
let systemMessagesAllowed = true;
|
@@ -338,12 +348,12 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
338
348
|
contents.push({
|
339
349
|
role: "model",
|
340
350
|
parts: content.map((part) => {
|
341
|
-
var _a2,
|
351
|
+
var _a2, _b2, _c, _d, _e, _f;
|
342
352
|
switch (part.type) {
|
343
353
|
case "text": {
|
344
354
|
return part.text.length === 0 ? void 0 : {
|
345
355
|
text: part.text,
|
346
|
-
thoughtSignature: (
|
356
|
+
thoughtSignature: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.google) == null ? void 0 : _b2.thoughtSignature
|
347
357
|
};
|
348
358
|
}
|
349
359
|
case "reasoning": {
|
@@ -428,7 +438,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
428
438
|
name: part.toolName,
|
429
439
|
response: {
|
430
440
|
name: part.toolName,
|
431
|
-
content: output.value
|
441
|
+
content: output.type === "execution-denied" ? (_b = output.reason) != null ? _b : "Tool execution denied." : output.value
|
432
442
|
}
|
433
443
|
}
|
434
444
|
});
|
@@ -458,19 +468,19 @@ function getModelPath(modelId) {
|
|
458
468
|
}
|
459
469
|
|
460
470
|
// src/google-generative-ai-options.ts
|
461
|
-
var
|
462
|
-
var googleGenerativeAIProviderOptions =
|
463
|
-
responseModalities:
|
464
|
-
thinkingConfig:
|
465
|
-
thinkingBudget:
|
466
|
-
includeThoughts:
|
471
|
+
var z4 = __toESM(require("zod/v4"));
|
472
|
+
var googleGenerativeAIProviderOptions = z4.object({
|
473
|
+
responseModalities: z4.array(z4.enum(["TEXT", "IMAGE"])).optional(),
|
474
|
+
thinkingConfig: z4.object({
|
475
|
+
thinkingBudget: z4.number().optional(),
|
476
|
+
includeThoughts: z4.boolean().optional()
|
467
477
|
}).optional(),
|
468
478
|
/**
|
469
479
|
Optional.
|
470
480
|
The name of the cached content used as context to serve the prediction.
|
471
481
|
Format: cachedContents/{cachedContent}
|
472
482
|
*/
|
473
|
-
cachedContent:
|
483
|
+
cachedContent: z4.string().optional(),
|
474
484
|
/**
|
475
485
|
* Optional. Enable structured output. Default is true.
|
476
486
|
*
|
@@ -479,13 +489,13 @@ var googleGenerativeAIProviderOptions = import_v44.z.object({
|
|
479
489
|
* Google Generative AI uses. You can use this to disable
|
480
490
|
* structured outputs if you need to.
|
481
491
|
*/
|
482
|
-
structuredOutputs:
|
492
|
+
structuredOutputs: z4.boolean().optional(),
|
483
493
|
/**
|
484
494
|
Optional. A list of unique safety settings for blocking unsafe content.
|
485
495
|
*/
|
486
|
-
safetySettings:
|
487
|
-
|
488
|
-
category:
|
496
|
+
safetySettings: z4.array(
|
497
|
+
z4.object({
|
498
|
+
category: z4.enum([
|
489
499
|
"HARM_CATEGORY_UNSPECIFIED",
|
490
500
|
"HARM_CATEGORY_HATE_SPEECH",
|
491
501
|
"HARM_CATEGORY_DANGEROUS_CONTENT",
|
@@ -493,7 +503,7 @@ var googleGenerativeAIProviderOptions = import_v44.z.object({
|
|
493
503
|
"HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
494
504
|
"HARM_CATEGORY_CIVIC_INTEGRITY"
|
495
505
|
]),
|
496
|
-
threshold:
|
506
|
+
threshold: z4.enum([
|
497
507
|
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
498
508
|
"BLOCK_LOW_AND_ABOVE",
|
499
509
|
"BLOCK_MEDIUM_AND_ABOVE",
|
@@ -503,7 +513,7 @@ var googleGenerativeAIProviderOptions = import_v44.z.object({
|
|
503
513
|
])
|
504
514
|
})
|
505
515
|
).optional(),
|
506
|
-
threshold:
|
516
|
+
threshold: z4.enum([
|
507
517
|
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
508
518
|
"BLOCK_LOW_AND_ABOVE",
|
509
519
|
"BLOCK_MEDIUM_AND_ABOVE",
|
@@ -516,19 +526,19 @@ var googleGenerativeAIProviderOptions = import_v44.z.object({
|
|
516
526
|
*
|
517
527
|
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
|
518
528
|
*/
|
519
|
-
audioTimestamp:
|
529
|
+
audioTimestamp: z4.boolean().optional(),
|
520
530
|
/**
|
521
531
|
* Optional. Defines labels used in billing reports. Available on Vertex AI only.
|
522
532
|
*
|
523
533
|
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
|
524
534
|
*/
|
525
|
-
labels:
|
535
|
+
labels: z4.record(z4.string(), z4.string()).optional(),
|
526
536
|
/**
|
527
537
|
* Optional. If specified, the media resolution specified will be used.
|
528
538
|
*
|
529
539
|
* https://ai.google.dev/api/generate-content#MediaResolution
|
530
540
|
*/
|
531
|
-
mediaResolution:
|
541
|
+
mediaResolution: z4.enum([
|
532
542
|
"MEDIA_RESOLUTION_UNSPECIFIED",
|
533
543
|
"MEDIA_RESOLUTION_LOW",
|
534
544
|
"MEDIA_RESOLUTION_MEDIUM",
|
@@ -546,7 +556,12 @@ function prepareTools({
|
|
546
556
|
var _a;
|
547
557
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
548
558
|
const toolWarnings = [];
|
549
|
-
const
|
559
|
+
const isLatest = [
|
560
|
+
"gemini-flash-latest",
|
561
|
+
"gemini-flash-lite-latest",
|
562
|
+
"gemini-pro-latest"
|
563
|
+
].some((id) => id === modelId);
|
564
|
+
const isGemini2 = modelId.includes("gemini-2") || isLatest;
|
550
565
|
const supportsDynamicRetrieval = modelId.includes("gemini-1.5-flash") && !modelId.includes("-8b");
|
551
566
|
if (tools == null) {
|
552
567
|
return { tools: void 0, toolConfig: void 0, toolWarnings };
|
@@ -707,60 +722,60 @@ function mapGoogleGenerativeAIFinishReason({
|
|
707
722
|
|
708
723
|
// src/tool/google-search.ts
|
709
724
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
710
|
-
var
|
711
|
-
var groundingChunkSchema =
|
712
|
-
web:
|
713
|
-
retrievedContext:
|
725
|
+
var z5 = __toESM(require("zod/v4"));
|
726
|
+
var groundingChunkSchema = z5.object({
|
727
|
+
web: z5.object({ uri: z5.string(), title: z5.string() }).nullish(),
|
728
|
+
retrievedContext: z5.object({ uri: z5.string(), title: z5.string() }).nullish()
|
714
729
|
});
|
715
|
-
var groundingMetadataSchema =
|
716
|
-
webSearchQueries:
|
717
|
-
retrievalQueries:
|
718
|
-
searchEntryPoint:
|
719
|
-
groundingChunks:
|
720
|
-
groundingSupports:
|
721
|
-
|
722
|
-
segment:
|
723
|
-
startIndex:
|
724
|
-
endIndex:
|
725
|
-
text:
|
730
|
+
var groundingMetadataSchema = z5.object({
|
731
|
+
webSearchQueries: z5.array(z5.string()).nullish(),
|
732
|
+
retrievalQueries: z5.array(z5.string()).nullish(),
|
733
|
+
searchEntryPoint: z5.object({ renderedContent: z5.string() }).nullish(),
|
734
|
+
groundingChunks: z5.array(groundingChunkSchema).nullish(),
|
735
|
+
groundingSupports: z5.array(
|
736
|
+
z5.object({
|
737
|
+
segment: z5.object({
|
738
|
+
startIndex: z5.number().nullish(),
|
739
|
+
endIndex: z5.number().nullish(),
|
740
|
+
text: z5.string().nullish()
|
726
741
|
}),
|
727
|
-
segment_text:
|
728
|
-
groundingChunkIndices:
|
729
|
-
supportChunkIndices:
|
730
|
-
confidenceScores:
|
731
|
-
confidenceScore:
|
742
|
+
segment_text: z5.string().nullish(),
|
743
|
+
groundingChunkIndices: z5.array(z5.number()).nullish(),
|
744
|
+
supportChunkIndices: z5.array(z5.number()).nullish(),
|
745
|
+
confidenceScores: z5.array(z5.number()).nullish(),
|
746
|
+
confidenceScore: z5.array(z5.number()).nullish()
|
732
747
|
})
|
733
748
|
).nullish(),
|
734
|
-
retrievalMetadata:
|
735
|
-
|
736
|
-
webDynamicRetrievalScore:
|
749
|
+
retrievalMetadata: z5.union([
|
750
|
+
z5.object({
|
751
|
+
webDynamicRetrievalScore: z5.number()
|
737
752
|
}),
|
738
|
-
|
753
|
+
z5.object({})
|
739
754
|
]).nullish()
|
740
755
|
});
|
741
756
|
var googleSearch = (0, import_provider_utils4.createProviderDefinedToolFactory)({
|
742
757
|
id: "google.google_search",
|
743
758
|
name: "google_search",
|
744
|
-
inputSchema:
|
745
|
-
mode:
|
746
|
-
dynamicThreshold:
|
759
|
+
inputSchema: z5.object({
|
760
|
+
mode: z5.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
|
761
|
+
dynamicThreshold: z5.number().default(1)
|
747
762
|
})
|
748
763
|
});
|
749
764
|
|
750
765
|
// src/tool/url-context.ts
|
751
766
|
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
752
|
-
var
|
753
|
-
var urlMetadataSchema =
|
754
|
-
retrievedUrl:
|
755
|
-
urlRetrievalStatus:
|
767
|
+
var z6 = __toESM(require("zod/v4"));
|
768
|
+
var urlMetadataSchema = z6.object({
|
769
|
+
retrievedUrl: z6.string(),
|
770
|
+
urlRetrievalStatus: z6.string()
|
756
771
|
});
|
757
|
-
var urlContextMetadataSchema =
|
758
|
-
urlMetadata:
|
772
|
+
var urlContextMetadataSchema = z6.object({
|
773
|
+
urlMetadata: z6.array(urlMetadataSchema)
|
759
774
|
});
|
760
775
|
var urlContext = (0, import_provider_utils5.createProviderDefinedToolFactory)({
|
761
776
|
id: "google.url_context",
|
762
777
|
name: "url_context",
|
763
|
-
inputSchema:
|
778
|
+
inputSchema: z6.object({})
|
764
779
|
});
|
765
780
|
|
766
781
|
// src/google-generative-ai-language-model.ts
|
@@ -1258,100 +1273,100 @@ function extractSources({
|
|
1258
1273
|
title: chunk.web.title
|
1259
1274
|
}));
|
1260
1275
|
}
|
1261
|
-
var contentSchema =
|
1262
|
-
parts:
|
1263
|
-
|
1276
|
+
var contentSchema = z7.object({
|
1277
|
+
parts: z7.array(
|
1278
|
+
z7.union([
|
1264
1279
|
// note: order matters since text can be fully empty
|
1265
|
-
|
1266
|
-
functionCall:
|
1267
|
-
name:
|
1268
|
-
args:
|
1280
|
+
z7.object({
|
1281
|
+
functionCall: z7.object({
|
1282
|
+
name: z7.string(),
|
1283
|
+
args: z7.unknown()
|
1269
1284
|
}),
|
1270
|
-
thoughtSignature:
|
1285
|
+
thoughtSignature: z7.string().nullish()
|
1271
1286
|
}),
|
1272
|
-
|
1273
|
-
inlineData:
|
1274
|
-
mimeType:
|
1275
|
-
data:
|
1287
|
+
z7.object({
|
1288
|
+
inlineData: z7.object({
|
1289
|
+
mimeType: z7.string(),
|
1290
|
+
data: z7.string()
|
1276
1291
|
})
|
1277
1292
|
}),
|
1278
|
-
|
1279
|
-
executableCode:
|
1280
|
-
language:
|
1281
|
-
code:
|
1293
|
+
z7.object({
|
1294
|
+
executableCode: z7.object({
|
1295
|
+
language: z7.string(),
|
1296
|
+
code: z7.string()
|
1282
1297
|
}).nullish(),
|
1283
|
-
codeExecutionResult:
|
1284
|
-
outcome:
|
1285
|
-
output:
|
1298
|
+
codeExecutionResult: z7.object({
|
1299
|
+
outcome: z7.string(),
|
1300
|
+
output: z7.string()
|
1286
1301
|
}).nullish(),
|
1287
|
-
text:
|
1288
|
-
thought:
|
1289
|
-
thoughtSignature:
|
1302
|
+
text: z7.string().nullish(),
|
1303
|
+
thought: z7.boolean().nullish(),
|
1304
|
+
thoughtSignature: z7.string().nullish()
|
1290
1305
|
})
|
1291
1306
|
])
|
1292
1307
|
).nullish()
|
1293
1308
|
});
|
1294
|
-
var safetyRatingSchema =
|
1295
|
-
category:
|
1296
|
-
probability:
|
1297
|
-
probabilityScore:
|
1298
|
-
severity:
|
1299
|
-
severityScore:
|
1300
|
-
blocked:
|
1309
|
+
var safetyRatingSchema = z7.object({
|
1310
|
+
category: z7.string().nullish(),
|
1311
|
+
probability: z7.string().nullish(),
|
1312
|
+
probabilityScore: z7.number().nullish(),
|
1313
|
+
severity: z7.string().nullish(),
|
1314
|
+
severityScore: z7.number().nullish(),
|
1315
|
+
blocked: z7.boolean().nullish()
|
1301
1316
|
});
|
1302
|
-
var usageSchema =
|
1303
|
-
cachedContentTokenCount:
|
1304
|
-
thoughtsTokenCount:
|
1305
|
-
promptTokenCount:
|
1306
|
-
candidatesTokenCount:
|
1307
|
-
totalTokenCount:
|
1317
|
+
var usageSchema = z7.object({
|
1318
|
+
cachedContentTokenCount: z7.number().nullish(),
|
1319
|
+
thoughtsTokenCount: z7.number().nullish(),
|
1320
|
+
promptTokenCount: z7.number().nullish(),
|
1321
|
+
candidatesTokenCount: z7.number().nullish(),
|
1322
|
+
totalTokenCount: z7.number().nullish()
|
1308
1323
|
});
|
1309
|
-
var responseSchema =
|
1310
|
-
candidates:
|
1311
|
-
|
1312
|
-
content: contentSchema.nullish().or(
|
1313
|
-
finishReason:
|
1314
|
-
safetyRatings:
|
1324
|
+
var responseSchema = z7.object({
|
1325
|
+
candidates: z7.array(
|
1326
|
+
z7.object({
|
1327
|
+
content: contentSchema.nullish().or(z7.object({}).strict()),
|
1328
|
+
finishReason: z7.string().nullish(),
|
1329
|
+
safetyRatings: z7.array(safetyRatingSchema).nullish(),
|
1315
1330
|
groundingMetadata: groundingMetadataSchema.nullish(),
|
1316
1331
|
urlContextMetadata: urlContextMetadataSchema.nullish()
|
1317
1332
|
})
|
1318
1333
|
),
|
1319
1334
|
usageMetadata: usageSchema.nullish(),
|
1320
|
-
promptFeedback:
|
1321
|
-
blockReason:
|
1322
|
-
safetyRatings:
|
1335
|
+
promptFeedback: z7.object({
|
1336
|
+
blockReason: z7.string().nullish(),
|
1337
|
+
safetyRatings: z7.array(safetyRatingSchema).nullish()
|
1323
1338
|
}).nullish()
|
1324
1339
|
});
|
1325
|
-
var chunkSchema =
|
1326
|
-
candidates:
|
1327
|
-
|
1340
|
+
var chunkSchema = z7.object({
|
1341
|
+
candidates: z7.array(
|
1342
|
+
z7.object({
|
1328
1343
|
content: contentSchema.nullish(),
|
1329
|
-
finishReason:
|
1330
|
-
safetyRatings:
|
1344
|
+
finishReason: z7.string().nullish(),
|
1345
|
+
safetyRatings: z7.array(safetyRatingSchema).nullish(),
|
1331
1346
|
groundingMetadata: groundingMetadataSchema.nullish(),
|
1332
1347
|
urlContextMetadata: urlContextMetadataSchema.nullish()
|
1333
1348
|
})
|
1334
1349
|
).nullish(),
|
1335
1350
|
usageMetadata: usageSchema.nullish(),
|
1336
|
-
promptFeedback:
|
1337
|
-
blockReason:
|
1338
|
-
safetyRatings:
|
1351
|
+
promptFeedback: z7.object({
|
1352
|
+
blockReason: z7.string().nullish(),
|
1353
|
+
safetyRatings: z7.array(safetyRatingSchema).nullish()
|
1339
1354
|
}).nullish()
|
1340
1355
|
});
|
1341
1356
|
|
1342
1357
|
// src/tool/code-execution.ts
|
1343
1358
|
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
1344
|
-
var
|
1359
|
+
var z8 = __toESM(require("zod/v4"));
|
1345
1360
|
var codeExecution = (0, import_provider_utils7.createProviderDefinedToolFactoryWithOutputSchema)({
|
1346
1361
|
id: "google.code_execution",
|
1347
1362
|
name: "code_execution",
|
1348
|
-
inputSchema:
|
1349
|
-
language:
|
1350
|
-
code:
|
1363
|
+
inputSchema: z8.object({
|
1364
|
+
language: z8.string().describe("The programming language of the code."),
|
1365
|
+
code: z8.string().describe("The code to be executed.")
|
1351
1366
|
}),
|
1352
|
-
outputSchema:
|
1353
|
-
outcome:
|
1354
|
-
output:
|
1367
|
+
outputSchema: z8.object({
|
1368
|
+
outcome: z8.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
|
1369
|
+
output: z8.string().describe("The output from the code execution.")
|
1355
1370
|
})
|
1356
1371
|
});
|
1357
1372
|
|
@@ -1382,7 +1397,7 @@ var googleTools = {
|
|
1382
1397
|
|
1383
1398
|
// src/google-generative-ai-image-model.ts
|
1384
1399
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
1385
|
-
var
|
1400
|
+
var z9 = __toESM(require("zod/v4"));
|
1386
1401
|
var GoogleGenerativeAIImageModel = class {
|
1387
1402
|
constructor(modelId, settings, config) {
|
1388
1403
|
this.modelId = modelId;
|
@@ -1474,12 +1489,12 @@ var GoogleGenerativeAIImageModel = class {
|
|
1474
1489
|
};
|
1475
1490
|
}
|
1476
1491
|
};
|
1477
|
-
var googleImageResponseSchema =
|
1478
|
-
predictions:
|
1492
|
+
var googleImageResponseSchema = z9.object({
|
1493
|
+
predictions: z9.array(z9.object({ bytesBase64Encoded: z9.string() })).default([])
|
1479
1494
|
});
|
1480
|
-
var googleImageProviderOptionsSchema =
|
1481
|
-
personGeneration:
|
1482
|
-
aspectRatio:
|
1495
|
+
var googleImageProviderOptionsSchema = z9.object({
|
1496
|
+
personGeneration: z9.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
1497
|
+
aspectRatio: z9.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish()
|
1483
1498
|
});
|
1484
1499
|
|
1485
1500
|
// src/google-provider.ts
|