@ai-sdk/google 4.0.66 → 4.0.68

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/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  } from "@ai-sdk/provider-utils";
8
8
 
9
9
  // src/version.ts
10
- var VERSION = true ? "4.0.66" : "0.0.0-test";
10
+ var VERSION = true ? "4.0.68" : "0.0.0-test";
11
11
 
12
12
  // src/google-embedding-model.ts
13
13
  import {
@@ -254,7 +254,8 @@ var googleGenerativeAISingleEmbeddingResponseSchema = lazySchema3(
254
254
  // src/google-batch.ts
255
255
  import {
256
256
  InvalidArgumentError,
257
- InvalidResponseDataError
257
+ InvalidResponseDataError,
258
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError4
258
259
  } from "@ai-sdk/provider";
259
260
  import {
260
261
  combineHeaders as combineHeaders3,
@@ -263,15 +264,17 @@ import {
263
264
  createJsonResponseHandler as createJsonResponseHandler3,
264
265
  generateId as generateId2,
265
266
  getFromApi,
266
- lazySchema as lazySchema6,
267
+ lazySchema as lazySchema8,
267
268
  normalizeBatchRequestCounts,
269
+ parseProviderOptions as parseProviderOptions3,
268
270
  postJsonToApi as postJsonToApi3,
269
271
  postToApi,
270
272
  resolve as resolve3,
271
273
  safeValidateTypes,
272
- zodSchema as zodSchema6
274
+ zodSchema as zodSchema8,
275
+ convertToBase64 as convertToBase642
273
276
  } from "@ai-sdk/provider-utils";
274
- import { z as z6 } from "zod/v4";
277
+ import { z as z8 } from "zod/v4";
275
278
 
276
279
  // src/get-model-path.ts
277
280
  function getModelPath(modelId) {
@@ -3066,76 +3069,142 @@ var chunkSchema = lazySchema5(
3066
3069
  )
3067
3070
  );
3068
3071
 
3072
+ // src/google-image-model-options.ts
3073
+ import { lazySchema as lazySchema7, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
3074
+ import { z as z7 } from "zod/v4";
3075
+
3076
+ // src/tool/google-search.ts
3077
+ import {
3078
+ createProviderExecutedToolFactory,
3079
+ lazySchema as lazySchema6,
3080
+ zodSchema as zodSchema6
3081
+ } from "@ai-sdk/provider-utils";
3082
+ import { z as z6 } from "zod/v4";
3083
+ var googleSearchToolArgsBaseSchema = z6.looseObject({
3084
+ searchTypes: z6.object({
3085
+ webSearch: z6.object({}).optional(),
3086
+ imageSearch: z6.object({}).optional()
3087
+ }).optional(),
3088
+ timeRangeFilter: z6.object({
3089
+ startTime: z6.string(),
3090
+ endTime: z6.string()
3091
+ }).optional()
3092
+ });
3093
+ var googleSearch = createProviderExecutedToolFactory({
3094
+ id: "google.google_search",
3095
+ inputSchema: lazySchema6(() => zodSchema6(z6.object({}))),
3096
+ outputSchema: lazySchema6(() => zodSchema6(z6.object({})))
3097
+ });
3098
+
3099
+ // src/google-image-model-options.ts
3100
+ var googleImageModelOptionsSchema = lazySchema7(
3101
+ () => zodSchema7(
3102
+ z7.object({
3103
+ /**
3104
+ * Enable Google Search grounding for Gemini image models. The value is
3105
+ * forwarded as the args of the `google.tools.googleSearch` provider
3106
+ * tool on the underlying language-model call. Pass `{}` for defaults.
3107
+ *
3108
+ * `generateImage` does not accept a `tools` parameter, so this is the
3109
+ * dedicated escape hatch for grounding image generation the same way
3110
+ * `generateText` does.
3111
+ */
3112
+ googleSearch: googleSearchToolArgsBaseSchema.optional()
3113
+ })
3114
+ )
3115
+ );
3116
+
3069
3117
  // src/google-batch.ts
3070
3118
  var googleBatchInputFileMaxBytes = 2 * 1024 * 1024 * 1024;
3071
3119
  var googleBatchInlineCreationMaxBytes = 2e7;
3072
3120
  var supportedGoogleBatchContentTypes = /* @__PURE__ */ new Set(["text", "reasoning", "source", "tool-call", "tool-result"]);
3073
- var googleRpcStatusSchema = z6.object({
3074
- code: z6.union([z6.number(), z6.string()]).nullish(),
3075
- message: z6.string().nullish(),
3076
- status: z6.string().nullish()
3121
+ function assertSupportedBatchRequests(requests) {
3122
+ for (const request of requests) {
3123
+ const requestType = request.type;
3124
+ if (requestType !== "text" && requestType !== "image") {
3125
+ throw new UnsupportedFunctionalityError4({
3126
+ functionality: `batch request type: ${requestType}`,
3127
+ message: `The Google Batch API does not support batch requests with type "${requestType}".`
3128
+ });
3129
+ }
3130
+ }
3131
+ }
3132
+ var googleRpcStatusSchema = z8.object({
3133
+ code: z8.union([z8.number(), z8.string()]).nullish(),
3134
+ message: z8.string().nullish(),
3135
+ status: z8.string().nullish()
3077
3136
  });
3078
- var googleBatchStatsSchema = z6.object({
3079
- requestCount: z6.union([z6.string(), z6.number()]).nullish(),
3080
- successfulRequestCount: z6.union([z6.string(), z6.number()]).nullish(),
3081
- failedRequestCount: z6.union([z6.string(), z6.number()]).nullish(),
3082
- pendingRequestCount: z6.union([z6.string(), z6.number()]).nullish()
3137
+ var googleBatchStatsSchema = z8.object({
3138
+ requestCount: z8.union([z8.string(), z8.number()]).nullish(),
3139
+ successfulRequestCount: z8.union([z8.string(), z8.number()]).nullish(),
3140
+ failedRequestCount: z8.union([z8.string(), z8.number()]).nullish(),
3141
+ pendingRequestCount: z8.union([z8.string(), z8.number()]).nullish()
3083
3142
  });
3084
- var googleBatchOutputSchema = z6.object({
3085
- responsesFile: z6.string().nullish(),
3086
- inlinedResponses: z6.object({
3087
- inlinedResponses: z6.array(
3088
- z6.object({
3089
- metadata: z6.object({
3090
- key: z6.string()
3143
+ var googleBatchOutputSchema = z8.object({
3144
+ responsesFile: z8.string().nullish(),
3145
+ inlinedResponses: z8.object({
3146
+ inlinedResponses: z8.array(
3147
+ z8.object({
3148
+ metadata: z8.object({
3149
+ key: z8.string()
3091
3150
  }),
3092
- response: z6.unknown().nullish(),
3151
+ response: z8.unknown().nullish(),
3093
3152
  error: googleRpcStatusSchema.nullish()
3094
3153
  })
3095
3154
  )
3096
3155
  }).nullish()
3097
3156
  });
3098
- var googleBatchOperationSchema = lazySchema6(
3099
- () => zodSchema6(
3100
- z6.object({
3101
- name: z6.string(),
3102
- metadata: z6.object({
3103
- state: z6.string().nullish(),
3104
- createTime: z6.string().nullish(),
3105
- batchStats: googleBatchStatsSchema.nullish(),
3106
- output: googleBatchOutputSchema.nullish()
3107
- }).nullish(),
3108
- done: z6.boolean().nullish(),
3109
- error: googleRpcStatusSchema.nullish(),
3110
- response: googleBatchOutputSchema.nullish()
3157
+ var googleBatchOperationZodSchema = () => z8.object({
3158
+ name: z8.string(),
3159
+ metadata: z8.object({
3160
+ state: z8.string().nullish(),
3161
+ createTime: z8.string().nullish(),
3162
+ batchStats: googleBatchStatsSchema.nullish(),
3163
+ output: googleBatchOutputSchema.nullish()
3164
+ }).nullish(),
3165
+ done: z8.boolean().nullish(),
3166
+ error: googleRpcStatusSchema.nullish(),
3167
+ response: googleBatchOutputSchema.nullish()
3168
+ });
3169
+ var googleBatchOperationSchema = lazySchema8(
3170
+ () => zodSchema8(googleBatchOperationZodSchema())
3171
+ );
3172
+ var googleBatchListResponseSchema = lazySchema8(
3173
+ () => zodSchema8(
3174
+ z8.object({
3175
+ operations: z8.array(googleBatchOperationZodSchema()).nullish(),
3176
+ nextPageToken: z8.string().nullish()
3111
3177
  })
3112
3178
  )
3113
3179
  );
3114
- var googleFileUploadResponseSchema = lazySchema6(
3115
- () => zodSchema6(
3116
- z6.object({
3117
- file: z6.object({
3118
- name: z6.string(),
3119
- expirationTime: z6.string().nullish()
3180
+ var googleBatchCancelResponseSchema = lazySchema8(
3181
+ () => zodSchema8(z8.object({}))
3182
+ );
3183
+ var googleFileUploadResponseSchema = lazySchema8(
3184
+ () => zodSchema8(
3185
+ z8.object({
3186
+ file: z8.object({
3187
+ name: z8.string(),
3188
+ expirationTime: z8.string().nullish()
3120
3189
  })
3121
3190
  })
3122
3191
  )
3123
3192
  );
3124
- var googleBatchResultLineSchema = lazySchema6(
3125
- () => zodSchema6(
3126
- z6.object({
3127
- key: z6.string(),
3128
- response: z6.unknown().nullish(),
3193
+ var googleBatchResultLineSchema = lazySchema8(
3194
+ () => zodSchema8(
3195
+ z8.object({
3196
+ key: z8.string(),
3197
+ response: z8.unknown().nullish(),
3129
3198
  error: googleRpcStatusSchema.nullish()
3130
3199
  })
3131
3200
  )
3132
3201
  );
3133
- var googleBatchResponsePreviewSchema = lazySchema6(
3134
- () => zodSchema6(
3135
- z6.object({
3136
- candidates: z6.array(z6.unknown()).nullish(),
3137
- promptFeedback: z6.object({
3138
- blockReason: z6.string().nullish()
3202
+ var googleBatchResponsePreviewSchema = lazySchema8(
3203
+ () => zodSchema8(
3204
+ z8.object({
3205
+ candidates: z8.array(z8.unknown()).nullish(),
3206
+ promptFeedback: z8.object({
3207
+ blockReason: z8.string().nullish()
3139
3208
  }).nullish()
3140
3209
  })
3141
3210
  )
@@ -3150,6 +3219,7 @@ var GoogleBatch = class {
3150
3219
  this.batchGenerateId = (_a = options.config.generateId) != null ? _a : generateId2;
3151
3220
  }
3152
3221
  async doStartBatch(options) {
3222
+ assertSupportedBatchRequests(options.requests);
3153
3223
  const modelId = getGoogleBatchModelId(options.requests);
3154
3224
  const warnings = [];
3155
3225
  const displayName = `ai-sdk-batch-${this.batchGenerateId()}`;
@@ -3171,11 +3241,11 @@ var GoogleBatch = class {
3171
3241
  ).byteLength;
3172
3242
  let fileParts;
3173
3243
  for (const request of options.requests) {
3174
- const preparedRequest = await GoogleLanguageModel.prepareRequest({
3244
+ const preparedRequest = request.type === "text" ? await GoogleLanguageModel.prepareRequest({
3175
3245
  modelId: request.modelId,
3176
3246
  config: this.batchConfig,
3177
3247
  options: request.options
3178
- });
3248
+ }) : await this.prepareImageRequest(request);
3179
3249
  const inlinedRequest = {
3180
3250
  request: preparedRequest.args,
3181
3251
  metadata: { key: request.id }
@@ -3326,6 +3396,48 @@ var GoogleBatch = class {
3326
3396
  async doGetBatchStatus(options) {
3327
3397
  return convertGoogleBatchStatus(await this.retrieveBatch(options));
3328
3398
  }
3399
+ async doCancelBatch(options) {
3400
+ await postJsonToApi3({
3401
+ url: `${this.batchConfig.baseURL}/${options.batchId}:cancel`,
3402
+ headers: await this.getHeaders(options.headers),
3403
+ body: {},
3404
+ failedResponseHandler: googleFailedResponseHandler,
3405
+ successfulResponseHandler: createJsonResponseHandler3(
3406
+ googleBatchCancelResponseSchema
3407
+ ),
3408
+ abortSignal: options.abortSignal,
3409
+ fetch: this.batchConfig.fetch
3410
+ });
3411
+ return {};
3412
+ }
3413
+ async doListBatches(options) {
3414
+ var _a;
3415
+ const url = new URL(`${this.batchConfig.baseURL}/batches`);
3416
+ if (options.limit != null) {
3417
+ url.searchParams.set("pageSize", String(options.limit));
3418
+ }
3419
+ if (options.cursor != null) {
3420
+ url.searchParams.set("pageToken", options.cursor);
3421
+ }
3422
+ const { value: page } = await getFromApi({
3423
+ url: url.toString(),
3424
+ headers: await this.getHeaders(options.headers),
3425
+ failedResponseHandler: googleFailedResponseHandler,
3426
+ successfulResponseHandler: createJsonResponseHandler3(
3427
+ googleBatchListResponseSchema
3428
+ ),
3429
+ abortSignal: options.abortSignal,
3430
+ fetch: this.batchConfig.fetch,
3431
+ validateUrl: false
3432
+ });
3433
+ return {
3434
+ batches: ((_a = page.operations) != null ? _a : []).map((operation) => ({
3435
+ batchId: operation.name,
3436
+ ...convertGoogleBatchStatus(operation)
3437
+ })),
3438
+ ...page.nextPageToken != null ? { nextCursor: page.nextPageToken } : {}
3439
+ };
3440
+ }
3329
3441
  async doGetBatchResults(options) {
3330
3442
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
3331
3443
  const operation = await this.retrieveBatch(options);
@@ -3466,6 +3578,16 @@ var GoogleBatch = class {
3466
3578
  warnings: [],
3467
3579
  providerOptionsNames: ["google"]
3468
3580
  });
3581
+ const imageResult = convertGoogleImageBatchResult(result);
3582
+ if (imageResult != null) {
3583
+ yield {
3584
+ type: "image",
3585
+ id: line.key,
3586
+ status: "succeeded",
3587
+ result: imageResult
3588
+ };
3589
+ continue;
3590
+ }
3469
3591
  const unsupportedPart = result.content.find(
3470
3592
  (part) => !supportedGoogleBatchContentTypes.has(part.type)
3471
3593
  );
@@ -3484,6 +3606,91 @@ var GoogleBatch = class {
3484
3606
  yield { type: "text", id: line.key, status: "succeeded", result };
3485
3607
  }
3486
3608
  }
3609
+ async prepareImageRequest(request) {
3610
+ var _a;
3611
+ const { prompt, n, size, aspectRatio, seed, files, mask, providerOptions } = request.options;
3612
+ const warnings = [];
3613
+ if (mask != null) {
3614
+ throw new UnsupportedFunctionalityError4({
3615
+ functionality: "mask-based image editing in Google batches"
3616
+ });
3617
+ }
3618
+ if (n > 1) {
3619
+ throw new UnsupportedFunctionalityError4({
3620
+ functionality: "multiple images per Google batch request"
3621
+ });
3622
+ }
3623
+ if (size != null) {
3624
+ warnings.push({
3625
+ type: "unsupported",
3626
+ feature: "size",
3627
+ details: "This model does not support the `size` option. Use `aspectRatio` instead."
3628
+ });
3629
+ }
3630
+ const userContent = [];
3631
+ if (prompt != null) userContent.push({ type: "text", text: prompt });
3632
+ for (const file of files != null ? files : []) {
3633
+ userContent.push(
3634
+ file.type === "url" ? {
3635
+ type: "file",
3636
+ data: { type: "url", url: new URL(file.url) },
3637
+ mediaType: "image/*"
3638
+ } : {
3639
+ type: "file",
3640
+ data: { type: "data", data: file.data },
3641
+ mediaType: file.mediaType
3642
+ }
3643
+ );
3644
+ }
3645
+ const googleImageOptions = await parseProviderOptions3({
3646
+ provider: "google",
3647
+ providerOptions,
3648
+ schema: googleImageModelOptionsSchema
3649
+ });
3650
+ const {
3651
+ responseModalities: _responseModalities,
3652
+ imageConfig: userImageConfig,
3653
+ ...passthroughGoogleOptions
3654
+ } = (_a = await parseProviderOptions3({
3655
+ provider: "google",
3656
+ providerOptions,
3657
+ schema: googleLanguageModelOptions
3658
+ })) != null ? _a : {};
3659
+ const preparedGoogleOptions = await parseProviderOptions3({
3660
+ provider: "google",
3661
+ providerOptions: {
3662
+ google: {
3663
+ ...passthroughGoogleOptions,
3664
+ responseModalities: ["IMAGE"],
3665
+ imageConfig: aspectRatio != null || userImageConfig != null ? {
3666
+ ...userImageConfig,
3667
+ ...aspectRatio != null ? { aspectRatio } : {}
3668
+ } : void 0
3669
+ }
3670
+ },
3671
+ schema: googleLanguageModelOptions
3672
+ });
3673
+ const prepared = await GoogleLanguageModel.prepareRequest({
3674
+ modelId: request.modelId,
3675
+ config: this.batchConfig,
3676
+ options: {
3677
+ prompt: [{ role: "user", content: userContent }],
3678
+ seed,
3679
+ providerOptions: {
3680
+ google: preparedGoogleOptions != null ? preparedGoogleOptions : { responseModalities: ["IMAGE"] }
3681
+ },
3682
+ tools: (googleImageOptions == null ? void 0 : googleImageOptions.googleSearch) != null ? [
3683
+ {
3684
+ type: "provider",
3685
+ id: "google.google_search",
3686
+ name: "google_search",
3687
+ args: googleImageOptions.googleSearch
3688
+ }
3689
+ ] : void 0
3690
+ }
3691
+ });
3692
+ return { ...prepared, warnings: [...warnings, ...prepared.warnings] };
3693
+ }
3487
3694
  async getHeaders(headers) {
3488
3695
  return combineHeaders3(
3489
3696
  this.batchConfig.headers ? await resolve3(this.batchConfig.headers) : void 0,
@@ -3596,124 +3803,126 @@ function getGoogleBatchModelId(requests) {
3596
3803
  }
3597
3804
  return modelId;
3598
3805
  }
3806
+ function convertGoogleImageBatchResult(result) {
3807
+ var _a, _b, _c, _d, _e, _f, _g;
3808
+ const images = result.content.flatMap(
3809
+ (part) => part.type === "file" && part.mediaType.startsWith("image/") && part.data.type === "data" ? [convertToBase642(part.data.data)] : []
3810
+ );
3811
+ if (images.length === 0) return void 0;
3812
+ const googleMetadata = (_b = (_a = result.providerMetadata) == null ? void 0 : _a.google) != null ? _b : {};
3813
+ return {
3814
+ images,
3815
+ warnings: result.warnings,
3816
+ providerMetadata: {
3817
+ google: { ...googleMetadata, images: images.map(() => ({})) }
3818
+ },
3819
+ response: {
3820
+ timestamp: /* @__PURE__ */ new Date(),
3821
+ modelId: (_d = (_c = result.response) == null ? void 0 : _c.modelId) != null ? _d : "",
3822
+ headers: (_e = result.response) == null ? void 0 : _e.headers
3823
+ },
3824
+ usage: {
3825
+ inputTokens: result.usage.inputTokens.total,
3826
+ outputTokens: result.usage.outputTokens.total,
3827
+ totalTokens: ((_f = result.usage.inputTokens.total) != null ? _f : 0) + ((_g = result.usage.outputTokens.total) != null ? _g : 0)
3828
+ }
3829
+ };
3830
+ }
3599
3831
 
3600
3832
  // src/tool/code-execution.ts
3601
- import { createProviderExecutedToolFactory } from "@ai-sdk/provider-utils";
3602
- import { z as z7 } from "zod/v4";
3603
- var codeExecution = createProviderExecutedToolFactory({
3833
+ import { createProviderExecutedToolFactory as createProviderExecutedToolFactory2 } from "@ai-sdk/provider-utils";
3834
+ import { z as z9 } from "zod/v4";
3835
+ var codeExecution = createProviderExecutedToolFactory2({
3604
3836
  id: "google.code_execution",
3605
- inputSchema: z7.object({
3606
- language: z7.string().describe("The programming language of the code."),
3607
- code: z7.string().describe("The code to be executed.")
3837
+ inputSchema: z9.object({
3838
+ language: z9.string().describe("The programming language of the code."),
3839
+ code: z9.string().describe("The code to be executed.")
3608
3840
  }),
3609
- outputSchema: z7.object({
3610
- outcome: z7.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
3611
- output: z7.string().describe("The output from the code execution.")
3841
+ outputSchema: z9.object({
3842
+ outcome: z9.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
3843
+ output: z9.string().describe("The output from the code execution.")
3612
3844
  })
3613
3845
  });
3614
3846
 
3615
3847
  // src/tool/enterprise-web-search.ts
3616
3848
  import {
3617
- createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
3618
- lazySchema as lazySchema7,
3619
- zodSchema as zodSchema7
3849
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
3850
+ lazySchema as lazySchema9,
3851
+ zodSchema as zodSchema9
3620
3852
  } from "@ai-sdk/provider-utils";
3621
- import { z as z8 } from "zod/v4";
3622
- var enterpriseWebSearch = createProviderExecutedToolFactory2({
3853
+ import { z as z10 } from "zod/v4";
3854
+ var enterpriseWebSearch = createProviderExecutedToolFactory3({
3623
3855
  id: "google.enterprise_web_search",
3624
- inputSchema: lazySchema7(() => zodSchema7(z8.object({}))),
3625
- outputSchema: lazySchema7(() => zodSchema7(z8.object({})))
3856
+ inputSchema: lazySchema9(() => zodSchema9(z10.object({}))),
3857
+ outputSchema: lazySchema9(() => zodSchema9(z10.object({})))
3626
3858
  });
3627
3859
 
3628
3860
  // src/tool/file-search.ts
3629
3861
  import {
3630
- createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
3631
- lazySchema as lazySchema8,
3632
- zodSchema as zodSchema8
3862
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory4,
3863
+ lazySchema as lazySchema10,
3864
+ zodSchema as zodSchema10
3633
3865
  } from "@ai-sdk/provider-utils";
3634
- import { z as z9 } from "zod/v4";
3635
- var fileSearchArgsBaseSchema = z9.looseObject({
3866
+ import { z as z11 } from "zod/v4";
3867
+ var fileSearchArgsBaseSchema = z11.looseObject({
3636
3868
  /** The names of the file_search_stores to retrieve from.
3637
3869
  * Example: `fileSearchStores/my-file-search-store-123`
3638
3870
  */
3639
- fileSearchStoreNames: z9.array(z9.string()).describe(
3871
+ fileSearchStoreNames: z11.array(z11.string()).describe(
3640
3872
  "The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
3641
3873
  ),
3642
3874
  /** The number of file search retrieval chunks to retrieve. */
3643
- topK: z9.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
3875
+ topK: z11.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
3644
3876
  /** Metadata filter to apply to the file search retrieval documents.
3645
3877
  * See https://google.aip.dev/160 for the syntax of the filter expression.
3646
3878
  */
3647
- metadataFilter: z9.string().describe(
3879
+ metadataFilter: z11.string().describe(
3648
3880
  "Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
3649
3881
  ).optional()
3650
3882
  });
3651
- var fileSearch = createProviderExecutedToolFactory3({
3883
+ var fileSearch = createProviderExecutedToolFactory4({
3652
3884
  id: "google.file_search",
3653
- inputSchema: lazySchema8(() => zodSchema8(z9.object({}))),
3654
- outputSchema: lazySchema8(() => zodSchema8(z9.object({})))
3885
+ inputSchema: lazySchema10(() => zodSchema10(z11.object({}))),
3886
+ outputSchema: lazySchema10(() => zodSchema10(z11.object({})))
3655
3887
  });
3656
3888
 
3657
3889
  // src/tool/google-maps.ts
3658
- import {
3659
- createProviderExecutedToolFactory as createProviderExecutedToolFactory4,
3660
- lazySchema as lazySchema9,
3661
- zodSchema as zodSchema9
3662
- } from "@ai-sdk/provider-utils";
3663
- import { z as z10 } from "zod/v4";
3664
- var googleMaps = createProviderExecutedToolFactory4({
3665
- id: "google.google_maps",
3666
- inputSchema: lazySchema9(() => zodSchema9(z10.object({}))),
3667
- outputSchema: lazySchema9(() => zodSchema9(z10.object({})))
3668
- });
3669
-
3670
- // src/tool/google-search.ts
3671
3890
  import {
3672
3891
  createProviderExecutedToolFactory as createProviderExecutedToolFactory5,
3673
- lazySchema as lazySchema10,
3674
- zodSchema as zodSchema10
3892
+ lazySchema as lazySchema11,
3893
+ zodSchema as zodSchema11
3675
3894
  } from "@ai-sdk/provider-utils";
3676
- import { z as z11 } from "zod/v4";
3677
- var googleSearchToolArgsBaseSchema = z11.looseObject({
3678
- searchTypes: z11.object({
3679
- webSearch: z11.object({}).optional(),
3680
- imageSearch: z11.object({}).optional()
3681
- }).optional(),
3682
- timeRangeFilter: z11.object({
3683
- startTime: z11.string(),
3684
- endTime: z11.string()
3685
- }).optional()
3686
- });
3687
- var googleSearch = createProviderExecutedToolFactory5({
3688
- id: "google.google_search",
3689
- inputSchema: lazySchema10(() => zodSchema10(z11.object({}))),
3690
- outputSchema: lazySchema10(() => zodSchema10(z11.object({})))
3895
+ import { z as z12 } from "zod/v4";
3896
+ var googleMaps = createProviderExecutedToolFactory5({
3897
+ id: "google.google_maps",
3898
+ inputSchema: lazySchema11(() => zodSchema11(z12.object({}))),
3899
+ outputSchema: lazySchema11(() => zodSchema11(z12.object({})))
3691
3900
  });
3692
3901
 
3693
3902
  // src/tool/url-context.ts
3694
3903
  import {
3695
3904
  createProviderExecutedToolFactory as createProviderExecutedToolFactory6,
3696
- lazySchema as lazySchema11,
3697
- zodSchema as zodSchema11
3905
+ lazySchema as lazySchema12,
3906
+ zodSchema as zodSchema12
3698
3907
  } from "@ai-sdk/provider-utils";
3699
- import { z as z12 } from "zod/v4";
3908
+ import { z as z13 } from "zod/v4";
3700
3909
  var urlContext = createProviderExecutedToolFactory6({
3701
3910
  id: "google.url_context",
3702
- inputSchema: lazySchema11(() => zodSchema11(z12.object({}))),
3703
- outputSchema: lazySchema11(() => zodSchema11(z12.object({})))
3911
+ inputSchema: lazySchema12(() => zodSchema12(z13.object({}))),
3912
+ outputSchema: lazySchema12(() => zodSchema12(z13.object({})))
3704
3913
  });
3705
3914
 
3706
3915
  // src/tool/vertex-rag-store.ts
3707
3916
  import {
3708
3917
  createProviderExecutedToolFactory as createProviderExecutedToolFactory7,
3709
- lazySchema as lazySchema12,
3710
- zodSchema as zodSchema12
3918
+ lazySchema as lazySchema13,
3919
+ zodSchema as zodSchema13
3711
3920
  } from "@ai-sdk/provider-utils";
3712
- import { z as z13 } from "zod/v4";
3921
+ import { z as z14 } from "zod/v4";
3713
3922
  var vertexRagStore = createProviderExecutedToolFactory7({
3714
3923
  id: "google.vertex_rag_store",
3715
- inputSchema: lazySchema12(() => zodSchema12(z13.object({}))),
3716
- outputSchema: lazySchema12(() => zodSchema12(z13.object({})))
3924
+ inputSchema: lazySchema13(() => zodSchema13(z14.object({}))),
3925
+ outputSchema: lazySchema13(() => zodSchema13(z14.object({})))
3717
3926
  });
3718
3927
 
3719
3928
  // src/google-tools.ts
@@ -3778,35 +3987,13 @@ var googleTools = {
3778
3987
 
3779
3988
  // src/google-image-model.ts
3780
3989
  import {
3781
- convertToBase64 as convertToBase642,
3990
+ convertToBase64 as convertToBase643,
3782
3991
  generateId as defaultGenerateId,
3783
- parseProviderOptions as parseProviderOptions3,
3992
+ parseProviderOptions as parseProviderOptions4,
3784
3993
  serializeModelOptions as serializeModelOptions3,
3785
3994
  WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE3,
3786
3995
  WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE3
3787
3996
  } from "@ai-sdk/provider-utils";
3788
-
3789
- // src/google-image-model-options.ts
3790
- import { lazySchema as lazySchema13, zodSchema as zodSchema13 } from "@ai-sdk/provider-utils";
3791
- import { z as z14 } from "zod/v4";
3792
- var googleImageModelOptionsSchema = lazySchema13(
3793
- () => zodSchema13(
3794
- z14.object({
3795
- /**
3796
- * Enable Google Search grounding for Gemini image models. The value is
3797
- * forwarded as the args of the `google.tools.googleSearch` provider
3798
- * tool on the underlying language-model call. Pass `{}` for defaults.
3799
- *
3800
- * `generateImage` does not accept a `tools` parameter, so this is the
3801
- * dedicated escape hatch for grounding image generation the same way
3802
- * `generateText` does.
3803
- */
3804
- googleSearch: googleSearchToolArgsBaseSchema.optional()
3805
- })
3806
- )
3807
- );
3808
-
3809
- // src/google-image-model.ts
3810
3997
  var GoogleImageModel = class _GoogleImageModel {
3811
3998
  constructor(modelId, settings, config) {
3812
3999
  this.modelId = modelId;
@@ -3896,7 +4083,7 @@ var GoogleImageModel = class _GoogleImageModel {
3896
4083
  const languageModelPrompt = [
3897
4084
  { role: "user", content: userContent }
3898
4085
  ];
3899
- const googleImageOptions = await parseProviderOptions3({
4086
+ const googleImageOptions = await parseProviderOptions4({
3900
4087
  provider: "google",
3901
4088
  providerOptions,
3902
4089
  schema: googleImageModelOptionsSchema
@@ -3944,7 +4131,7 @@ var GoogleImageModel = class _GoogleImageModel {
3944
4131
  const images = [];
3945
4132
  for (const part of result.content) {
3946
4133
  if (part.type === "file" && part.mediaType.startsWith("image/") && part.data.type === "data") {
3947
- images.push(convertToBase642(part.data.data));
4134
+ images.push(convertToBase643(part.data.data));
3948
4135
  }
3949
4136
  }
3950
4137
  const languageModelGoogleMetadata = (_h = (_g = result.providerMetadata) == null ? void 0 : _g.google) != null ? _h : {};
@@ -3982,7 +4169,7 @@ import {
3982
4169
  createJsonResponseHandler as createJsonResponseHandler4,
3983
4170
  delay,
3984
4171
  lazySchema as lazySchema14,
3985
- parseProviderOptions as parseProviderOptions4,
4172
+ parseProviderOptions as parseProviderOptions5,
3986
4173
  zodSchema as zodSchema14,
3987
4174
  getFromApi as getFromApi2
3988
4175
  } from "@ai-sdk/provider-utils";
@@ -4001,7 +4188,7 @@ var GoogleFiles = class {
4001
4188
  }
4002
4189
  async uploadFile(options) {
4003
4190
  var _a, _b, _c, _d;
4004
- const googleOptions = await parseProviderOptions4({
4191
+ const googleOptions = await parseProviderOptions5({
4005
4192
  provider: "google",
4006
4193
  providerOptions: options.providerOptions,
4007
4194
  schema: googleFilesUploadOptionsSchema
@@ -4163,7 +4350,7 @@ import {
4163
4350
  createJsonResponseHandler as createJsonResponseHandler5,
4164
4351
  getFromApi as getFromApi3,
4165
4352
  isSameOrigin,
4166
- parseProviderOptions as parseProviderOptions5,
4353
+ parseProviderOptions as parseProviderOptions6,
4167
4354
  postJsonToApi as postJsonToApi4,
4168
4355
  resolve as resolve4
4169
4356
  } from "@ai-sdk/provider-utils";
@@ -4268,7 +4455,7 @@ var GoogleVideoModel = class {
4268
4455
  }
4269
4456
  async buildRequest(options) {
4270
4457
  const warnings = [];
4271
- const googleOptions = await parseProviderOptions5({
4458
+ const googleOptions = await parseProviderOptions6({
4272
4459
  provider: "google",
4273
4460
  providerOptions: options.providerOptions,
4274
4461
  schema: googleVideoModelOptionsSchema
@@ -4504,7 +4691,7 @@ import {
4504
4691
  combineHeaders as combineHeaders6,
4505
4692
  convertBase64ToUint8Array,
4506
4693
  createJsonResponseHandler as createJsonResponseHandler6,
4507
- parseProviderOptions as parseProviderOptions6,
4694
+ parseProviderOptions as parseProviderOptions7,
4508
4695
  postJsonToApi as postJsonToApi5,
4509
4696
  resolve as resolve5,
4510
4697
  serializeModelOptions as serializeModelOptions4,
@@ -4604,7 +4791,7 @@ var GoogleSpeechModel = class _GoogleSpeechModel {
4604
4791
  const providerOptionsNames = this.config.provider.includes("vertex") ? ["googleVertex", "vertex"] : ["google"];
4605
4792
  let googleOptions;
4606
4793
  for (const name of providerOptionsNames) {
4607
- googleOptions = await parseProviderOptions6({
4794
+ googleOptions = await parseProviderOptions7({
4608
4795
  provider: name,
4609
4796
  providerOptions,
4610
4797
  schema: googleSpeechProviderOptionsSchema
@@ -4614,7 +4801,7 @@ var GoogleSpeechModel = class _GoogleSpeechModel {
4614
4801
  }
4615
4802
  }
4616
4803
  if (googleOptions == null && !providerOptionsNames.includes("google")) {
4617
- googleOptions = await parseProviderOptions6({
4804
+ googleOptions = await parseProviderOptions7({
4618
4805
  provider: "google",
4619
4806
  providerOptions,
4620
4807
  schema: googleSpeechProviderOptionsSchema
@@ -4778,7 +4965,7 @@ import {
4778
4965
  createEventSourceResponseHandler as createEventSourceResponseHandler3,
4779
4966
  createJsonResponseHandler as createJsonResponseHandler8,
4780
4967
  generateId as defaultGenerateId2,
4781
- parseProviderOptions as parseProviderOptions7,
4968
+ parseProviderOptions as parseProviderOptions8,
4782
4969
  postJsonToApi as postJsonToApi6,
4783
4970
  resolve as resolve6,
4784
4971
  serializeModelOptions as serializeModelOptions5,
@@ -5569,7 +5756,7 @@ function buildGoogleInteractionsStreamTransform({
5569
5756
 
5570
5757
  // src/interactions/convert-to-google-interactions-input.ts
5571
5758
  import {
5572
- convertToBase64 as convertToBase643,
5759
+ convertToBase64 as convertToBase644,
5573
5760
  getTopLevelMediaType as getTopLevelMediaType2,
5574
5761
  isFullMediaType as isFullMediaType2,
5575
5762
  resolveFullMediaType as resolveFullMediaType2,
@@ -5770,7 +5957,7 @@ function convertFilePartToContent({
5770
5957
  const mimeType = resolveFullMediaType2({ part });
5771
5958
  return {
5772
5959
  type: kind,
5773
- data: convertToBase643(part.data.data),
5960
+ data: convertToBase644(part.data.data),
5774
5961
  mime_type: mimeType,
5775
5962
  ...resolutionField,
5776
5963
  ...processingField
@@ -5957,7 +6144,7 @@ function filePartToImageBlock({
5957
6144
  });
5958
6145
  return {
5959
6146
  type: "image",
5960
- data: convertToBase643(part.data.data),
6147
+ data: convertToBase644(part.data.data),
5961
6148
  mime_type: mimeType
5962
6149
  };
5963
6150
  }
@@ -7385,7 +7572,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
7385
7572
  async getArgs(options) {
7386
7573
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
7387
7574
  const warnings = [];
7388
- const googleOptions = await parseProviderOptions7({
7575
+ const googleOptions = await parseProviderOptions8({
7389
7576
  provider: "google",
7390
7577
  providerOptions: options.providerOptions,
7391
7578
  schema: googleInteractionsLanguageModelOptions
@@ -8286,9 +8473,9 @@ import {
8286
8473
  import {
8287
8474
  combineHeaders as combineHeaders9,
8288
8475
  connectToWebSocket,
8289
- convertToBase64 as convertToBase644,
8476
+ convertToBase64 as convertToBase645,
8290
8477
  createJsonResponseHandler as createJsonResponseHandler9,
8291
- parseProviderOptions as parseProviderOptions8,
8478
+ parseProviderOptions as parseProviderOptions9,
8292
8479
  postJsonToApi as postJsonToApi7,
8293
8480
  resolve as resolve7,
8294
8481
  safeParseJSON as safeParseJSON2,
@@ -8362,7 +8549,7 @@ var GoogleTranscriptionModel = class _GoogleTranscriptionModel {
8362
8549
  return this.config.provider;
8363
8550
  }
8364
8551
  async parseOptions(providerOptions) {
8365
- return parseProviderOptions8({
8552
+ return parseProviderOptions9({
8366
8553
  provider: "google",
8367
8554
  providerOptions,
8368
8555
  schema: googleTranscriptionModelOptions
@@ -8385,7 +8572,7 @@ var GoogleTranscriptionModel = class _GoogleTranscriptionModel {
8385
8572
  input: [
8386
8573
  {
8387
8574
  type: "audio",
8388
- data: convertToBase644(options.audio),
8575
+ data: convertToBase645(options.audio),
8389
8576
  mime_type: options.mediaType
8390
8577
  }
8391
8578
  ],
@@ -8605,7 +8792,7 @@ function createGoogleLiveTranscriptionStream({
8605
8792
  JSON.stringify({
8606
8793
  realtimeInput: {
8607
8794
  audio: {
8608
- data: convertToBase644(value),
8795
+ data: convertToBase645(value),
8609
8796
  mimeType: `audio/pcm;rate=${inputAudioRate}`
8610
8797
  }
8611
8798
  }
@@ -8804,8 +8991,8 @@ import {
8804
8991
  connectToWebSocket as connectToWebSocket2,
8805
8992
  combineHeaders as combineHeaders10,
8806
8993
  convertBase64ToUint8Array as convertBase64ToUint8Array2,
8807
- convertToBase64 as convertToBase645,
8808
- parseProviderOptions as parseProviderOptions9,
8994
+ convertToBase64 as convertToBase646,
8995
+ parseProviderOptions as parseProviderOptions10,
8809
8996
  safeParseJSON as safeParseJSON3,
8810
8997
  serializeModelOptions as serializeModelOptions7,
8811
8998
  WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE7,
@@ -8868,7 +9055,7 @@ var GoogleSpeechTranslationModel = class _GoogleSpeechTranslationModel {
8868
9055
  });
8869
9056
  }
8870
9057
  const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
8871
- const googleOptions = await parseProviderOptions9({
9058
+ const googleOptions = await parseProviderOptions10({
8872
9059
  provider: "google",
8873
9060
  providerOptions: options.providerOptions,
8874
9061
  schema: googleSpeechTranslationModelOptions
@@ -9048,7 +9235,7 @@ function createGoogleLiveSpeechTranslationStream({
9048
9235
  JSON.stringify({
9049
9236
  realtimeInput: {
9050
9237
  audio: {
9051
- data: convertToBase645(value),
9238
+ data: convertToBase646(value),
9052
9239
  mimeType: `audio/pcm;rate=${inputAudioRate}`
9053
9240
  }
9054
9241
  }