@ai-sdk/google 4.0.0-beta.45 → 4.0.0-beta.46

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 4.0.0-beta.46
4
+
5
+ ### Patch Changes
6
+
7
+ - 58a2ad7: fix: more precise default message for tool execution denial
8
+ - 84f36e0: fix(google): omit passing includeServerSideToolInvocations for Vertex tool_config
9
+ - Updated dependencies [785fe16]
10
+ - Updated dependencies [67df0a0]
11
+ - Updated dependencies [befb78c]
12
+ - Updated dependencies [0458559]
13
+ - Updated dependencies [5852c0a]
14
+ - Updated dependencies [fc92055]
15
+ - @ai-sdk/provider-utils@5.0.0-beta.27
16
+
3
17
  ## 4.0.0-beta.45
4
18
 
5
19
  ### Major Changes
package/dist/index.d.ts CHANGED
@@ -266,7 +266,7 @@ declare const googleTools: {
266
266
  * Creates a Google search tool that gives Google direct access to real-time web content.
267
267
  * Must have name "google_search".
268
268
  */
269
- googleSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
269
+ googleSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {
270
270
  [x: string]: unknown;
271
271
  searchTypes?: {
272
272
  webSearch?: Record<string, never> | undefined;
@@ -287,7 +287,7 @@ declare const googleTools: {
287
287
  *
288
288
  * @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
289
289
  */
290
- enterpriseWebSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
290
+ enterpriseWebSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {}, {}>;
291
291
  /**
292
292
  * Creates a Google Maps grounding tool that gives the model access to Google Maps data.
293
293
  * Must have name "google_maps".
@@ -295,12 +295,12 @@ declare const googleTools: {
295
295
  * @see https://ai.google.dev/gemini-api/docs/maps-grounding
296
296
  * @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
297
297
  */
298
- googleMaps: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
298
+ googleMaps: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {}, {}>;
299
299
  /**
300
300
  * Creates a URL context tool that gives Google direct access to real-time web content.
301
301
  * Must have name "url_context".
302
302
  */
303
- urlContext: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
303
+ urlContext: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {}, {}>;
304
304
  /**
305
305
  * Enables Retrieval Augmented Generation (RAG) via the Gemini File Search tool.
306
306
  * Must have name "file_search".
@@ -311,7 +311,7 @@ declare const googleTools: {
311
311
  *
312
312
  * @see https://ai.google.dev/gemini-api/docs/file-search
313
313
  */
314
- fileSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
314
+ fileSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {
315
315
  [x: string]: unknown;
316
316
  fileSearchStoreNames: string[];
317
317
  topK?: number | undefined;
@@ -327,7 +327,7 @@ declare const googleTools: {
327
327
  * @see https://ai.google.dev/gemini-api/docs/code-execution (Google AI)
328
328
  * @see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/code-execution-api (Vertex AI)
329
329
  */
330
- codeExecution: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
330
+ codeExecution: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{
331
331
  language: string;
332
332
  code: string;
333
333
  }, {
@@ -338,7 +338,7 @@ declare const googleTools: {
338
338
  * Creates a Vertex RAG Store tool that enables the model to perform RAG searches against a Vertex RAG Store.
339
339
  * Must have name "vertex_rag_store".
340
340
  */
341
- vertexRagStore: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
341
+ vertexRagStore: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {
342
342
  ragCorpus: string;
343
343
  topK?: number;
344
344
  }, {}>;
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.0-beta.45" : "0.0.0-test";
10
+ var VERSION = true ? "4.0.0-beta.46" : "0.0.0-test";
11
11
 
12
12
  // src/google-embedding-model.ts
13
13
  import {
@@ -752,7 +752,7 @@ function convertToGoogleMessages(prompt, options) {
752
752
  name: part.toolName,
753
753
  response: {
754
754
  name: part.toolName,
755
- content: output.type === "execution-denied" ? (_h = output.reason) != null ? _h : "Tool execution denied." : output.value
755
+ content: output.type === "execution-denied" ? (_h = output.reason) != null ? _h : "Tool call execution denied." : output.value
756
756
  }
757
757
  }
758
758
  });
@@ -930,7 +930,8 @@ import {
930
930
  function prepareTools({
931
931
  tools,
932
932
  toolChoice,
933
- modelId
933
+ modelId,
934
+ isVertexProvider = false
934
935
  }) {
935
936
  var _a, _b;
936
937
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
@@ -1066,7 +1067,9 @@ function prepareTools({
1066
1067
  }
1067
1068
  const combinedToolConfig = {
1068
1069
  functionCallingConfig: { mode: "VALIDATED" },
1069
- includeServerSideToolInvocations: true
1070
+ ...!isVertexProvider && {
1071
+ includeServerSideToolInvocations: true
1072
+ }
1070
1073
  };
1071
1074
  if (toolChoice != null) {
1072
1075
  switch (toolChoice.type) {
@@ -1513,7 +1516,8 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1513
1516
  } = prepareTools({
1514
1517
  tools,
1515
1518
  toolChoice,
1516
- modelId: this.modelId
1519
+ modelId: this.modelId,
1520
+ isVertexProvider
1517
1521
  });
1518
1522
  const resolvedThinking = resolveThinkingConfig({
1519
1523
  reasoning,
@@ -2505,9 +2509,9 @@ var chunkSchema = lazySchema5(
2505
2509
  );
2506
2510
 
2507
2511
  // src/tool/code-execution.ts
2508
- import { createProviderToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
2512
+ import { createProviderExecutedToolFactory } from "@ai-sdk/provider-utils";
2509
2513
  import { z as z6 } from "zod/v4";
2510
- var codeExecution = createProviderToolFactoryWithOutputSchema({
2514
+ var codeExecution = createProviderExecutedToolFactory({
2511
2515
  id: "google.code_execution",
2512
2516
  inputSchema: z6.object({
2513
2517
  language: z6.string().describe("The programming language of the code."),
@@ -2521,19 +2525,20 @@ var codeExecution = createProviderToolFactoryWithOutputSchema({
2521
2525
 
2522
2526
  // src/tool/enterprise-web-search.ts
2523
2527
  import {
2524
- createProviderToolFactory,
2528
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
2525
2529
  lazySchema as lazySchema6,
2526
2530
  zodSchema as zodSchema6
2527
2531
  } from "@ai-sdk/provider-utils";
2528
2532
  import { z as z7 } from "zod/v4";
2529
- var enterpriseWebSearch = createProviderToolFactory({
2533
+ var enterpriseWebSearch = createProviderExecutedToolFactory2({
2530
2534
  id: "google.enterprise_web_search",
2531
- inputSchema: lazySchema6(() => zodSchema6(z7.object({})))
2535
+ inputSchema: lazySchema6(() => zodSchema6(z7.object({}))),
2536
+ outputSchema: lazySchema6(() => zodSchema6(z7.object({})))
2532
2537
  });
2533
2538
 
2534
2539
  // src/tool/file-search.ts
2535
2540
  import {
2536
- createProviderToolFactory as createProviderToolFactory2,
2541
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
2537
2542
  lazySchema as lazySchema7,
2538
2543
  zodSchema as zodSchema7
2539
2544
  } from "@ai-sdk/provider-utils";
@@ -2554,29 +2559,28 @@ var fileSearchArgsBaseSchema = z8.object({
2554
2559
  "Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
2555
2560
  ).optional()
2556
2561
  }).passthrough();
2557
- var fileSearchArgsSchema = lazySchema7(
2558
- () => zodSchema7(fileSearchArgsBaseSchema)
2559
- );
2560
- var fileSearch = createProviderToolFactory2({
2562
+ var fileSearch = createProviderExecutedToolFactory3({
2561
2563
  id: "google.file_search",
2562
- inputSchema: fileSearchArgsSchema
2564
+ inputSchema: lazySchema7(() => zodSchema7(z8.object({}))),
2565
+ outputSchema: lazySchema7(() => zodSchema7(z8.object({})))
2563
2566
  });
2564
2567
 
2565
2568
  // src/tool/google-maps.ts
2566
2569
  import {
2567
- createProviderToolFactory as createProviderToolFactory3,
2570
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory4,
2568
2571
  lazySchema as lazySchema8,
2569
2572
  zodSchema as zodSchema8
2570
2573
  } from "@ai-sdk/provider-utils";
2571
2574
  import { z as z9 } from "zod/v4";
2572
- var googleMaps = createProviderToolFactory3({
2575
+ var googleMaps = createProviderExecutedToolFactory4({
2573
2576
  id: "google.google_maps",
2574
- inputSchema: lazySchema8(() => zodSchema8(z9.object({})))
2577
+ inputSchema: lazySchema8(() => zodSchema8(z9.object({}))),
2578
+ outputSchema: lazySchema8(() => zodSchema8(z9.object({})))
2575
2579
  });
2576
2580
 
2577
2581
  // src/tool/google-search.ts
2578
2582
  import {
2579
- createProviderToolFactory as createProviderToolFactory4,
2583
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory5,
2580
2584
  lazySchema as lazySchema9,
2581
2585
  zodSchema as zodSchema9
2582
2586
  } from "@ai-sdk/provider-utils";
@@ -2591,37 +2595,36 @@ var googleSearchToolArgsBaseSchema = z10.object({
2591
2595
  endTime: z10.string()
2592
2596
  }).optional()
2593
2597
  }).passthrough();
2594
- var googleSearchToolArgsSchema = lazySchema9(
2595
- () => zodSchema9(googleSearchToolArgsBaseSchema)
2596
- );
2597
- var googleSearch = createProviderToolFactory4(
2598
- {
2599
- id: "google.google_search",
2600
- inputSchema: googleSearchToolArgsSchema
2601
- }
2602
- );
2598
+ var googleSearch = createProviderExecutedToolFactory5({
2599
+ id: "google.google_search",
2600
+ inputSchema: lazySchema9(() => zodSchema9(z10.object({}))),
2601
+ outputSchema: lazySchema9(() => zodSchema9(z10.object({})))
2602
+ });
2603
2603
 
2604
2604
  // src/tool/url-context.ts
2605
2605
  import {
2606
- createProviderToolFactory as createProviderToolFactory5,
2606
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory6,
2607
2607
  lazySchema as lazySchema10,
2608
2608
  zodSchema as zodSchema10
2609
2609
  } from "@ai-sdk/provider-utils";
2610
2610
  import { z as z11 } from "zod/v4";
2611
- var urlContext = createProviderToolFactory5({
2611
+ var urlContext = createProviderExecutedToolFactory6({
2612
2612
  id: "google.url_context",
2613
- inputSchema: lazySchema10(() => zodSchema10(z11.object({})))
2613
+ inputSchema: lazySchema10(() => zodSchema10(z11.object({}))),
2614
+ outputSchema: lazySchema10(() => zodSchema10(z11.object({})))
2614
2615
  });
2615
2616
 
2616
2617
  // src/tool/vertex-rag-store.ts
2617
- import { createProviderToolFactory as createProviderToolFactory6 } from "@ai-sdk/provider-utils";
2618
+ import {
2619
+ createProviderExecutedToolFactory as createProviderExecutedToolFactory7,
2620
+ lazySchema as lazySchema11,
2621
+ zodSchema as zodSchema11
2622
+ } from "@ai-sdk/provider-utils";
2618
2623
  import { z as z12 } from "zod/v4";
2619
- var vertexRagStore = createProviderToolFactory6({
2624
+ var vertexRagStore = createProviderExecutedToolFactory7({
2620
2625
  id: "google.vertex_rag_store",
2621
- inputSchema: z12.object({
2622
- ragCorpus: z12.string(),
2623
- topK: z12.number().optional()
2624
- })
2626
+ inputSchema: lazySchema11(() => zodSchema11(z12.object({}))),
2627
+ outputSchema: lazySchema11(() => zodSchema11(z12.object({})))
2625
2628
  });
2626
2629
 
2627
2630
  // src/google-tools.ts
@@ -2690,14 +2693,14 @@ import {
2690
2693
  convertToBase64 as convertToBase642,
2691
2694
  createJsonResponseHandler as createJsonResponseHandler3,
2692
2695
  generateId as defaultGenerateId,
2693
- lazySchema as lazySchema11,
2696
+ lazySchema as lazySchema12,
2694
2697
  parseProviderOptions as parseProviderOptions3,
2695
2698
  postJsonToApi as postJsonToApi3,
2696
2699
  resolve as resolve3,
2697
2700
  serializeModelOptions as serializeModelOptions3,
2698
2701
  WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE3,
2699
2702
  WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE3,
2700
- zodSchema as zodSchema11
2703
+ zodSchema as zodSchema12
2701
2704
  } from "@ai-sdk/provider-utils";
2702
2705
  import { z as z13 } from "zod/v4";
2703
2706
  var GoogleImageModel = class _GoogleImageModel {
@@ -2934,15 +2937,15 @@ var GoogleImageModel = class _GoogleImageModel {
2934
2937
  function isGeminiModel(modelId) {
2935
2938
  return modelId.startsWith("gemini-");
2936
2939
  }
2937
- var googleImageResponseSchema = lazySchema11(
2938
- () => zodSchema11(
2940
+ var googleImageResponseSchema = lazySchema12(
2941
+ () => zodSchema12(
2939
2942
  z13.object({
2940
2943
  predictions: z13.array(z13.object({ bytesBase64Encoded: z13.string() })).default([])
2941
2944
  })
2942
2945
  )
2943
2946
  );
2944
- var googleImageModelOptionsSchema = lazySchema11(
2945
- () => zodSchema11(
2947
+ var googleImageModelOptionsSchema = lazySchema12(
2948
+ () => zodSchema12(
2946
2949
  z13.object({
2947
2950
  personGeneration: z13.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
2948
2951
  aspectRatio: z13.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish()
@@ -2958,9 +2961,9 @@ import {
2958
2961
  combineHeaders as combineHeaders4,
2959
2962
  createJsonResponseHandler as createJsonResponseHandler4,
2960
2963
  delay,
2961
- lazySchema as lazySchema12,
2964
+ lazySchema as lazySchema13,
2962
2965
  parseProviderOptions as parseProviderOptions4,
2963
- zodSchema as zodSchema12,
2966
+ zodSchema as zodSchema13,
2964
2967
  getFromApi
2965
2968
  } from "@ai-sdk/provider-utils";
2966
2969
  import { z as z14 } from "zod/v4";
@@ -3087,8 +3090,8 @@ var GoogleFiles = class {
3087
3090
  };
3088
3091
  }
3089
3092
  };
3090
- var googleFileResponseSchema = lazySchema12(
3091
- () => zodSchema12(
3093
+ var googleFileResponseSchema = lazySchema13(
3094
+ () => zodSchema13(
3092
3095
  z14.object({
3093
3096
  name: z14.string(),
3094
3097
  displayName: z14.string().nullish(),
@@ -3103,8 +3106,8 @@ var googleFileResponseSchema = lazySchema12(
3103
3106
  })
3104
3107
  )
3105
3108
  );
3106
- var googleFilesUploadOptionsSchema = lazySchema12(
3107
- () => zodSchema12(
3109
+ var googleFilesUploadOptionsSchema = lazySchema13(
3110
+ () => zodSchema13(
3108
3111
  z14.object({
3109
3112
  displayName: z14.string().nullish(),
3110
3113
  pollIntervalMs: z14.number().positive().nullish(),
@@ -3123,11 +3126,11 @@ import {
3123
3126
  createJsonResponseHandler as createJsonResponseHandler5,
3124
3127
  delay as delay2,
3125
3128
  getFromApi as getFromApi2,
3126
- lazySchema as lazySchema13,
3129
+ lazySchema as lazySchema14,
3127
3130
  parseProviderOptions as parseProviderOptions5,
3128
3131
  postJsonToApi as postJsonToApi4,
3129
3132
  resolve as resolve4,
3130
- zodSchema as zodSchema13
3133
+ zodSchema as zodSchema14
3131
3134
  } from "@ai-sdk/provider-utils";
3132
3135
  import { z as z15 } from "zod/v4";
3133
3136
  var GoogleVideoModel = class {
@@ -3361,8 +3364,8 @@ var googleOperationSchema = z15.object({
3361
3364
  }).nullish()
3362
3365
  }).nullish()
3363
3366
  });
3364
- var googleVideoModelOptionsSchema = lazySchema13(
3365
- () => zodSchema13(
3367
+ var googleVideoModelOptionsSchema = lazySchema14(
3368
+ () => zodSchema14(
3366
3369
  z15.object({
3367
3370
  pollIntervalMs: z15.number().positive().nullish(),
3368
3371
  pollTimeoutMs: z15.number().positive().nullish(),