@ai-sdk/google 3.0.21 → 3.0.23

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,22 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 3.0.23
4
+
5
+ ### Patch Changes
6
+
7
+ - ba98c56: fix(google): make `codeExecutionResult.output` optional in response schema
8
+
9
+ Gemini 3 Flash omits the `output` field in `codeExecutionResult` when code execution produces no text output (e.g., only saves files). The Zod response schema now accepts a missing `output` field and defaults it to an empty string.
10
+
11
+ ## 3.0.22
12
+
13
+ ### Patch Changes
14
+
15
+ - 7168375: feat (ai, provider): default global provider video model resolution
16
+ - Updated dependencies [7168375]
17
+ - @ai-sdk/provider@3.0.8
18
+ - @ai-sdk/provider-utils@4.0.14
19
+
3
20
  ## 3.0.21
4
21
 
5
22
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
2
  import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
3
- import { ProviderV3, LanguageModelV3, ImageModelV3, Experimental_VideoModelV3, EmbeddingModelV3 } from '@ai-sdk/provider';
3
+ import { ProviderV3, LanguageModelV3, ImageModelV3, EmbeddingModelV3, Experimental_VideoModelV3 } from '@ai-sdk/provider';
4
4
 
5
5
  declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
6
6
  error: {
@@ -64,7 +64,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
64
64
  } | null | undefined;
65
65
  codeExecutionResult?: {
66
66
  outcome: string;
67
- output: string;
67
+ output?: string | null | undefined;
68
68
  } | null | undefined;
69
69
  text?: string | null | undefined;
70
70
  thought?: boolean | null | undefined;
@@ -279,10 +279,6 @@ interface GoogleGenerativeAIProvider extends ProviderV3 {
279
279
  * Creates a model for image generation.
280
280
  */
281
281
  image(modelId: GoogleGenerativeAIImageModelId, settings?: GoogleGenerativeAIImageSettings): ImageModelV3;
282
- /**
283
- * Creates a model for video generation.
284
- */
285
- video(modelId: GoogleGenerativeAIVideoModelId): Experimental_VideoModelV3;
286
282
  /**
287
283
  * @deprecated Use `chat()` instead.
288
284
  */
@@ -303,6 +299,14 @@ interface GoogleGenerativeAIProvider extends ProviderV3 {
303
299
  * @deprecated Use `embeddingModel` instead.
304
300
  */
305
301
  textEmbeddingModel(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV3;
302
+ /**
303
+ * Creates a model for video generation.
304
+ */
305
+ video(modelId: GoogleGenerativeAIVideoModelId): Experimental_VideoModelV3;
306
+ /**
307
+ * Creates a model for video generation.
308
+ */
309
+ videoModel(modelId: GoogleGenerativeAIVideoModelId): Experimental_VideoModelV3;
306
310
  tools: typeof googleTools;
307
311
  }
308
312
  interface GoogleGenerativeAIProviderSettings {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
2
  import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
3
- import { ProviderV3, LanguageModelV3, ImageModelV3, Experimental_VideoModelV3, EmbeddingModelV3 } from '@ai-sdk/provider';
3
+ import { ProviderV3, LanguageModelV3, ImageModelV3, EmbeddingModelV3, Experimental_VideoModelV3 } from '@ai-sdk/provider';
4
4
 
5
5
  declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
6
6
  error: {
@@ -64,7 +64,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
64
64
  } | null | undefined;
65
65
  codeExecutionResult?: {
66
66
  outcome: string;
67
- output: string;
67
+ output?: string | null | undefined;
68
68
  } | null | undefined;
69
69
  text?: string | null | undefined;
70
70
  thought?: boolean | null | undefined;
@@ -279,10 +279,6 @@ interface GoogleGenerativeAIProvider extends ProviderV3 {
279
279
  * Creates a model for image generation.
280
280
  */
281
281
  image(modelId: GoogleGenerativeAIImageModelId, settings?: GoogleGenerativeAIImageSettings): ImageModelV3;
282
- /**
283
- * Creates a model for video generation.
284
- */
285
- video(modelId: GoogleGenerativeAIVideoModelId): Experimental_VideoModelV3;
286
282
  /**
287
283
  * @deprecated Use `chat()` instead.
288
284
  */
@@ -303,6 +299,14 @@ interface GoogleGenerativeAIProvider extends ProviderV3 {
303
299
  * @deprecated Use `embeddingModel` instead.
304
300
  */
305
301
  textEmbeddingModel(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV3;
302
+ /**
303
+ * Creates a model for video generation.
304
+ */
305
+ video(modelId: GoogleGenerativeAIVideoModelId): Experimental_VideoModelV3;
306
+ /**
307
+ * Creates a model for video generation.
308
+ */
309
+ videoModel(modelId: GoogleGenerativeAIVideoModelId): Experimental_VideoModelV3;
306
310
  tools: typeof googleTools;
307
311
  }
308
312
  interface GoogleGenerativeAIProviderSettings {
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(src_exports);
30
30
  var import_provider_utils16 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/version.ts
33
- var VERSION = true ? "3.0.21" : "0.0.0-test";
33
+ var VERSION = true ? "3.0.23" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -1002,7 +1002,7 @@ var GoogleGenerativeAILanguageModel = class {
1002
1002
  };
1003
1003
  }
1004
1004
  async doGenerate(options) {
1005
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1005
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
1006
1006
  const { args, warnings, providerOptionsName } = await this.getArgs(options);
1007
1007
  const mergedHeaders = (0, import_provider_utils6.combineHeaders)(
1008
1008
  await (0, import_provider_utils6.resolve)(this.config.headers),
@@ -1047,7 +1047,7 @@ var GoogleGenerativeAILanguageModel = class {
1047
1047
  toolName: "code_execution",
1048
1048
  result: {
1049
1049
  outcome: part.codeExecutionResult.outcome,
1050
- output: part.codeExecutionResult.output
1050
+ output: (_d = part.codeExecutionResult.output) != null ? _d : ""
1051
1051
  }
1052
1052
  });
1053
1053
  lastCodeExecutionToolCallId = void 0;
@@ -1086,10 +1086,10 @@ var GoogleGenerativeAILanguageModel = class {
1086
1086
  });
1087
1087
  }
1088
1088
  }
1089
- const sources = (_d = extractSources({
1089
+ const sources = (_e = extractSources({
1090
1090
  groundingMetadata: candidate.groundingMetadata,
1091
1091
  generateId: this.config.generateId
1092
- })) != null ? _d : [];
1092
+ })) != null ? _e : [];
1093
1093
  for (const source of sources) {
1094
1094
  content.push(source);
1095
1095
  }
@@ -1103,16 +1103,16 @@ var GoogleGenerativeAILanguageModel = class {
1103
1103
  (part) => part.type === "tool-call" && !part.providerExecuted
1104
1104
  )
1105
1105
  }),
1106
- raw: (_e = candidate.finishReason) != null ? _e : void 0
1106
+ raw: (_f = candidate.finishReason) != null ? _f : void 0
1107
1107
  },
