@ai-sdk/google 3.0.0-beta.19 → 3.0.0-beta.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.
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
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
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/internal/index.ts
@@ -39,7 +29,7 @@ module.exports = __toCommonJS(internal_exports);
39
29
 
40
30
  // src/google-generative-ai-language-model.ts
41
31
  var import_provider_utils4 = require("@ai-sdk/provider-utils");
42
- var z3 = __toESM(require("zod/v4"));
32
+ var import_v43 = require("zod/v4");
43
33
 
44
34
  // src/convert-json-schema-to-openapi-schema.ts
45
35
  function convertJSONSchemaToOpenAPISchema(jsonSchema) {
@@ -312,14 +302,14 @@ function getModelPath(modelId) {
312
302
 
313
303
  // src/google-error.ts
314
304
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
315
- var z = __toESM(require("zod/v4"));
305
+ var import_v4 = require("zod/v4");
316
306
  var googleErrorDataSchema = (0, import_provider_utils2.lazySchema)(
317
307
  () => (0, import_provider_utils2.zodSchema)(
318
- z.object({
319
- error: z.object({
320
- code: z.number().nullable(),
321
- message: z.string(),
322
- status: z.string()
308
+ import_v4.z.object({
309
+ error: import_v4.z.object({
310
+ code: import_v4.z.number().nullable(),
311
+ message: import_v4.z.string(),
312
+ status: import_v4.z.string()
323
313
  })
324
314
  })
325
315
  )
@@ -331,21 +321,21 @@ var googleFailedResponseHandler = (0, import_provider_utils2.createJsonErrorResp
331
321
 
332
322
  // src/google-generative-ai-options.ts
333
323
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
334
- var z2 = __toESM(require("zod/v4"));
324
+ var import_v42 = require("zod/v4");
335
325
  var googleGenerativeAIProviderOptions = (0, import_provider_utils3.lazySchema)(
336
326
  () => (0, import_provider_utils3.zodSchema)(
337
- z2.object({
338
- responseModalities: z2.array(z2.enum(["TEXT", "IMAGE"])).optional(),
339
- thinkingConfig: z2.object({
340
- thinkingBudget: z2.number().optional(),
341
- includeThoughts: z2.boolean().optional()
327
+ import_v42.z.object({
328
+ responseModalities: import_v42.z.array(import_v42.z.enum(["TEXT", "IMAGE"])).optional(),
329
+ thinkingConfig: import_v42.z.object({
330
+ thinkingBudget: import_v42.z.number().optional(),
331
+ includeThoughts: import_v42.z.boolean().optional()
342
332
  }).optional(),
343
333
  /**
344
334
  * Optional.
345
335
  * The name of the cached content used as context to serve the prediction.
346
336
  * Format: cachedContents/{cachedContent}
347
337
  */
348
- cachedContent: z2.string().optional(),
338
+ cachedContent: import_v42.z.string().optional(),
349
339
  /**
350
340
  * Optional. Enable structured output. Default is true.
351
341
  *
@@ -354,13 +344,13 @@ var googleGenerativeAIProviderOptions = (0, import_provider_utils3.lazySchema)(
354
344
  * Google Generative AI uses. You can use this to disable
355
345
  * structured outputs if you need to.
356
346
  */
357
- structuredOutputs: z2.boolean().optional(),
347
+ structuredOutputs: import_v42.z.boolean().optional(),
358
348
  /**
359
349
  * Optional. A list of unique safety settings for blocking unsafe content.
360
350
  */
361
- safetySettings: z2.array(
362
- z2.object({
363
- category: z2.enum([
351
+ safetySettings: import_v42.z.array(
352
+ import_v42.z.object({
353
+ category: import_v42.z.enum([
364
354
  "HARM_CATEGORY_UNSPECIFIED",
365
355
  "HARM_CATEGORY_HATE_SPEECH",
366
356
  "HARM_CATEGORY_DANGEROUS_CONTENT",
@@ -368,7 +358,7 @@ var googleGenerativeAIProviderOptions = (0, import_provider_utils3.lazySchema)(
368
358
  "HARM_CATEGORY_SEXUALLY_EXPLICIT",
369
359
  "HARM_CATEGORY_CIVIC_INTEGRITY"
370
360
  ]),
371
- threshold: z2.enum([
361
+ threshold: import_v42.z.enum([
372
362
  "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
373
363
  "BLOCK_LOW_AND_ABOVE",
374
364
  "BLOCK_MEDIUM_AND_ABOVE",
@@ -378,7 +368,7 @@ var googleGenerativeAIProviderOptions = (0, import_provider_utils3.lazySchema)(
378
368
  ])
379
369
  })
380
370
  ).optional(),
381
- threshold: z2.enum([
371
+ threshold: import_v42.z.enum([
382
372
  "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
383
373
  "BLOCK_LOW_AND_ABOVE",
384
374
  "BLOCK_MEDIUM_AND_ABOVE",
@@ -391,19 +381,19 @@ var googleGenerativeAIProviderOptions = (0, import_provider_utils3.lazySchema)(
391
381
  *
392
382
  * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
393
383
  */
394
- audioTimestamp: z2.boolean().optional(),
384
+ audioTimestamp: import_v42.z.boolean().optional(),
395
385
  /**
396
386
  * Optional. Defines labels used in billing reports. Available on Vertex AI only.
397
387
  *
398
388
  * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
399
389
  */
400
- labels: z2.record(z2.string(), z2.string()).optional(),
390
+ labels: import_v42.z.record(import_v42.z.string(), import_v42.z.string()).optional(),
401
391
  /**
402
392
  * Optional. If specified, the media resolution specified will be used.
403
393
  *
404
394
  * https://ai.google.dev/api/generate-content#MediaResolution
405
395
  */
406
- mediaResolution: z2.enum([
396
+ mediaResolution: import_v42.z.enum([
407
397
  "MEDIA_RESOLUTION_UNSPECIFIED",
408
398
  "MEDIA_RESOLUTION_LOW",
409
399
  "MEDIA_RESOLUTION_MEDIUM",
@@ -1082,129 +1072,129 @@ function extractSources({
1082
1072
  title: chunk.web.title
1083
1073
  }));
1084
1074
  }
1085
- var getGroundingMetadataSchema = () => z3.object({
1086
- webSearchQueries: z3.array(z3.string()).nullish(),
1087
- retrievalQueries: z3.array(z3.string()).nullish(),
1088
- searchEntryPoint: z3.object({ renderedContent: z3.string() }).nullish(),
1089
- groundingChunks: z3.array(
1090
- z3.object({
1091
- web: z3.object({ uri: z3.string(), title: z3.string() }).nullish(),
1092
- retrievedContext: z3.object({ uri: z3.string(), title: z3.string() }).nullish()
1075
+ var getGroundingMetadataSchema = () => import_v43.z.object({
1076
+ webSearchQueries: import_v43.z.array(import_v43.z.string()).nullish(),
1077
+ retrievalQueries: import_v43.z.array(import_v43.z.string()).nullish(),
1078
+ searchEntryPoint: import_v43.z.object({ renderedContent: import_v43.z.string() }).nullish(),
1079
+ groundingChunks: import_v43.z.array(
1080
+ import_v43.z.object({
1081
+ web: import_v43.z.object({ uri: import_v43.z.string(), title: import_v43.z.string() }).nullish(),
1082
+ retrievedContext: import_v43.z.object({ uri: import_v43.z.string(), title: import_v43.z.string() }).nullish()
1093
1083
  })
1094
1084
  ).nullish(),
1095
- groundingSupports: z3.array(
1096
- z3.object({
1097
- segment: z3.object({
1098
- startIndex: z3.number().nullish(),
1099
- endIndex: z3.number().nullish(),
1100
- text: z3.string().nullish()
1085
+ groundingSupports: import_v43.z.array(
1086
+ import_v43.z.object({
1087
+ segment: import_v43.z.object({
1088
+ startIndex: import_v43.z.number().nullish(),
1089
+ endIndex: import_v43.z.number().nullish(),
1090
+ text: import_v43.z.string().nullish()
1101
1091
  }),
1102
- segment_text: z3.string().nullish(),
1103
- groundingChunkIndices: z3.array(z3.number()).nullish(),
1104
- supportChunkIndices: z3.array(z3.number()).nullish(),
1105
- confidenceScores: z3.array(z3.number()).nullish(),
1106
- confidenceScore: z3.array(z3.number()).nullish()
1092
+ segment_text: import_v43.z.string().nullish(),
1093
+ groundingChunkIndices: import_v43.z.array(import_v43.z.number()).nullish(),
1094
+ supportChunkIndices: import_v43.z.array(import_v43.z.number()).nullish(),
1095
+ confidenceScores: import_v43.z.array(import_v43.z.number()).nullish(),
1096
+ confidenceScore: import_v43.z.array(import_v43.z.number()).nullish()
1107
1097
  })
1108
1098
  ).nullish(),
1109
- retrievalMetadata: z3.union([
1110
- z3.object({
1111
- webDynamicRetrievalScore: z3.number()
1099
+ retrievalMetadata: import_v43.z.union([
1100
+ import_v43.z.object({
1101
+ webDynamicRetrievalScore: import_v43.z.number()
1112
1102
  }),
1113
- z3.object({})
1103
+ import_v43.z.object({})
1114
1104
  ]).nullish()
1115
1105
  });
1116
- var getContentSchema = () => z3.object({
1117
- parts: z3.array(
1118
- z3.union([
1106
+ var getContentSchema = () => import_v43.z.object({
1107
+ parts: import_v43.z.array(
1108
+ import_v43.z.union([
1119
1109
  // note: order matters since text can be fully empty
1120
- z3.object({
1121
- functionCall: z3.object({
1122
- name: z3.string(),
1123
- args: z3.unknown()
1110
+ import_v43.z.object({
1111
+ functionCall: import_v43.z.object({
1112
+ name: import_v43.z.string(),
1113
+ args: import_v43.z.unknown()
1124
1114
  }),
1125
- thoughtSignature: z3.string().nullish()
1115
+ thoughtSignature: import_v43.z.string().nullish()
1126
1116
  }),
1127
- z3.object({
1128
- inlineData: z3.object({
1129
- mimeType: z3.string(),
1130
- data: z3.string()
1117
+ import_v43.z.object({
1118
+ inlineData: import_v43.z.object({
1119
+ mimeType: import_v43.z.string(),
1120
+ data: import_v43.z.string()
1131
1121
  })
1132
1122
  }),
1133
- z3.object({
1134
- executableCode: z3.object({
1135
- language: z3.string(),
1136
- code: z3.string()
1123
+ import_v43.z.object({
1124
+ executableCode: import_v43.z.object({
1125
+ language: import_v43.z.string(),
1126
+ code: import_v43.z.string()
1137
1127
  }).nullish(),
1138
- codeExecutionResult: z3.object({
1139
- outcome: z3.string(),
1140
- output: z3.string()
1128
+ codeExecutionResult: import_v43.z.object({
1129
+ outcome: import_v43.z.string(),
1130
+ output: import_v43.z.string()
1141
1131
  }).nullish(),
1142
- text: z3.string().nullish(),
1143
- thought: z3.boolean().nullish(),
1144
- thoughtSignature: z3.string().nullish()
1132
+ text: import_v43.z.string().nullish(),
1133
+ thought: import_v43.z.boolean().nullish(),
1134
+ thoughtSignature: import_v43.z.string().nullish()
1145
1135
  })
1146
1136
  ])
1147
1137
  ).nullish()
1148
1138
  });
1149
- var getSafetyRatingSchema = () => z3.object({
1150
- category: z3.string().nullish(),
1151
- probability: z3.string().nullish(),
1152
- probabilityScore: z3.number().nullish(),
1153
- severity: z3.string().nullish(),
1154
- severityScore: z3.number().nullish(),
1155
- blocked: z3.boolean().nullish()
1139
+ var getSafetyRatingSchema = () => import_v43.z.object({
1140
+ category: import_v43.z.string().nullish(),
1141
+ probability: import_v43.z.string().nullish(),
1142
+ probabilityScore: import_v43.z.number().nullish(),
1143
+ severity: import_v43.z.string().nullish(),
1144
+ severityScore: import_v43.z.number().nullish(),
1145
+ blocked: import_v43.z.boolean().nullish()
1156
1146
  });
1157
- var usageSchema = z3.object({
1158
- cachedContentTokenCount: z3.number().nullish(),
1159
- thoughtsTokenCount: z3.number().nullish(),
1160
- promptTokenCount: z3.number().nullish(),
1161
- candidatesTokenCount: z3.number().nullish(),
1162
- totalTokenCount: z3.number().nullish()
1147
+ var usageSchema = import_v43.z.object({
1148
+ cachedContentTokenCount: import_v43.z.number().nullish(),
1149
+ thoughtsTokenCount: import_v43.z.number().nullish(),
1150
+ promptTokenCount: import_v43.z.number().nullish(),
1151
+ candidatesTokenCount: import_v43.z.number().nullish(),
1152
+ totalTokenCount: import_v43.z.number().nullish()
1163
1153
  });
1164
- var getUrlContextMetadataSchema = () => z3.object({
1165
- urlMetadata: z3.array(
1166
- z3.object({
1167
- retrievedUrl: z3.string(),
1168
- urlRetrievalStatus: z3.string()
1154
+ var getUrlContextMetadataSchema = () => import_v43.z.object({
1155
+ urlMetadata: import_v43.z.array(
1156
+ import_v43.z.object({
1157
+ retrievedUrl: import_v43.z.string(),
1158
+ urlRetrievalStatus: import_v43.z.string()
1169
1159
  })
1170
1160
  )
1171
1161
  });
1172
1162
  var responseSchema = (0, import_provider_utils4.lazySchema)(
1173
1163
  () => (0, import_provider_utils4.zodSchema)(
1174
- z3.object({
1175
- candidates: z3.array(
1176
- z3.object({
1177
- content: getContentSchema().nullish().or(z3.object({}).strict()),
1178
- finishReason: z3.string().nullish(),
1179
- safetyRatings: z3.array(getSafetyRatingSchema()).nullish(),
1164
+ import_v43.z.object({
1165
+ candidates: import_v43.z.array(
1166
+ import_v43.z.object({
1167
+ content: getContentSchema().nullish().or(import_v43.z.object({}).strict()),
1168
+ finishReason: import_v43.z.string().nullish(),
1169
+ safetyRatings: import_v43.z.array(getSafetyRatingSchema()).nullish(),
1180
1170
  groundingMetadata: getGroundingMetadataSchema().nullish(),
1181
1171
  urlContextMetadata: getUrlContextMetadataSchema().nullish()
1182
1172
  })
1183
1173
  ),
1184
1174
  usageMetadata: usageSchema.nullish(),
1185
- promptFeedback: z3.object({
1186
- blockReason: z3.string().nullish(),
1187
- safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
1175
+ promptFeedback: import_v43.z.object({
1176
+ blockReason: import_v43.z.string().nullish(),
1177
+ safetyRatings: import_v43.z.array(getSafetyRatingSchema()).nullish()
1188
1178
  }).nullish()
1189
1179
  })
1190
1180
  )
1191
1181
  );
1192
1182
  var chunkSchema = (0, import_provider_utils4.lazySchema)(
1193
1183
  () => (0, import_provider_utils4.zodSchema)(
1194
- z3.object({
1195
- candidates: z3.array(
1196
- z3.object({
1184
+ import_v43.z.object({
1185
+ candidates: import_v43.z.array(
1186
+ import_v43.z.object({
1197
1187
  content: getContentSchema().nullish(),
1198
- finishReason: z3.string().nullish(),
1199
- safetyRatings: z3.array(getSafetyRatingSchema()).nullish(),
1188
+ finishReason: import_v43.z.string().nullish(),
1189
+ safetyRatings: import_v43.z.array(getSafetyRatingSchema()).nullish(),
1200
1190
  groundingMetadata: getGroundingMetadataSchema().nullish(),
1201
1191
  urlContextMetadata: getUrlContextMetadataSchema().nullish()
1202
1192
  })
1203
1193
  ).nullish(),
1204
1194
  usageMetadata: usageSchema.nullish(),
1205
- promptFeedback: z3.object({
1206
- blockReason: z3.string().nullish(),
1207
- safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
1195
+ promptFeedback: import_v43.z.object({
1196
+ blockReason: import_v43.z.string().nullish(),
1197
+ safetyRatings: import_v43.z.array(getSafetyRatingSchema()).nullish()
1208
1198
  }).nullish()
1209
1199
  })
1210
1200
  )
@@ -1212,31 +1202,31 @@ var chunkSchema = (0, import_provider_utils4.lazySchema)(
1212
1202
 
1213
1203
  // src/tool/code-execution.ts
1214
1204
  var import_provider_utils5 = require("@ai-sdk/provider-utils");
1215
- var z4 = __toESM(require("zod/v4"));
1205
+ var import_v44 = require("zod/v4");
1216
1206
  var codeExecution = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
1217
1207
  id: "google.code_execution",
1218
1208
  name: "code_execution",
1219
- inputSchema: z4.object({
1220
- language: z4.string().describe("The programming language of the code."),
1221
- code: z4.string().describe("The code to be executed.")
1209
+ inputSchema: import_v44.z.object({
1210
+ language: import_v44.z.string().describe("The programming language of the code."),
1211
+ code: import_v44.z.string().describe("The code to be executed.")
1222
1212
  }),
1223
- outputSchema: z4.object({
1224
- outcome: z4.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
1225
- output: z4.string().describe("The output from the code execution.")
1213
+ outputSchema: import_v44.z.object({
1214
+ outcome: import_v44.z.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
1215
+ output: import_v44.z.string().describe("The output from the code execution.")
1226
1216
  })
1227
1217
  });
1228
1218
 
1229
1219
  // src/tool/google-search.ts
1230
1220
  var import_provider_utils6 = require("@ai-sdk/provider-utils");
1231
- var z5 = __toESM(require("zod/v4"));
1221
+ var import_v45 = require("zod/v4");
1232
1222
  var googleSearch = (0, import_provider_utils6.createProviderDefinedToolFactory)({
1233
1223
  id: "google.google_search",
1234
1224
  name: "google_search",
1235
1225
  inputSchema: (0, import_provider_utils6.lazySchema)(
1236
1226
  () => (0, import_provider_utils6.zodSchema)(
1237
- z5.object({
1238
- mode: z5.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
1239
- dynamicThreshold: z5.number().default(1)
1227
+ import_v45.z.object({
1228
+ mode: import_v45.z.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
1229
+ dynamicThreshold: import_v45.z.number().default(1)
1240
1230
  })
1241
1231
  )
1242
1232
  )
@@ -1244,11 +1234,11 @@ var googleSearch = (0, import_provider_utils6.createProviderDefinedToolFactory)(
1244
1234
 
1245
1235
  // src/tool/url-context.ts
1246
1236
  var import_provider_utils7 = require("@ai-sdk/provider-utils");
1247
- var z6 = __toESM(require("zod/v4"));
1237
+ var import_v46 = require("zod/v4");
1248
1238
  var urlContext = (0, import_provider_utils7.createProviderDefinedToolFactory)({
1249
1239
  id: "google.url_context",
1250
1240
  name: "url_context",
1251
- inputSchema: (0, import_provider_utils7.lazySchema)(() => (0, import_provider_utils7.zodSchema)(z6.object({})))
1241
+ inputSchema: (0, import_provider_utils7.lazySchema)(() => (0, import_provider_utils7.zodSchema)(import_v46.z.object({})))
1252
1242
  });
1253
1243
 
1254
1244
  // src/google-tools.ts