@ai-sdk/google 3.0.0-beta.15 → 3.0.0-beta.17
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 +15 -0
- package/dist/index.d.mts +139 -138
- package/dist/index.d.ts +139 -138
- package/dist/index.js +312 -268
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +319 -251
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +138 -10
- package/dist/internal/index.d.ts +138 -10
- package/dist/internal/index.js +246 -221
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +249 -208
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
@@ -7,7 +7,7 @@ import {
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
8
8
|
|
9
9
|
// src/version.ts
|
10
|
-
var VERSION = true ? "3.0.0-beta.
|
10
|
+
var VERSION = true ? "3.0.0-beta.17" : "0.0.0-test";
|
11
11
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
13
13
|
import {
|
@@ -16,58 +16,76 @@ import {
|
|
16
16
|
import {
|
17
17
|
combineHeaders,
|
18
18
|
createJsonResponseHandler,
|
19
|
+
lazySchema as lazySchema3,
|
19
20
|
parseProviderOptions,
|
20
21
|
postJsonToApi,
|
21
|
-
resolve
|
22
|
+
resolve,
|
23
|
+
zodSchema as zodSchema3
|
22
24
|
} from "@ai-sdk/provider-utils";
|
23
25
|
import * as z3 from "zod/v4";
|
24
26
|
|
25
27
|
// src/google-error.ts
|
26
|
-
import {
|
28
|
+
import {
|
29
|
+
createJsonErrorResponseHandler,
|
30
|
+
lazySchema,
|
31
|
+
zodSchema
|
32
|
+
} from "@ai-sdk/provider-utils";
|
27
33
|
import * as z from "zod/v4";
|
28
|
-
var googleErrorDataSchema =
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
var googleErrorDataSchema = lazySchema(
|
35
|
+
() => zodSchema(
|
36
|
+
z.object({
|
37
|
+
error: z.object({
|
38
|
+
code: z.number().nullable(),
|
39
|
+
message: z.string(),
|
40
|
+
status: z.string()
|
41
|
+
})
|
42
|
+
})
|
43
|
+
)
|
44
|
+
);
|
35
45
|
var googleFailedResponseHandler = createJsonErrorResponseHandler({
|
36
46
|
errorSchema: googleErrorDataSchema,
|
37
47
|
errorToMessage: (data) => data.error.message
|
38
48
|
});
|
39
49
|
|
40
50
|
// src/google-generative-ai-embedding-options.ts
|
51
|
+
import {
|
52
|
+
lazySchema as lazySchema2,
|
53
|
+
zodSchema as zodSchema2
|
54
|
+
} from "@ai-sdk/provider-utils";
|
41
55
|
import * as z2 from "zod/v4";
|
42
|
-
var googleGenerativeAIEmbeddingProviderOptions =
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
56
|
+
var googleGenerativeAIEmbeddingProviderOptions = lazySchema2(
|
57
|
+
() => zodSchema2(
|
58
|
+
z2.object({
|
59
|
+
/**
|
60
|
+
* Optional. Optional reduced dimension for the output embedding.
|
61
|
+
* If set, excessive values in the output embedding are truncated from the end.
|
62
|
+
*/
|
63
|
+
outputDimensionality: z2.number().optional(),
|
64
|
+
/**
|
65
|
+
* Optional. Specifies the task type for generating embeddings.
|
66
|
+
* Supported task types:
|
67
|
+
* - SEMANTIC_SIMILARITY: Optimized for text similarity.
|
68
|
+
* - CLASSIFICATION: Optimized for text classification.
|
69
|
+
* - CLUSTERING: Optimized for clustering texts based on similarity.
|
70
|
+
* - RETRIEVAL_DOCUMENT: Optimized for document retrieval.
|
71
|
+
* - RETRIEVAL_QUERY: Optimized for query-based retrieval.
|
72
|
+
* - QUESTION_ANSWERING: Optimized for answering questions.
|
73
|
+
* - FACT_VERIFICATION: Optimized for verifying factual information.
|
74
|
+
* - CODE_RETRIEVAL_QUERY: Optimized for retrieving code blocks based on natural language queries.
|
75
|
+
*/
|
76
|
+
taskType: z2.enum([
|
77
|
+
"SEMANTIC_SIMILARITY",
|
78
|
+
"CLASSIFICATION",
|
79
|
+
"CLUSTERING",
|
80
|
+
"RETRIEVAL_DOCUMENT",
|
81
|
+
"RETRIEVAL_QUERY",
|
82
|
+
"QUESTION_ANSWERING",
|
83
|
+
"FACT_VERIFICATION",
|
84
|
+
"CODE_RETRIEVAL_QUERY"
|
85
|
+
]).optional()
|
86
|
+
})
|
87
|
+
)
|
88
|
+
);
|
71
89
|
|
72
90
|
// src/google-generative-ai-embedding-model.ts
|
73
91
|
var GoogleGenerativeAIEmbeddingModel = class {
|
@@ -162,12 +180,20 @@ var GoogleGenerativeAIEmbeddingModel = class {
|
|
162
180
|
};
|
163
181
|
}
|
164
182
|
};
|
165
|
-
var googleGenerativeAITextEmbeddingResponseSchema =
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
183
|
+
var googleGenerativeAITextEmbeddingResponseSchema = lazySchema3(
|
184
|
+
() => zodSchema3(
|
185
|
+
z3.object({
|
186
|
+
embeddings: z3.array(z3.object({ values: z3.array(z3.number()) }))
|
187
|
+
})
|
188
|
+
)
|
189
|
+
);
|
190
|
+
var googleGenerativeAISingleEmbeddingResponseSchema = lazySchema3(
|
191
|
+
() => zodSchema3(
|
192
|
+
z3.object({
|
193
|
+
embedding: z3.object({ values: z3.array(z3.number()) })
|
194
|
+
})
|
195
|
+
)
|
196
|
+
);
|
171
197
|
|
172
198
|
// src/google-generative-ai-language-model.ts
|
173
199
|
import {
|
@@ -175,11 +201,13 @@ import {
|
|
175
201
|
createEventSourceResponseHandler,
|
176
202
|
createJsonResponseHandler as createJsonResponseHandler2,
|
177
203
|
generateId,
|
204
|
+
lazySchema as lazySchema5,
|
178
205
|
parseProviderOptions as parseProviderOptions2,
|
179
206
|
postJsonToApi as postJsonToApi2,
|
180
|
-
resolve as resolve2
|
207
|
+
resolve as resolve2,
|
208
|
+
zodSchema as zodSchema5
|
181
209
|
} from "@ai-sdk/provider-utils";
|
182
|
-
import * as
|
210
|
+
import * as z5 from "zod/v4";
|
183
211
|
|
184
212
|
// src/convert-json-schema-to-openapi-schema.ts
|
185
213
|
function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
@@ -453,41 +481,57 @@ function getModelPath(modelId) {
|
|
453
481
|
}
|
454
482
|
|
455
483
|
// src/google-generative-ai-options.ts
|
484
|
+
import {
|
485
|
+
lazySchema as lazySchema4,
|
486
|
+
zodSchema as zodSchema4
|
487
|
+
} from "@ai-sdk/provider-utils";
|
456
488
|
import * as z4 from "zod/v4";
|
457
|
-
var googleGenerativeAIProviderOptions =
|
458
|
-
|
459
|
-
thinkingConfig: z4.object({
|
460
|
-
thinkingBudget: z4.number().optional(),
|
461
|
-
includeThoughts: z4.boolean().optional()
|
462
|
-
}).optional(),
|
463
|
-
/**
|
464
|
-
Optional.
|
465
|
-
The name of the cached content used as context to serve the prediction.
|
466
|
-
Format: cachedContents/{cachedContent}
|
467
|
-
*/
|
468
|
-
cachedContent: z4.string().optional(),
|
469
|
-
/**
|
470
|
-
* Optional. Enable structured output. Default is true.
|
471
|
-
*
|
472
|
-
* This is useful when the JSON Schema contains elements that are
|
473
|
-
* not supported by the OpenAPI schema version that
|
474
|
-
* Google Generative AI uses. You can use this to disable
|
475
|
-
* structured outputs if you need to.
|
476
|
-
*/
|
477
|
-
structuredOutputs: z4.boolean().optional(),
|
478
|
-
/**
|
479
|
-
Optional. A list of unique safety settings for blocking unsafe content.
|
480
|
-
*/
|
481
|
-
safetySettings: z4.array(
|
489
|
+
var googleGenerativeAIProviderOptions = lazySchema4(
|
490
|
+
() => zodSchema4(
|
482
491
|
z4.object({
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
492
|
+
responseModalities: z4.array(z4.enum(["TEXT", "IMAGE"])).optional(),
|
493
|
+
thinkingConfig: z4.object({
|
494
|
+
thinkingBudget: z4.number().optional(),
|
495
|
+
includeThoughts: z4.boolean().optional()
|
496
|
+
}).optional(),
|
497
|
+
/**
|
498
|
+
* Optional.
|
499
|
+
* The name of the cached content used as context to serve the prediction.
|
500
|
+
* Format: cachedContents/{cachedContent}
|
501
|
+
*/
|
502
|
+
cachedContent: z4.string().optional(),
|
503
|
+
/**
|
504
|
+
* Optional. Enable structured output. Default is true.
|
505
|
+
*
|
506
|
+
* This is useful when the JSON Schema contains elements that are
|
507
|
+
* not supported by the OpenAPI schema version that
|
508
|
+
* Google Generative AI uses. You can use this to disable
|
509
|
+
* structured outputs if you need to.
|
510
|
+
*/
|
511
|
+
structuredOutputs: z4.boolean().optional(),
|
512
|
+
/**
|
513
|
+
* Optional. A list of unique safety settings for blocking unsafe content.
|
514
|
+
*/
|
515
|
+
safetySettings: z4.array(
|
516
|
+
z4.object({
|
517
|
+
category: z4.enum([
|
518
|
+
"HARM_CATEGORY_UNSPECIFIED",
|
519
|
+
"HARM_CATEGORY_HATE_SPEECH",
|
520
|
+
"HARM_CATEGORY_DANGEROUS_CONTENT",
|
521
|
+
"HARM_CATEGORY_HARASSMENT",
|
522
|
+
"HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
523
|
+
"HARM_CATEGORY_CIVIC_INTEGRITY"
|
524
|
+
]),
|
525
|
+
threshold: z4.enum([
|
526
|
+
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
527
|
+
"BLOCK_LOW_AND_ABOVE",
|
528
|
+
"BLOCK_MEDIUM_AND_ABOVE",
|
529
|
+
"BLOCK_ONLY_HIGH",
|
530
|
+
"BLOCK_NONE",
|
531
|
+
"OFF"
|
532
|
+
])
|
533
|
+
})
|
534
|
+
).optional(),
|
491
535
|
threshold: z4.enum([
|
492
536
|
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
493
537
|
"BLOCK_LOW_AND_ABOVE",
|
@@ -495,41 +539,33 @@ var googleGenerativeAIProviderOptions = z4.object({
|
|
495
539
|
"BLOCK_ONLY_HIGH",
|
496
540
|
"BLOCK_NONE",
|
497
541
|
"OFF"
|
498
|
-
])
|
542
|
+
]).optional(),
|
543
|
+
/**
|
544
|
+
* Optional. Enables timestamp understanding for audio-only files.
|
545
|
+
*
|
546
|
+
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
|
547
|
+
*/
|
548
|
+
audioTimestamp: z4.boolean().optional(),
|
549
|
+
/**
|
550
|
+
* Optional. Defines labels used in billing reports. Available on Vertex AI only.
|
551
|
+
*
|
552
|
+
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
|
553
|
+
*/
|
554
|
+
labels: z4.record(z4.string(), z4.string()).optional(),
|
555
|
+
/**
|
556
|
+
* Optional. If specified, the media resolution specified will be used.
|
557
|
+
*
|
558
|
+
* https://ai.google.dev/api/generate-content#MediaResolution
|
559
|
+
*/
|
560
|
+
mediaResolution: z4.enum([
|
561
|
+
"MEDIA_RESOLUTION_UNSPECIFIED",
|
562
|
+
"MEDIA_RESOLUTION_LOW",
|
563
|
+
"MEDIA_RESOLUTION_MEDIUM",
|
564
|
+
"MEDIA_RESOLUTION_HIGH"
|
565
|
+
]).optional()
|
499
566
|
})
|
500
|
-
)
|
501
|
-
|
502
|
-
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
503
|
-
"BLOCK_LOW_AND_ABOVE",
|
504
|
-
"BLOCK_MEDIUM_AND_ABOVE",
|
505
|
-
"BLOCK_ONLY_HIGH",
|
506
|
-
"BLOCK_NONE",
|
507
|
-
"OFF"
|
508
|
-
]).optional(),
|
509
|
-
/**
|
510
|
-
* Optional. Enables timestamp understanding for audio-only files.
|
511
|
-
*
|
512
|
-
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
|
513
|
-
*/
|
514
|
-
audioTimestamp: z4.boolean().optional(),
|
515
|
-
/**
|
516
|
-
* Optional. Defines labels used in billing reports. Available on Vertex AI only.
|
517
|
-
*
|
518
|
-
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
|
519
|
-
*/
|
520
|
-
labels: z4.record(z4.string(), z4.string()).optional(),
|
521
|
-
/**
|
522
|
-
* Optional. If specified, the media resolution specified will be used.
|
523
|
-
*
|
524
|
-
* https://ai.google.dev/api/generate-content#MediaResolution
|
525
|
-
*/
|
526
|
-
mediaResolution: z4.enum([
|
527
|
-
"MEDIA_RESOLUTION_UNSPECIFIED",
|
528
|
-
"MEDIA_RESOLUTION_LOW",
|
529
|
-
"MEDIA_RESOLUTION_MEDIUM",
|
530
|
-
"MEDIA_RESOLUTION_HIGH"
|
531
|
-
]).optional()
|
532
|
-
});
|
567
|
+
)
|
568
|
+
);
|
533
569
|
|
534
570
|
// src/google-prepare-tools.ts
|
535
571
|
import {
|
@@ -707,64 +743,6 @@ function mapGoogleGenerativeAIFinishReason({
|
|
707
743
|
}
|
708
744
|
}
|
709
745
|
|
710
|
-
// src/tool/google-search.ts
|
711
|
-
import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
|
712
|
-
import * as z5 from "zod/v4";
|
713
|
-
var groundingChunkSchema = z5.object({
|
714
|
-
web: z5.object({ uri: z5.string(), title: z5.string() }).nullish(),
|
715
|
-
retrievedContext: z5.object({ uri: z5.string(), title: z5.string() }).nullish()
|
716
|
-
});
|
717
|
-
var groundingMetadataSchema = z5.object({
|
718
|
-
webSearchQueries: z5.array(z5.string()).nullish(),
|
719
|
-
retrievalQueries: z5.array(z5.string()).nullish(),
|
720
|
-
searchEntryPoint: z5.object({ renderedContent: z5.string() }).nullish(),
|
721
|
-
groundingChunks: z5.array(groundingChunkSchema).nullish(),
|
722
|
-
groundingSupports: z5.array(
|
723
|
-
z5.object({
|
724
|
-
segment: z5.object({
|
725
|
-
startIndex: z5.number().nullish(),
|
726
|
-
endIndex: z5.number().nullish(),
|
727
|
-
text: z5.string().nullish()
|
728
|
-
}),
|
729
|
-
segment_text: z5.string().nullish(),
|
730
|
-
groundingChunkIndices: z5.array(z5.number()).nullish(),
|
731
|
-
supportChunkIndices: z5.array(z5.number()).nullish(),
|
732
|
-
confidenceScores: z5.array(z5.number()).nullish(),
|
733
|
-
confidenceScore: z5.array(z5.number()).nullish()
|
734
|
-
})
|
735
|
-
).nullish(),
|
736
|
-
retrievalMetadata: z5.union([
|
737
|
-
z5.object({
|
738
|
-
webDynamicRetrievalScore: z5.number()
|
739
|
-
}),
|
740
|
-
z5.object({})
|
741
|
-
]).nullish()
|
742
|
-
});
|
743
|
-
var googleSearch = createProviderDefinedToolFactory({
|
744
|
-
id: "google.google_search",
|
745
|
-
name: "google_search",
|
746
|
-
inputSchema: z5.object({
|
747
|
-
mode: z5.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
|
748
|
-
dynamicThreshold: z5.number().default(1)
|
749
|
-
})
|
750
|
-
});
|
751
|
-
|
752
|
-
// src/tool/url-context.ts
|
753
|
-
import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
|
754
|
-
import * as z6 from "zod/v4";
|
755
|
-
var urlMetadataSchema = z6.object({
|
756
|
-
retrievedUrl: z6.string(),
|
757
|
-
urlRetrievalStatus: z6.string()
|
758
|
-
});
|
759
|
-
var urlContextMetadataSchema = z6.object({
|
760
|
-
urlMetadata: z6.array(urlMetadataSchema)
|
761
|
-
});
|
762
|
-
var urlContext = createProviderDefinedToolFactory2({
|
763
|
-
id: "google.url_context",
|
764
|
-
name: "url_context",
|
765
|
-
inputSchema: z6.object({})
|
766
|
-
});
|
767
|
-
|
768
746
|
// src/google-generative-ai-language-model.ts
|
769
747
|
var GoogleGenerativeAILanguageModel = class {
|
770
748
|
constructor(modelId, config) {
|
@@ -1260,103 +1238,183 @@ function extractSources({
|
|
1260
1238
|
title: chunk.web.title
|
1261
1239
|
}));
|
1262
1240
|
}
|
1263
|
-
var
|
1264
|
-
|
1265
|
-
|
1241
|
+
var getGroundingMetadataSchema = () => z5.object({
|
1242
|
+
webSearchQueries: z5.array(z5.string()).nullish(),
|
1243
|
+
retrievalQueries: z5.array(z5.string()).nullish(),
|
1244
|
+
searchEntryPoint: z5.object({ renderedContent: z5.string() }).nullish(),
|
1245
|
+
groundingChunks: z5.array(
|
1246
|
+
z5.object({
|
1247
|
+
web: z5.object({ uri: z5.string(), title: z5.string() }).nullish(),
|
1248
|
+
retrievedContext: z5.object({ uri: z5.string(), title: z5.string() }).nullish()
|
1249
|
+
})
|
1250
|
+
).nullish(),
|
1251
|
+
groundingSupports: z5.array(
|
1252
|
+
z5.object({
|
1253
|
+
segment: z5.object({
|
1254
|
+
startIndex: z5.number().nullish(),
|
1255
|
+
endIndex: z5.number().nullish(),
|
1256
|
+
text: z5.string().nullish()
|
1257
|
+
}),
|
1258
|
+
segment_text: z5.string().nullish(),
|
1259
|
+
groundingChunkIndices: z5.array(z5.number()).nullish(),
|
1260
|
+
supportChunkIndices: z5.array(z5.number()).nullish(),
|
1261
|
+
confidenceScores: z5.array(z5.number()).nullish(),
|
1262
|
+
confidenceScore: z5.array(z5.number()).nullish()
|
1263
|
+
})
|
1264
|
+
).nullish(),
|
1265
|
+
retrievalMetadata: z5.union([
|
1266
|
+
z5.object({
|
1267
|
+
webDynamicRetrievalScore: z5.number()
|
1268
|
+
}),
|
1269
|
+
z5.object({})
|
1270
|
+
]).nullish()
|
1271
|
+
});
|
1272
|
+
var getContentSchema = () => z5.object({
|
1273
|
+
parts: z5.array(
|
1274
|
+
z5.union([
|
1266
1275
|
// note: order matters since text can be fully empty
|
1267
|
-
|
1268
|
-
functionCall:
|
1269
|
-
name:
|
1270
|
-
args:
|
1276
|
+
z5.object({
|
1277
|
+
functionCall: z5.object({
|
1278
|
+
name: z5.string(),
|
1279
|
+
args: z5.unknown()
|
1271
1280
|
}),
|
1272
|
-
thoughtSignature:
|
1281
|
+
thoughtSignature: z5.string().nullish()
|
1273
1282
|
}),
|
1274
|
-
|
1275
|
-
inlineData:
|
1276
|
-
mimeType:
|
1277
|
-
data:
|
1283
|
+
z5.object({
|
1284
|
+
inlineData: z5.object({
|
1285
|
+
mimeType: z5.string(),
|
1286
|
+
data: z5.string()
|
1278
1287
|
})
|
1279
1288
|
}),
|
1280
|
-
|
1281
|
-
executableCode:
|
1282
|
-
language:
|
1283
|
-
code:
|
1289
|
+
z5.object({
|
1290
|
+
executableCode: z5.object({
|
1291
|
+
language: z5.string(),
|
1292
|
+
code: z5.string()
|
1284
1293
|
}).nullish(),
|
1285
|
-
codeExecutionResult:
|
1286
|
-
outcome:
|
1287
|
-
output:
|
1294
|
+
codeExecutionResult: z5.object({
|
1295
|
+
outcome: z5.string(),
|
1296
|
+
output: z5.string()
|
1288
1297
|
}).nullish(),
|
1289
|
-
text:
|
1290
|
-
thought:
|
1291
|
-
thoughtSignature:
|
1298
|
+
text: z5.string().nullish(),
|
1299
|
+
thought: z5.boolean().nullish(),
|
1300
|
+
thoughtSignature: z5.string().nullish()
|
1292
1301
|
})
|
1293
1302
|
])
|
1294
1303
|
).nullish()
|
1295
1304
|
});
|
1296
|
-
var
|
1297
|
-
category:
|
1298
|
-
probability:
|
1299
|
-
probabilityScore:
|
1300
|
-
severity:
|
1301
|
-
severityScore:
|
1302
|
-
blocked:
|
1305
|
+
var getSafetyRatingSchema = () => z5.object({
|
1306
|
+
category: z5.string().nullish(),
|
1307
|
+
probability: z5.string().nullish(),
|
1308
|
+
probabilityScore: z5.number().nullish(),
|
1309
|
+
severity: z5.string().nullish(),
|
1310
|
+
severityScore: z5.number().nullish(),
|
1311
|
+
blocked: z5.boolean().nullish()
|
1303
1312
|
});
|
1304
|
-
var usageSchema =
|
1305
|
-
cachedContentTokenCount:
|
1306
|
-
thoughtsTokenCount:
|
1307
|
-
promptTokenCount:
|
1308
|
-
candidatesTokenCount:
|
1309
|
-
totalTokenCount:
|
1313
|
+
var usageSchema = z5.object({
|
1314
|
+
cachedContentTokenCount: z5.number().nullish(),
|
1315
|
+
thoughtsTokenCount: z5.number().nullish(),
|
1316
|
+
promptTokenCount: z5.number().nullish(),
|
1317
|
+
candidatesTokenCount: z5.number().nullish(),
|
1318
|
+
totalTokenCount: z5.number().nullish()
|
1310
1319
|
});
|
1311
|
-
var
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
safetyRatings: z7.array(safetyRatingSchema).nullish(),
|
1317
|
-
groundingMetadata: groundingMetadataSchema.nullish(),
|
1318
|
-
urlContextMetadata: urlContextMetadataSchema.nullish()
|
1320
|
+
var getUrlContextMetadataSchema = () => z5.object({
|
1321
|
+
urlMetadata: z5.array(
|
1322
|
+
z5.object({
|
1323
|
+
retrievedUrl: z5.string(),
|
1324
|
+
urlRetrievalStatus: z5.string()
|
1319
1325
|
})
|
1320
|
-
)
|
1321
|
-
usageMetadata: usageSchema.nullish(),
|
1322
|
-
promptFeedback: z7.object({
|
1323
|
-
blockReason: z7.string().nullish(),
|
1324
|
-
safetyRatings: z7.array(safetyRatingSchema).nullish()
|
1325
|
-
}).nullish()
|
1326
|
+
)
|
1326
1327
|
});
|
1327
|
-
var
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1328
|
+
var responseSchema = lazySchema5(
|
1329
|
+
() => zodSchema5(
|
1330
|
+
z5.object({
|
1331
|
+
candidates: z5.array(
|
1332
|
+
z5.object({
|
1333
|
+
content: getContentSchema().nullish().or(z5.object({}).strict()),
|
1334
|
+
finishReason: z5.string().nullish(),
|
1335
|
+
safetyRatings: z5.array(getSafetyRatingSchema()).nullish(),
|
1336
|
+
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
1337
|
+
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
1338
|
+
})
|
1339
|
+
),
|
1340
|
+
usageMetadata: usageSchema.nullish(),
|
1341
|
+
promptFeedback: z5.object({
|
1342
|
+
blockReason: z5.string().nullish(),
|
1343
|
+
safetyRatings: z5.array(getSafetyRatingSchema()).nullish()
|
1344
|
+
}).nullish()
|
1335
1345
|
})
|
1336
|
-
)
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1346
|
+
)
|
1347
|
+
);
|
1348
|
+
var chunkSchema = lazySchema5(
|
1349
|
+
() => zodSchema5(
|
1350
|
+
z5.object({
|
1351
|
+
candidates: z5.array(
|
1352
|
+
z5.object({
|
1353
|
+
content: getContentSchema().nullish(),
|
1354
|
+
finishReason: z5.string().nullish(),
|
1355
|
+
safetyRatings: z5.array(getSafetyRatingSchema()).nullish(),
|
1356
|
+
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
1357
|
+
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
1358
|
+
})
|
1359
|
+
).nullish(),
|
1360
|
+
usageMetadata: usageSchema.nullish(),
|
1361
|
+
promptFeedback: z5.object({
|
1362
|
+
blockReason: z5.string().nullish(),
|
1363
|
+
safetyRatings: z5.array(getSafetyRatingSchema()).nullish()
|
1364
|
+
}).nullish()
|
1365
|
+
})
|
1366
|
+
)
|
1367
|
+
);
|
1343
1368
|
|
1344
1369
|
// src/tool/code-execution.ts
|
1345
1370
|
import { createProviderDefinedToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
|
1346
|
-
import * as
|
1371
|
+
import * as z6 from "zod/v4";
|
1347
1372
|
var codeExecution = createProviderDefinedToolFactoryWithOutputSchema({
|
1348
1373
|
id: "google.code_execution",
|
1349
1374
|
name: "code_execution",
|
1350
|
-
inputSchema:
|
1351
|
-
language:
|
1352
|
-
code:
|
1375
|
+
inputSchema: z6.object({
|
1376
|
+
language: z6.string().describe("The programming language of the code."),
|
1377
|
+
code: z6.string().describe("The code to be executed.")
|
1353
1378
|
}),
|
1354
|
-
outputSchema:
|
1355
|
-
outcome:
|
1356
|
-
output:
|
1379
|
+
outputSchema: z6.object({
|
1380
|
+
outcome: z6.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
|
1381
|
+
output: z6.string().describe("The output from the code execution.")
|
1357
1382
|
})
|
1358
1383
|
});
|
1359
1384
|
|
1385
|
+
// src/tool/google-search.ts
|
1386
|
+
import {
|
1387
|
+
createProviderDefinedToolFactory,
|
1388
|
+
lazySchema as lazySchema6,
|
1389
|
+
zodSchema as zodSchema6
|
1390
|
+
} from "@ai-sdk/provider-utils";
|
1391
|
+
import * as z7 from "zod/v4";
|
1392
|
+
var googleSearch = createProviderDefinedToolFactory({
|
1393
|
+
id: "google.google_search",
|
1394
|
+
name: "google_search",
|
1395
|
+
inputSchema: lazySchema6(
|
1396
|
+
() => zodSchema6(
|
1397
|
+
z7.object({
|
1398
|
+
mode: z7.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
|
1399
|
+
dynamicThreshold: z7.number().default(1)
|
1400
|
+
})
|
1401
|
+
)
|
1402
|
+
)
|
1403
|
+
});
|
1404
|
+
|
1405
|
+
// src/tool/url-context.ts
|
1406
|
+
import {
|
1407
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
|
1408
|
+
lazySchema as lazySchema7,
|
1409
|
+
zodSchema as zodSchema7
|
1410
|
+
} from "@ai-sdk/provider-utils";
|
1411
|
+
import * as z8 from "zod/v4";
|
1412
|
+
var urlContext = createProviderDefinedToolFactory2({
|
1413
|
+
id: "google.url_context",
|
1414
|
+
name: "url_context",
|
1415
|
+
inputSchema: lazySchema7(() => zodSchema7(z8.object({})))
|
1416
|
+
});
|
1417
|
+
|
1360
1418
|
// src/google-tools.ts
|
1361
1419
|
var googleTools = {
|
1362
1420
|
/**
|
@@ -1386,9 +1444,11 @@ var googleTools = {
|
|
1386
1444
|
import {
|
1387
1445
|
combineHeaders as combineHeaders3,
|
1388
1446
|
createJsonResponseHandler as createJsonResponseHandler3,
|
1447
|
+
lazySchema as lazySchema8,
|
1389
1448
|
parseProviderOptions as parseProviderOptions3,
|
1390
1449
|
postJsonToApi as postJsonToApi3,
|
1391
|
-
resolve as resolve3
|
1450
|
+
resolve as resolve3,
|
1451
|
+
zodSchema as zodSchema8
|
1392
1452
|
} from "@ai-sdk/provider-utils";
|
1393
1453
|
import * as z9 from "zod/v4";
|
1394
1454
|
var GoogleGenerativeAIImageModel = class {
|
@@ -1482,13 +1542,21 @@ var GoogleGenerativeAIImageModel = class {
|
|
1482
1542
|
};
|
1483
1543
|
}
|
1484
1544
|
};
|
1485
|
-
var googleImageResponseSchema =
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1545
|
+
var googleImageResponseSchema = lazySchema8(
|
1546
|
+
() => zodSchema8(
|
1547
|
+
z9.object({
|
1548
|
+
predictions: z9.array(z9.object({ bytesBase64Encoded: z9.string() })).default([])
|
1549
|
+
})
|
1550
|
+
)
|
1551
|
+
);
|
1552
|
+
var googleImageProviderOptionsSchema = lazySchema8(
|
1553
|
+
() => zodSchema8(
|
1554
|
+
z9.object({
|
1555
|
+
personGeneration: z9.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
1556
|
+
aspectRatio: z9.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish()
|
1557
|
+
})
|
1558
|
+
)
|
1559
|
+
);
|
1492
1560
|
|
1493
1561
|
// src/google-provider.ts
|
1494
1562
|
function createGoogleGenerativeAI(options = {}) {
|