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

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/google",
3
- "version": "4.0.0-beta.45",
3
+ "version": "4.0.0-beta.47",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -35,15 +35,15 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@ai-sdk/provider": "4.0.0-beta.12",
39
- "@ai-sdk/provider-utils": "5.0.0-beta.26"
38
+ "@ai-sdk/provider": "4.0.0-beta.13",
39
+ "@ai-sdk/provider-utils": "5.0.0-beta.28"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "20.17.24",
43
43
  "tsup": "^8",
44
44
  "typescript": "5.8.3",
45
45
  "zod": "3.25.76",
46
- "@ai-sdk/test-server": "2.0.0-beta.1",
46
+ "@ai-sdk/test-server": "2.0.0-beta.2",
47
47
  "@vercel/ai-tsconfig": "0.0.0"
48
48
  },
49
49
  "peerDependencies": {
@@ -53,12 +53,14 @@
53
53
  "node": ">=18"
54
54
  },
55
55
  "publishConfig": {
56
- "access": "public"
56
+ "access": "public",
57
+ "provenance": true
57
58
  },
58
59
  "homepage": "https://ai-sdk.dev/docs",
59
60
  "repository": {
60
61
  "type": "git",
61
- "url": "git+https://github.com/vercel/ai.git"
62
+ "url": "https://github.com/vercel/ai",
63
+ "directory": "packages/google"
62
64
  },
63
65
  "bugs": {
64
66
  "url": "https://github.com/vercel/ai/issues"
@@ -478,7 +478,7 @@ export function convertToGoogleMessages(
478
478
  name: part.toolName,
479
479
  content:
480
480
  output.type === 'execution-denied'
481
- ? (output.reason ?? 'Tool execution denied.')
481
+ ? (output.reason ?? 'Tool call execution denied.')
482
482
  : output.value,
483
483
  },
484
484
  },
@@ -190,6 +190,7 @@ export class GoogleLanguageModel implements LanguageModelV4 {
190
190
  tools,
191
191
  toolChoice,
192
192
  modelId: this.modelId,
193
+ isVertexProvider,
193
194
  });
194
195
 
