@ai-sdk/google 2.1.0-beta.9 → 3.0.0-beta.15

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.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.1.0-beta.9" : "0.0.0-test";
10
+ var VERSION = true ? "3.0.0-beta.15" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -20,11 +20,11 @@ import {
20
20
  postJsonToApi,
21
21
  resolve
22
22
  } from "@ai-sdk/provider-utils";
23
- import { z as z3 } from "zod/v4";
23
+ import * as z3 from "zod/v4";
24
24
 
25
25
  // src/google-error.ts
26
26
  import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
27
- import { z } from "zod/v4";
27
+ import * as z from "zod/v4";
28
28
  var googleErrorDataSchema = z.object({
29
29
  error: z.object({
30
30
  code: z.number().nullable(),
@@ -38,7 +38,7 @@ var googleFailedResponseHandler = createJsonErrorResponseHandler({
38
38
  });
39
39
 
40
40
  // src/google-generative-ai-embedding-options.ts
41
- import { z as z2 } from "zod/v4";
41
+ import * as z2 from "zod/v4";
42
42
  var googleGenerativeAIEmbeddingProviderOptions = z2.object({
43
43
  /**
44
44
  * Optional. Optional reduced dimension for the output embedding.
@@ -179,7 +179,7 @@ import {
179
179
  postJsonToApi as postJsonToApi2,
180
180
  resolve as resolve2
181
181
  } from "@ai-sdk/provider-utils";
182
- import { z as z7 } from "zod/v4";
182
+ import * as z7 from "zod/v4";
183
183
 
184
184
  // src/convert-json-schema-to-openapi-schema.ts
185
185
  function convertJSONSchemaToOpenAPISchema(jsonSchema) {
@@ -281,7 +281,7 @@ import {
281
281
  } from "@ai-sdk/provider";
282
282
  import { convertToBase64 } from "@ai-sdk/provider-utils";
283
283
  function convertToGoogleGenerativeAIMessages(prompt, options) {
284
- var _a;
284
+ var _a, _b;
285
285
  const systemInstructionParts = [];
286
286
  const contents = [];
287
287
  let systemMessagesAllowed = true;
@@ -333,12 +333,12 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
333
333
  contents.push({
334
334
  role: "model",
335
335
  parts: content.map((part) => {
336
- var _a2, _b, _c, _d, _e, _f;
336
+ var _a2, _b2, _c, _d, _e, _f;
337
337
  switch (part.type) {
338
338
  case "text": {
339
339
  return part.text.length === 0 ? void 0 : {
340
340
  text: part.text,
341
- thoughtSignature: (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.google) == null ? void 0 : _b.thoughtSignature
341
+ thoughtSignature: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.google) == null ? void 0 : _b2.thoughtSignature
342
342
  };
343
343
  }
344
344
  case "reasoning": {
@@ -423,7 +423,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
423
423
  name: part.toolName,
424
424
  response: {
425
425
  name: part.toolName,
426
- content: output.value
426
+ content: output.type === "execution-denied" ? (_b = output.reason) != null ? _b : "Tool execution denied." : output.value
427
427
  }
428
428
  }
429
429
  });
@@ -453,7 +453,7 @@ function getModelPath(modelId) {
453
453
  }
454
454
 
455
455
  // src/google-generative-ai-options.ts
456
- import { z as z4 } from "zod/v4";
456
+ import * as z4 from "zod/v4";
457
457
  var googleGenerativeAIProviderOptions = z4.object({
458
458
  responseModalities: z4.array(z4.enum(["TEXT", "IMAGE"])).optional(),
459
459
  thinkingConfig: z4.object({
@@ -543,7 +543,12 @@ function prepareTools({
543
543
  var _a;
544
544
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
545
545
  const toolWarnings = [];
546
- const isGemini2 = modelId.includes("gemini-2");
546
+ const isLatest = [
547
+ "gemini-flash-latest",
548
+ "gemini-flash-lite-latest",
549
+ "gemini-pro-latest"
550
+ ].some((id) => id === modelId);
551
+ const isGemini2 = modelId.includes("gemini-2") || isLatest;
547
552
  const supportsDynamicRetrieval = modelId.includes("gemini-1.5-flash") && !modelId.includes("-8b");
548
553
  if (tools == null) {
549
554
  return { tools: void 0, toolConfig: void 0, toolWarnings };
@@ -704,7 +709,7 @@ function mapGoogleGenerativeAIFinishReason({
704
709
 
705
710
  // src/tool/google-search.ts
706
711
  import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
707
- import { z as z5 } from "zod/v4";
712
+ import * as z5 from "zod/v4";
708
713
  var groundingChunkSchema = z5.object({
709
714
  web: z5.object({ uri: z5.string(), title: z5.string() }).nullish(),
710
715
  retrievedContext: z5.object({ uri: z5.string(), title: z5.string() }).nullish()
@@ -746,7 +751,7 @@ var googleSearch = createProviderDefinedToolFactory({
746
751
 
747
752
  // src/tool/url-context.ts
748
753
  import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
749
- import { z as z6 } from "zod/v4";
754
+ import * as z6 from "zod/v4";
750
755
  var urlMetadataSchema = z6.object({
751
756
  retrievedUrl: z6.string(),
752
757
  urlRetrievalStatus: z6.string()
@@ -1338,7 +1343,7 @@ var chunkSchema = z7.object({
1338
1343
 
1339
1344
  // src/tool/code-execution.ts
1340
1345
  import { createProviderDefinedToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
1341
- import { z as z8 } from "zod/v4";
1346
+ import * as z8 from "zod/v4";
1342
1347
  var codeExecution = createProviderDefinedToolFactoryWithOutputSchema({
1343
1348
  id: "google.code_execution",
1344
1349
  name: "code_execution",
@@ -1385,7 +1390,7 @@ import {
1385
1390
  postJsonToApi as postJsonToApi3,
1386
1391
  resolve as resolve3
1387
1392
  } from "@ai-sdk/provider-utils";
1388
- import { z as z9 } from "zod/v4";
1393
+ import * as z9 from "zod/v4";
1389
1394
  var GoogleGenerativeAIImageModel = class {
1390
1395
  constructor(modelId, settings, config) {
1391
1396
  this.modelId = modelId;