1108
1108
  usage: convertGoogleGenerativeAIUsage(usageMetadata),
1109
1109
  warnings,
1110
1110
  providerMetadata: {
1111
1111
  [providerOptionsName]: {
1112
- promptFeedback: (_f = response.promptFeedback) != null ? _f : null,
1113
- groundingMetadata: (_g = candidate.groundingMetadata) != null ? _g : null,
1114
- urlContextMetadata: (_h = candidate.urlContextMetadata) != null ? _h : null,
1115
- safetyRatings: (_i = candidate.safetyRatings) != null ? _i : null,
1112
+ promptFeedback: (_g = response.promptFeedback) != null ? _g : null,
1113
+ groundingMetadata: (_h = candidate.groundingMetadata) != null ? _h : null,
1114
+ urlContextMetadata: (_i = candidate.urlContextMetadata) != null ? _i : null,
1115
+ safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null,
1116
1116
  usageMetadata: usageMetadata != null ? usageMetadata : null
1117
1117
  }
1118
1118
  },
@@ -1161,7 +1161,7 @@ var GoogleGenerativeAILanguageModel = class {
1161
1161
  controller.enqueue({ type: "stream-start", warnings });
1162
1162
  },
1163
1163
  transform(chunk, controller) {
1164
- var _a, _b, _c, _d, _e, _f, _g;
1164
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1165
1165
  if (options.includeRawChunks) {
1166
1166
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
1167
1167
  }
@@ -1213,7 +1213,7 @@ var GoogleGenerativeAILanguageModel = class {
1213
1213
  toolName: "code_execution",
1214
1214
  result: {
1215
1215
  outcome: part.codeExecutionResult.outcome,
1216
- output: part.codeExecutionResult.output
1216
+ output: (_d = part.codeExecutionResult.output) != null ? _d : ""
1217
1217
  }
1218
1218
  });
1219
1219
  lastCodeExecutionToolCallId = void 0;
@@ -1333,10 +1333,10 @@ var GoogleGenerativeAILanguageModel = class {
1333
1333
  };
1334
1334
  providerMetadata = {
1335
1335
  [providerOptionsName]: {
1336
- promptFeedback: (_d = value.promptFeedback) != null ? _d : null,
1337
- groundingMetadata: (_e = candidate.groundingMetadata) != null ? _e : null,
1338
- urlContextMetadata: (_f = candidate.urlContextMetadata) != null ? _f : null,
1339
- safetyRatings: (_g = candidate.safetyRatings) != null ? _g : null
1336
+ promptFeedback: (_e = value.promptFeedback) != null ? _e : null,
1337
+ groundingMetadata: (_f = candidate.groundingMetadata) != null ? _f : null,
1338
+ urlContextMetadata: (_g = candidate.urlContextMetadata) != null ? _g : null,
1339
+ safetyRatings: (_h = candidate.safetyRatings) != null ? _h : null
1340
1340
  }
1341
1341
  };
1342
1342
  if (usageMetadata != null) {
@@ -1542,7 +1542,7 @@ var getContentSchema = () => import_v45.z.object({
1542
1542
  }).nullish(),
1543
1543
  codeExecutionResult: import_v45.z.object({
1544
1544
  outcome: import_v45.z.string(),
1545
- output: import_v45.z.string()
1545
+ output: import_v45.z.string().nullish()
1546
1546
  }).nullish(),
1547
1547
  text: import_v45.z.string().nullish(),
1548
1548
  thought: import_v45.z.boolean().nullish(),
@@ -2222,6 +2222,7 @@ function createGoogleGenerativeAI(options = {}) {
2222
2222
  provider.image = createImageModel;
2223
2223
  provider.imageModel = createImageModel;
2224
2224
  provider.video = createVideoModel;
2225
+ provider.videoModel = createVideoModel;
2225
2226
  provider.tools = googleTools;
2226
2227
  return provider;
2227
2228
  }