195
196
  const resolvedThinking = resolveThinkingConfig({
@@ -10,10 +10,12 @@ export function prepareTools({
10
10
  tools,
11
11
  toolChoice,
12
12
  modelId,
13
+ isVertexProvider = false,
13
14
  }: {
14
15
  tools: LanguageModelV4CallOptions['tools'];
15
16
  toolChoice?: LanguageModelV4CallOptions['toolChoice'];
16
17
  modelId: GoogleModelId;
18
+ isVertexProvider?: boolean;
17
19
  }): {
18
20
  tools:
19
21
  | Array<
@@ -202,10 +204,12 @@ export function prepareTools({
202
204
  mode: 'VALIDATED' | 'ANY' | 'NONE';
203
205
  allowedFunctionNames?: string[];
204
206
  };
205
- includeServerSideToolInvocations: true;
207
+ includeServerSideToolInvocations?: true;
206
208
  } = {
207
209
  functionCallingConfig: { mode: 'VALIDATED' },
208
- includeServerSideToolInvocations: true,
210
+ ...(!isVertexProvider && {
211
+ includeServerSideToolInvocations: true,
212
+ }),
209
213
  };
210
214
 
211
215
  if (toolChoice != null) {
@@ -1,4 +1,4 @@
1
- import { createProviderToolFactoryWithOutputSchema } from '@ai-sdk/provider-utils';
1
+ import { createProviderExecutedToolFactory } from '@ai-sdk/provider-utils';
2
2
  import { z } from 'zod/v4';
3
3
 
4
4
  /**
@@ -10,7 +10,7 @@ import { z } from 'zod/v4';
10
10
  * @see https://ai.google.dev/gemini-api/docs/code-execution (Google AI)
11
11
  * @see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/code-execution-api (Vertex AI)
12
12
  */
13
- export const codeExecution = createProviderToolFactoryWithOutputSchema<
13
+ export const codeExecution = createProviderExecutedToolFactory<
14
14
  {
15
15
  language: string;
16
16
  code: string;
@@ -1,5 +1,5 @@
1
1
  import {
2
- createProviderToolFactory,
2
+ createProviderExecutedToolFactory,
3
3
  lazySchema,
4
4
  zodSchema,
5
5
  } from '@ai-sdk/provider-utils';
@@ -7,12 +7,18 @@ import { z } from 'zod/v4';
7
7
 
8
8
  // https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
9
9
 
10
- export const enterpriseWebSearch = createProviderToolFactory<
10
+ export const enterpriseWebSearch = createProviderExecutedToolFactory<
11
11
  {
12
12
  // Enterprise Web Search does not have any input schema
13
13
  },
14
- {}
14
+ {
15
+ // Enterprise Web Search does not have any output parameters
16
+ },
17
+ {
18
+ // Enterprise Web Search does not have any configuration options
19
+ }
15
20
  >({
16
21
  id: 'google.enterprise_web_search',
17
22
  inputSchema: lazySchema(() => zodSchema(z.object({}))),
23
+ outputSchema: lazySchema(() => zodSchema(z.object({}))),
18
24
  });
@@ -1,5 +1,5 @@
1
1
  import {
2
- createProviderToolFactory,
2
+ createProviderExecutedToolFactory,
3
3
  lazySchema,
4
4
  zodSchema,
5
5
  } from '@ai-sdk/provider-utils';
@@ -38,14 +38,12 @@ const fileSearchArgsBaseSchema = z
38
38
 
39
39
  export type GoogleFileSearchToolArgs = z.infer<typeof fileSearchArgsBaseSchema>;
40
40
 
41
- const fileSearchArgsSchema = lazySchema(() =>
42
- zodSchema(fileSearchArgsBaseSchema),
43
- );
44
-
45
- export const fileSearch = createProviderToolFactory<
41
+ export const fileSearch = createProviderExecutedToolFactory<
42
+ {},
46
43
  {},
47
44
  GoogleFileSearchToolArgs
48
45
  >({
49
46
  id: 'google.file_search',
50
- inputSchema: fileSearchArgsSchema,
47
+ inputSchema: lazySchema(() => zodSchema(z.object({}))),
48
+ outputSchema: lazySchema(() => zodSchema(z.object({}))),
51
49
  });
@@ -1,5 +1,5 @@
1
1
  import {
2
- createProviderToolFactory,
2
+ createProviderExecutedToolFactory,
3
3
  lazySchema,
4
4
  zodSchema,
5
5
  } from '@ai-sdk/provider-utils';
@@ -8,7 +8,8 @@ import { z } from 'zod/v4';
8
8
  // https://ai.google.dev/gemini-api/docs/maps-grounding
9
9
  // https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
10
10
 
11
- export const googleMaps = createProviderToolFactory<{}, {}>({
11
+ export const googleMaps = createProviderExecutedToolFactory<{}, {}, {}>({
12
12
  id: 'google.google_maps',
13
13
  inputSchema: lazySchema(() => zodSchema(z.object({}))),
14
+ outputSchema: lazySchema(() => zodSchema(z.object({}))),
14
15
  });
@@ -1,5 +1,5 @@
1
1
  import {
2
- createProviderToolFactory,
2
+ createProviderExecutedToolFactory,
3
3
  lazySchema,
4
4
  zodSchema,
5
5
  } from '@ai-sdk/provider-utils';
@@ -31,13 +31,12 @@ export type GoogleSearchToolArgs = z.infer<
31
31
  typeof googleSearchToolArgsBaseSchema
32
32
  >;
33
33
 
34
- const googleSearchToolArgsSchema = lazySchema(() =>
35
- zodSchema(googleSearchToolArgsBaseSchema),
36
- );
37
-
38
- export const googleSearch = createProviderToolFactory<{}, GoogleSearchToolArgs>(
39
- {
40
- id: 'google.google_search',
41
- inputSchema: googleSearchToolArgsSchema,
42
- },
43
- );
34
+ export const googleSearch = createProviderExecutedToolFactory<
35
+ {},
36
+ {},
37
+ GoogleSearchToolArgs
38
+ >({
39
+ id: 'google.google_search',
40
+ inputSchema: lazySchema(() => zodSchema(z.object({}))),
41
+ outputSchema: lazySchema(() => zodSchema(z.object({}))),
42
+ });
@@ -1,16 +1,18 @@
1
1
  import {
2
- createProviderToolFactory,
2
+ createProviderExecutedToolFactory,
3
3
  lazySchema,
4
4
  zodSchema,
5
5
  } from '@ai-sdk/provider-utils';
6
6
  import { z } from 'zod/v4';
7
7
 
8
- export const urlContext = createProviderToolFactory<
8
+ export const urlContext = createProviderExecutedToolFactory<
9
9
  {
10
10
  // Url context does not have any input schema, it will directly use the url from the prompt
11
11
  },
12
+ {},
12
13
  {}
13
14
  >({
14
15
  id: 'google.url_context',
15
16
  inputSchema: lazySchema(() => zodSchema(z.object({}))),
17
+ outputSchema: lazySchema(() => zodSchema(z.object({}))),
16
18
  });
@@ -1,4 +1,8 @@
1
- import { createProviderToolFactory } from '@ai-sdk/provider-utils';
1
+ import {
2
+ createProviderExecutedToolFactory,
3
+ lazySchema,
4
+ zodSchema,
5
+ } from '@ai-sdk/provider-utils';
2
6
  import { z } from 'zod/v4';
3
7
 
4
8
  // https://cloud.google.com/vertex-ai/generative-ai/docs/rag-engine/use-vertexai-search#generate-content-using-gemini-api
@@ -9,7 +13,8 @@ import { z } from 'zod/v4';
9
13
  *
10
14
  * @note Only works with Vertex Gemini models.
11
15
  */
12
- export const vertexRagStore = createProviderToolFactory<
16
+ export const vertexRagStore = createProviderExecutedToolFactory<
17
+ {},
13
18
  {},
14
19
  {
15
20
  /**
@@ -24,8 +29,6 @@ export const vertexRagStore = createProviderToolFactory<
24
29
  }
25
30
  >({
26
31
  id: 'google.vertex_rag_store',
27
- inputSchema: z.object({
28
- ragCorpus: z.string(),
29
- topK: z.number().optional(),
30
- }),
32
+ inputSchema: lazySchema(() => zodSchema(z.object({}))),
33
+ outputSchema: lazySchema(() => zodSchema(z.object({}))),
31
34
  });