@ai-sdk/google 4.0.58 → 4.0.60

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,17 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 4.0.60
4
+
5
+ ### Patch Changes
6
+
7
+ - e07b577: feat: add tool calling support to batch
8
+
9
+ ## 4.0.59
10
+
11
+ ### Patch Changes
12
+
13
+ - ca29e9b: fix(google): support video response formats in Gemini Interactions
14
+
3
15
  ## 4.0.58
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -358,6 +358,14 @@ declare const googleInteractionsLanguageModelOptions: _ai_sdk_provider_utils.Laz
358
358
  [x: string]: unknown;
359
359
  type: "audio";
360
360
  mimeType?: string | null | undefined;
361
+ } | {
362
+ [x: string]: unknown;
363
+ type: "video";
364
+ aspectRatio?: "9:16" | "16:9" | null | undefined;
365
+ resolution?: "360p" | "720p" | "1080p" | "4k" | null | undefined;
366
+ duration?: string | null | undefined;
367
+ delivery?: "uri" | "inline" | null | undefined;
368
+ gcsUri?: string | null | undefined;
361
369
  })[] | null | undefined;
362
370
  imageConfig?: {
363
371
  aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "1:8" | "8:1" | "1:4" | "4:1" | null | undefined;
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.58" : "0.0.0-test";
10
+ var VERSION = true ? "4.0.60" : "0.0.0-test";
11
11
 
12
12
  // src/google-embedding-model.ts
13
13
  import {
@@ -3024,7 +3024,7 @@ var chunkSchema = lazySchema5(
3024
3024
  // src/google-batch.ts
3025
3025
  var googleBatchInputFileMaxBytes = 2 * 1024 * 1024 * 1024;
3026
3026
  var googleBatchInlineCreationMaxBytes = 2e7;
3027
- var supportedGoogleBatchContentTypes = /* @__PURE__ */ new Set(["text", "reasoning", "source"]);
3027
+ var supportedGoogleBatchContentTypes = /* @__PURE__ */ new Set(["text", "reasoning", "source", "tool-call", "tool-result"]);
3028
3028
  var googleRpcStatusSchema = z6.object({
3029
3029
  code: z6.union([z6.number(), z6.string()]).nullish(),
3030
3030
  message: z6.string().nullish(),
@@ -6212,8 +6212,8 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
6212
6212
  thinkingSummaries: z21.enum(["auto", "none"]).nullish(),
6213
6213
  /**
6214
6214
  * Output-format entries that map directly to the API's `response_format`
6215
- * array. Use this to request image, audio, or non-JSON text outputs
6216
- * with full control over `mime_type`, `aspect_ratio`, and `image_size`.
6215
+ * array. Use this to request image, audio, video, or non-JSON text
6216
+ * outputs with modality-specific controls.
6217
6217
  *
6218
6218
  * Entries are sent in order. The AI SDK call-level `responseFormat: {
6219
6219
  * type: 'json', schema }` still drives JSON-mode and adds a matching
@@ -6250,6 +6250,14 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
6250
6250
  z21.object({
6251
6251
  type: z21.literal("audio"),
6252
6252
  mimeType: z21.string().nullish()
6253
+ }).loose(),
6254
+ z21.object({
6255
+ type: z21.literal("video"),
6256
+ aspectRatio: z21.enum(["16:9", "9:16"]).nullish(),
6257
+ resolution: z21.enum(["360p", "720p", "1080p", "4k"]).nullish(),
6258
+ duration: z21.string().nullish(),
6259
+ delivery: z21.enum(["inline", "uri"]).nullish(),
6260
+ gcsUri: z21.string().nullish()
6253
6261
  }).loose()
6254
6262
  ])
6255
6263
  ).nullish(),
@@ -7157,7 +7165,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
7157
7165
  };
7158
7166
  }
7159
7167
  async getArgs(options) {
7160
- 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;
7168
+ 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;
7161
7169
  const warnings = [];
7162
7170
  const googleOptions = await parseProviderOptions7({
7163
7171
  provider: "google",
@@ -7233,6 +7241,17 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
7233
7241
  mime_type: (_g = entry.mimeType) != null ? _g : void 0
7234
7242
  })
7235
7243
  );
7244
+ } else if (entry.type === "video") {
7245
+ responseFormatEntries.push(
7246
+ pruneUndefined({
7247
+ type: "video",
7248
+ aspect_ratio: (_h = entry.aspectRatio) != null ? _h : void 0,
7249
+ resolution: (_i = entry.resolution) != null ? _i : void 0,
7250
+ duration: (_j = entry.duration) != null ? _j : void 0,
7251
+ delivery: (_k = entry.delivery) != null ? _k : void 0,
7252
+ gcs_uri: (_l = entry.gcsUri) != null ? _l : void 0
7253
+ })
7254
+ );
7236
7255
  }
7237
7256
  }
7238
7257
  }
@@ -7242,13 +7261,13 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
7242
7261
  warnings: convWarnings
7243
7262
  } = convertToGoogleInteractionsInput({
7244
7263
  prompt: options.prompt,
7245
- previousInteractionId: (_h = googleOptions == null ? void 0 : googleOptions.previousInteractionId) != null ? _h : void 0,
7246
- store: (_i = googleOptions == null ? void 0 : googleOptions.store) != null ? _i : void 0,
7247
- mediaResolution: (_j = googleOptions == null ? void 0 : googleOptions.mediaResolution) != null ? _j : void 0
7264
+ previousInteractionId: (_m = googleOptions == null ? void 0 : googleOptions.previousInteractionId) != null ? _m : void 0,
7265
+ store: (_n = googleOptions == null ? void 0 : googleOptions.store) != null ? _n : void 0,
7266
+ mediaResolution: (_o = googleOptions == null ? void 0 : googleOptions.mediaResolution) != null ? _o : void 0
7248
7267
  });
7249
7268
  warnings.push(...convWarnings);
7250
7269
  let systemInstruction = convertedSystemInstruction;
7251
- const optionSystemInstruction = (_k = googleOptions == null ? void 0 : googleOptions.systemInstruction) != null ? _k : void 0;
7270
+ const optionSystemInstruction = (_p = googleOptions == null ? void 0 : googleOptions.systemInstruction) != null ? _p : void 0;
7252
7271
  if (systemInstruction != null && optionSystemInstruction != null) {
7253
7272
  warnings.push({
7254
7273
  type: "other",
@@ -7288,14 +7307,14 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
7288
7307
  generationConfig = void 0;
7289
7308
  } else {
7290
7309
  generationConfig = pruneUndefined({
7291
- temperature: (_l = options.temperature) != null ? _l : void 0,
7292
- top_p: (_m = options.topP) != null ? _m : void 0,
7293
- top_k: (_n = options.topK) != null ? _n : void 0,
7294
- seed: (_o = options.seed) != null ? _o : void 0,
7310
+ temperature: (_q = options.temperature) != null ? _q : void 0,
7311
+ top_p: (_r = options.topP) != null ? _r : void 0,
7312
+ top_k: (_s = options.topK) != null ? _s : void 0,
7313
+ seed: (_t = options.seed) != null ? _t : void 0,
7295
7314
  stop_sequences: options.stopSequences != null && options.stopSequences.length > 0 ? options.stopSequences : void 0,
7296
- max_output_tokens: (_p = options.maxOutputTokens) != null ? _p : void 0,
7297
- thinking_level: (_q = googleOptions == null ? void 0 : googleOptions.thinkingLevel) != null ? _q : void 0,
7298
- thinking_summaries: (_r = googleOptions == null ? void 0 : googleOptions.thinkingSummaries) != null ? _r : void 0,
7315
+ max_output_tokens: (_u = options.maxOutputTokens) != null ? _u : void 0,
7316
+ thinking_level: (_v = googleOptions == null ? void 0 : googleOptions.thinkingLevel) != null ? _v : void 0,
7317
+ thinking_summaries: (_w = googleOptions == null ? void 0 : googleOptions.thinkingSummaries) != null ? _w : void 0,
7299
7318
  tool_choice: toolChoiceForBody
7300
7319
  });
7301
7320
  if ((googleOptions == null ? void 0 : googleOptions.imageConfig) != null) {
@@ -7322,9 +7341,9 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
7322
7341
  if (agentConfigOptions.type === "deep-research") {
7323
7342
  agentConfig = pruneUndefined({
7324
7343
  type: "deep-research",
7325
- thinking_summaries: (_s = agentConfigOptions.thinkingSummaries) != null ? _s : void 0,
7326
- visualization: (_t = agentConfigOptions.visualization) != null ? _t : void 0,
7327
- collaborative_planning: (_u = agentConfigOptions.collaborativePlanning) != null ? _u : void 0
7344
+ thinking_summaries: (_x = agentConfigOptions.thinkingSummaries) != null ? _x : void 0,
7345
+ visualization: (_y = agentConfigOptions.visualization) != null ? _y : void 0,
7346
+ collaborative_planning: (_z = agentConfigOptions.collaborativePlanning) != null ? _z : void 0
7328
7347
  });
7329
7348
  } else if (agentConfigOptions.type === "dynamic") {
7330
7349
  agentConfig = { type: "dynamic" };
@@ -7341,7 +7360,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
7341
7360
  environment = googleOptions.environment;
7342
7361
  } else {
7343
7362
  const environmentOptions = googleOptions.environment;
7344
- const sources = (_v = environmentOptions.sources) == null ? void 0 : _v.map((source) => {
7363
+ const sources = (_A = environmentOptions.sources) == null ? void 0 : _A.map((source) => {
7345
7364
  var _a2;
7346
7365
  if (source.type === "inline") {
7347
7366
  return {
@@ -7386,20 +7405,20 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
7386
7405
  tools: toolsForBody,
7387
7406
  response_format: responseFormatEntries.length > 0 ? responseFormatEntries : void 0,
7388
7407
  response_modalities: (googleOptions == null ? void 0 : googleOptions.responseModalities) != null ? googleOptions.responseModalities : void 0,
7389
- previous_interaction_id: (_w = googleOptions == null ? void 0 : googleOptions.previousInteractionId) != null ? _w : void 0,
7390
- service_tier: (_x = googleOptions == null ? void 0 : googleOptions.serviceTier) != null ? _x : void 0,
7391
- store: (_y = googleOptions == null ? void 0 : googleOptions.store) != null ? _y : void 0,
7408
+ previous_interaction_id: (_B = googleOptions == null ? void 0 : googleOptions.previousInteractionId) != null ? _B : void 0,
7409
+ service_tier: (_C = googleOptions == null ? void 0 : googleOptions.serviceTier) != null ? _C : void 0,
7410
+ store: (_D = googleOptions == null ? void 0 : googleOptions.store) != null ? _D : void 0,
7392
7411
  generation_config: generationConfig != null && Object.keys(generationConfig).length > 0 ? generationConfig : void 0,
7393
7412
  agent_config: agentConfig,
7394
7413
  environment,
7395
- background: (_z = googleOptions == null ? void 0 : googleOptions.background) != null ? _z : void 0
7414
+ background: (_E = googleOptions == null ? void 0 : googleOptions.background) != null ? _E : void 0
7396
7415
  });
7397
7416
  return {
7398
7417
  args,
7399
7418
  warnings,
7400
7419
  isAgent,
7401
7420
  isBackground: (googleOptions == null ? void 0 : googleOptions.background) === true,
7402
- pollingTimeoutMs: (_A = googleOptions == null ? void 0 : googleOptions.pollingTimeoutMs) != null ? _A : void 0
7421
+ pollingTimeoutMs: (_F = googleOptions == null ? void 0 : googleOptions.pollingTimeoutMs) != null ? _F : void 0
7403
7422
  };
7404
7423
  }
7405
7424
  async doGenerate(options) {