@ai-sdk/google 2.0.18 → 2.0.20
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 -132
- package/dist/index.d.ts +139 -132
- package/dist/index.js +319 -274
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +324 -245
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +139 -11
- package/dist/internal/index.d.ts +139 -11
- package/dist/internal/index.js +250 -224
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +251 -199
- 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 ? "2.0.
|
10
|
+
var VERSION = true ? "2.0.20" : "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
|
-
import
|
25
|
+
import { z as z3 } from "zod/v4";
|
24
26
|
|
25
27
|
// src/google-error.ts
|
26
|
-
import {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
28
|
+
import {
|
29
|
+
createJsonErrorResponseHandler,
|
30
|
+
lazySchema,
|
31
|
+
zodSchema
|
32
|
+
} from "@ai-sdk/provider-utils";
|
33
|
+
import { z } from "zod/v4";
|
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
|
41
|
-
import
|
42
|
-
|
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
|
-
|
51
|
+
import {
|
52
|
+
lazySchema as lazySchema2,
|
53
|
+
zodSchema as zodSchema2
|
54
|
+
} from "@ai-sdk/provider-utils";
|
55
|
+
import { z as z2 } from "zod/v4";
|
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
|
210
|
+
import { z 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
|
456
|
-
import
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
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(
|
484
|
+
import {
|
485
|
+
lazySchema as lazySchema4,
|
486
|
+
zodSchema as zodSchema4
|
487
|
+
} from "@ai-sdk/provider-utils";
|
488
|
+
import { z as z4 } from "zod/v4";
|
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,30 +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
|
-
});
|
567
|
+
)
|
568
|
+
);
|
522
569
|
|
523
570
|
// src/google-prepare-tools.ts
|
524
571
|
import {
|
@@ -691,64 +738,6 @@ function mapGoogleGenerativeAIFinishReason({
|
|
691
738
|
}
|
692
739
|
}
|
693
740
|
|
694
|
-
// src/tool/google-search.ts
|
695
|
-
import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
|
696
|
-
import * as z5 from "zod/v4";
|
697
|
-
var groundingChunkSchema = z5.object({
|
698
|
-
web: z5.object({ uri: z5.string(), title: z5.string() }).nullish(),
|
699
|
-
retrievedContext: z5.object({ uri: z5.string(), title: z5.string() }).nullish()
|
700
|
-
});
|
701
|
-
var groundingMetadataSchema = z5.object({
|
702
|
-
webSearchQueries: z5.array(z5.string()).nullish(),
|
703
|
-
retrievalQueries: z5.array(z5.string()).nullish(),
|
704
|
-
searchEntryPoint: z5.object({ renderedContent: z5.string() }).nullish(),
|
705
|
-
groundingChunks: z5.array(groundingChunkSchema).nullish(),
|
706
|
-
groundingSupports: z5.array(
|
707
|
-
z5.object({
|
708
|
-
segment: z5.object({
|
709
|
-
startIndex: z5.number().nullish(),
|
710
|
-
endIndex: z5.number().nullish(),
|
711
|
-
text: z5.string().nullish()
|
712
|
-
}),
|
713
|
-
segment_text: z5.string().nullish(),
|
714
|
-
groundingChunkIndices: z5.array(z5.number()).nullish(),
|
715
|
-
supportChunkIndices: z5.array(z5.number()).nullish(),
|
716
|
-
confidenceScores: z5.array(z5.number()).nullish(),
|
717
|
-
confidenceScore: z5.array(z5.number()).nullish()
|
718
|
-
})
|
719
|
-
).nullish(),
|
720
|
-
retrievalMetadata: z5.union([
|
721
|
-
z5.object({
|
722
|
-
webDynamicRetrievalScore: z5.number()
|
723
|
-
}),
|
724
|
-
z5.object({})
|
725
|
-
]).nullish()
|
726
|
-
});
|
727
|
-
var googleSearch = createProviderDefinedToolFactory({
|
728
|
-
id: "google.google_search",
|
729
|
-
name: "google_search",
|
730
|
-
inputSchema: z5.object({
|
731
|
-
mode: z5.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
|
732
|
-
dynamicThreshold: z5.number().default(1)
|
733
|
-
})
|
734
|
-
});
|
735
|
-
|
736
|
-
// src/tool/url-context.ts
|
737
|
-
import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
|
738
|
-
import * as z6 from "zod/v4";
|
739
|
-
var urlMetadataSchema = z6.object({
|
740
|
-
retrievedUrl: z6.string(),
|
741
|
-
urlRetrievalStatus: z6.string()
|
742
|
-
});
|
743
|
-
var urlContextMetadataSchema = z6.object({
|
744
|
-
urlMetadata: z6.array(urlMetadataSchema)
|
745
|
-
});
|
746
|
-
var urlContext = createProviderDefinedToolFactory2({
|
747
|
-
id: "google.url_context",
|
748
|
-
name: "url_context",
|
749
|
-
inputSchema: z6.object({})
|
750
|
-
});
|
751
|
-
|
752
741
|
// src/google-generative-ai-language-model.ts
|
753
742
|
var GoogleGenerativeAILanguageModel = class {
|
754
743
|
constructor(modelId, config) {
|
@@ -1241,103 +1230,183 @@ function extractSources({
|
|
1241
1230
|
title: chunk.web.title
|
1242
1231
|
}));
|
1243
1232
|
}
|
1244
|
-
var
|
1245
|
-
|
1246
|
-
|
1233
|
+
var getGroundingMetadataSchema = () => z5.object({
|
1234
|
+
webSearchQueries: z5.array(z5.string()).nullish(),
|
1235
|
+
retrievalQueries: z5.array(z5.string()).nullish(),
|
1236
|
+
searchEntryPoint: z5.object({ renderedContent: z5.string() }).nullish(),
|
1237
|
+
groundingChunks: z5.array(
|
1238
|
+
z5.object({
|
1239
|
+
web: z5.object({ uri: z5.string(), title: z5.string() }).nullish(),
|
1240
|
+
retrievedContext: z5.object({ uri: z5.string(), title: z5.string() }).nullish()
|
1241
|
+
})
|
1242
|
+
).nullish(),
|
1243
|
+
groundingSupports: z5.array(
|
1244
|
+
z5.object({
|
1245
|
+
segment: z5.object({
|
1246
|
+
startIndex: z5.number().nullish(),
|
1247
|
+
endIndex: z5.number().nullish(),
|
1248
|
+
text: z5.string().nullish()
|
1249
|
+
}),
|
1250
|
+
segment_text: z5.string().nullish(),
|
1251
|
+
groundingChunkIndices: z5.array(z5.number()).nullish(),
|
1252
|
+
supportChunkIndices: z5.array(z5.number()).nullish(),
|
1253
|
+
confidenceScores: z5.array(z5.number()).nullish(),
|
1254
|
+
confidenceScore: z5.array(z5.number()).nullish()
|
1255
|
+
})
|
1256
|
+
).nullish(),
|
1257
|
+
retrievalMetadata: z5.union([
|
1258
|
+
z5.object({
|
1259
|
+
webDynamicRetrievalScore: z5.number()
|
1260
|
+
}),
|
1261
|
+
z5.object({})
|
1262
|
+
]).nullish()
|
1263
|
+
});
|
1264
|
+
var getContentSchema = () => z5.object({
|
1265
|
+
parts: z5.array(
|
1266
|
+
z5.union([
|
1247
1267
|
// note: order matters since text can be fully empty
|
1248
|
-
|
1249
|
-
functionCall:
|
1250
|
-
name:
|
1251
|
-
args:
|
1268
|
+
z5.object({
|
1269
|
+
functionCall: z5.object({
|
1270
|
+
name: z5.string(),
|
1271
|
+
args: z5.unknown()
|
1252
1272
|
}),
|
1253
|
-
thoughtSignature:
|
1273
|
+
thoughtSignature: z5.string().nullish()
|
1254
1274
|
}),
|
1255
|
-
|
1256
|
-
inlineData:
|
1257
|
-
mimeType:
|
1258
|
-
data:
|
1275
|
+
z5.object({
|
1276
|
+
inlineData: z5.object({
|
1277
|
+
mimeType: z5.string(),
|
1278
|
+
data: z5.string()
|
1259
1279
|
})
|
1260
1280
|
}),
|
1261
|
-
|
1262
|
-
executableCode:
|
1263
|
-
language:
|
1264
|
-
code:
|
1281
|
+
z5.object({
|
1282
|
+
executableCode: z5.object({
|
1283
|
+
language: z5.string(),
|
1284
|
+
code: z5.string()
|
1265
1285
|
}).nullish(),
|
1266
|
-
codeExecutionResult:
|
1267
|
-
outcome:
|
1268
|
-
output:
|
1286
|
+
codeExecutionResult: z5.object({
|
1287
|
+
outcome: z5.string(),
|
1288
|
+
output: z5.string()
|
1269
1289
|
}).nullish(),
|
1270
|
-
text:
|
1271
|
-
thought:
|
1272
|
-
thoughtSignature:
|
1290
|
+
text: z5.string().nullish(),
|
1291
|
+
thought: z5.boolean().nullish(),
|
1292
|
+
thoughtSignature: z5.string().nullish()
|
1273
1293
|
})
|
1274
1294
|
])
|
1275
1295
|
).nullish()
|
1276
1296
|
});
|
1277
|
-
var
|
1278
|
-
category:
|
1279
|
-
probability:
|
1280
|
-
probabilityScore:
|
1281
|
-
severity:
|
1282
|
-
severityScore:
|
1283
|
-
blocked:
|
1297
|
+
var getSafetyRatingSchema = () => z5.object({
|
1298
|
+
category: z5.string().nullish(),
|
1299
|
+
probability: z5.string().nullish(),
|
1300
|
+
probabilityScore: z5.number().nullish(),
|
1301
|
+
severity: z5.string().nullish(),
|
1302
|
+
severityScore: z5.number().nullish(),
|
1303
|
+
blocked: z5.boolean().nullish()
|
1284
1304
|
});
|
1285
|
-
var usageSchema =
|
1286
|
-
cachedContentTokenCount:
|
1287
|
-
thoughtsTokenCount:
|
1288
|
-
promptTokenCount:
|
1289
|
-
candidatesTokenCount:
|
1290
|
-
totalTokenCount:
|
1305
|
+
var usageSchema = z5.object({
|
1306
|
+
cachedContentTokenCount: z5.number().nullish(),
|
1307
|
+
thoughtsTokenCount: z5.number().nullish(),
|
1308
|
+
promptTokenCount: z5.number().nullish(),
|
1309
|
+
candidatesTokenCount: z5.number().nullish(),
|
1310
|
+
totalTokenCount: z5.number().nullish()
|
1291
1311
|
});
|
1292
|
-
var
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
safetyRatings: z7.array(safetyRatingSchema).nullish(),
|
1298
|
-
groundingMetadata: groundingMetadataSchema.nullish(),
|
1299
|
-
urlContextMetadata: urlContextMetadataSchema.nullish()
|
1312
|
+
var getUrlContextMetadataSchema = () => z5.object({
|
1313
|
+
urlMetadata: z5.array(
|
1314
|
+
z5.object({
|
1315
|
+
retrievedUrl: z5.string(),
|
1316
|
+
urlRetrievalStatus: z5.string()
|
1300
1317
|
})
|
1301
|
-
)
|
1302
|
-
usageMetadata: usageSchema.nullish(),
|
1303
|
-
promptFeedback: z7.object({
|
1304
|
-
blockReason: z7.string().nullish(),
|
1305
|
-
safetyRatings: z7.array(safetyRatingSchema).nullish()
|
1306
|
-
}).nullish()
|
1318
|
+
)
|
1307
1319
|
});
|
1308
|
-
var
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1320
|
+
var responseSchema = lazySchema5(
|
1321
|
+
() => zodSchema5(
|
1322
|
+
z5.object({
|
1323
|
+
candidates: z5.array(
|
1324
|
+
z5.object({
|
1325
|
+
content: getContentSchema().nullish().or(z5.object({}).strict()),
|
1326
|
+
finishReason: z5.string().nullish(),
|
1327
|
+
safetyRatings: z5.array(getSafetyRatingSchema()).nullish(),
|
1328
|
+
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
1329
|
+
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
1330
|
+
})
|
1331
|
+
),
|
1332
|
+
usageMetadata: usageSchema.nullish(),
|
1333
|
+
promptFeedback: z5.object({
|
1334
|
+
blockReason: z5.string().nullish(),
|
1335
|
+
safetyRatings: z5.array(getSafetyRatingSchema()).nullish()
|
1336
|
+
}).nullish()
|
1316
1337
|
})
|
1317
|
-
)
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1338
|
+
)
|
1339
|
+
);
|
1340
|
+
var chunkSchema = lazySchema5(
|
1341
|
+
() => zodSchema5(
|
1342
|
+
z5.object({
|
1343
|
+
candidates: z5.array(
|
1344
|
+
z5.object({
|
1345
|
+
content: getContentSchema().nullish(),
|
1346
|
+
finishReason: z5.string().nullish(),
|
1347
|
+
safetyRatings: z5.array(getSafetyRatingSchema()).nullish(),
|
1348
|
+
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
1349
|
+
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
1350
|
+
})
|
1351
|
+
).nullish(),
|
1352
|
+
usageMetadata: usageSchema.nullish(),
|
1353
|
+
promptFeedback: z5.object({
|
1354
|
+
blockReason: z5.string().nullish(),
|
1355
|
+
safetyRatings: z5.array(getSafetyRatingSchema()).nullish()
|
1356
|
+
}).nullish()
|
1357
|
+
})
|
1358
|
+
)
|
1359
|
+
);
|
1324
1360
|
|
1325
1361
|
// src/tool/code-execution.ts
|
1326
1362
|
import { createProviderDefinedToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
|
1327
|
-
import
|
1363
|
+
import { z as z6 } from "zod/v4";
|
1328
1364
|
var codeExecution = createProviderDefinedToolFactoryWithOutputSchema({
|
1329
1365
|
id: "google.code_execution",
|
1330
1366
|
name: "code_execution",
|
1331
|
-
inputSchema:
|
1332
|
-
language:
|
1333
|
-
code:
|
1367
|
+
inputSchema: z6.object({
|
1368
|
+
language: z6.string().describe("The programming language of the code."),
|
1369
|
+
code: z6.string().describe("The code to be executed.")
|
1334
1370
|
}),
|
1335
|
-
outputSchema:
|
1336
|
-
outcome:
|
1337
|
-
output:
|
1371
|
+
outputSchema: z6.object({
|
1372
|
+
outcome: z6.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
|
1373
|
+
output: z6.string().describe("The output from the code execution.")
|
1338
1374
|
})
|
1339
1375
|
});
|
1340
1376
|
|
1377
|
+
// src/tool/google-search.ts
|
1378
|
+
import {
|
1379
|
+
createProviderDefinedToolFactory,
|
1380
|
+
lazySchema as lazySchema6,
|
1381
|
+
zodSchema as zodSchema6
|
1382
|
+
} from "@ai-sdk/provider-utils";
|
1383
|
+
import { z as z7 } from "zod/v4";
|
1384
|
+
var googleSearch = createProviderDefinedToolFactory({
|
1385
|
+
id: "google.google_search",
|
1386
|
+
name: "google_search",
|
1387
|
+
inputSchema: lazySchema6(
|
1388
|
+
() => zodSchema6(
|
1389
|
+
z7.object({
|
1390
|
+
mode: z7.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
|
1391
|
+
dynamicThreshold: z7.number().default(1)
|
1392
|
+
})
|
1393
|
+
)
|
1394
|
+
)
|
1395
|
+
});
|
1396
|
+
|
1397
|
+
// src/tool/url-context.ts
|
1398
|
+
import {
|
1399
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
|
1400
|
+
lazySchema as lazySchema7,
|
1401
|
+
zodSchema as zodSchema7
|
1402
|
+
} from "@ai-sdk/provider-utils";
|
1403
|
+
import { z as z8 } from "zod/v4";
|
1404
|
+
var urlContext = createProviderDefinedToolFactory2({
|
1405
|
+
id: "google.url_context",
|
1406
|
+
name: "url_context",
|
1407
|
+
inputSchema: lazySchema7(() => zodSchema7(z8.object({})))
|
1408
|
+
});
|
1409
|
+
|
1341
1410
|
// src/google-tools.ts
|
1342
1411
|
var googleTools = {
|
1343
1412
|
/**
|
@@ -1367,11 +1436,13 @@ var googleTools = {
|
|
1367
1436
|
import {
|
1368
1437
|
combineHeaders as combineHeaders3,
|
1369
1438
|
createJsonResponseHandler as createJsonResponseHandler3,
|
1439
|
+
lazySchema as lazySchema8,
|
1370
1440
|
parseProviderOptions as parseProviderOptions3,
|
1371
1441
|
postJsonToApi as postJsonToApi3,
|
1372
|
-
resolve as resolve3
|
1442
|
+
resolve as resolve3,
|
1443
|
+
zodSchema as zodSchema8
|
1373
1444
|
} from "@ai-sdk/provider-utils";
|
1374
|
-
import
|
1445
|
+
import { z as z9 } from "zod/v4";
|
1375
1446
|
var GoogleGenerativeAIImageModel = class {
|
1376
1447
|
constructor(modelId, settings, config) {
|
1377
1448
|
this.modelId = modelId;
|
@@ -1463,13 +1534,21 @@ var GoogleGenerativeAIImageModel = class {
|
|
1463
1534
|
};
|
1464
1535
|
}
|
1465
1536
|
};
|
1466
|
-
var googleImageResponseSchema =
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1537
|
+
var googleImageResponseSchema = lazySchema8(
|
1538
|
+
() => zodSchema8(
|
1539
|
+
z9.object({
|
1540
|
+
predictions: z9.array(z9.object({ bytesBase64Encoded: z9.string() })).default([])
|
1541
|
+
})
|
1542
|
+
)
|
1543
|
+
);
|
1544
|
+
var googleImageProviderOptionsSchema = lazySchema8(
|
1545
|
+
() => zodSchema8(
|
1546
|
+
z9.object({
|
1547
|
+
personGeneration: z9.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
1548
|
+
aspectRatio: z9.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish()
|
1549
|
+
})
|
1550
|
+
)
|
1551
|
+
);
|
1473
1552
|
|
1474
1553
|
// src/google-provider.ts
|
1475
1554
|
function createGoogleGenerativeAI(options = {}) {
|