@depup/ai-sdk__google 4.0.74-depup.0 → 4.0.75-depup.0

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,15 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 4.0.75
4
+
5
+ ### Patch Changes
6
+
7
+ - e369c4d: fix(google): advertise the supported Gemini image per-call limit
8
+ - 2b391f8: fix(google): ignore default prompt block reasons in non-streaming responses
9
+ - 1284569: fix(google): include tool-use prompt tokens in input usage
10
+ - Updated dependencies [0455398]
11
+ - @ai-sdk/provider-utils@5.0.44
12
+
3
13
  ## 4.0.74
4
14
 
5
15
  ### Patch Changes
package/README.md CHANGED
@@ -13,8 +13,8 @@ npm install @depup/ai-sdk__google
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [@ai-sdk/google](https://www.npmjs.com/package/@ai-sdk/google) @ 4.0.74 |
17
- | Processed | 2026-09-17 |
16
+ | Original | [@ai-sdk/google](https://www.npmjs.com/package/@ai-sdk/google) @ 4.0.75 |
17
+ | Processed | 2026-09-18 |
18
18
  | Smoke test | failed |
19
19
  | Deps updated | 0 |
20
20
 
package/changes.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "bumped": {},
3
- "timestamp": "2026-09-17T00:30:59.000Z",
3
+ "timestamp": "2026-09-18T08:11:03.559Z",
4
4
  "totalUpdated": 0
5
5
  }
package/dist/index.d.ts CHANGED
@@ -559,7 +559,7 @@ declare const googleTools: {
559
559
  type GoogleImageModelId = 'gemini-2.5-flash-image' | 'gemini-3-pro-image-preview' | 'gemini-3.1-flash-image-preview' | (string & {});
560
560
  interface GoogleImageSettings {
561
561
  /**
562
- * Override the maximum number of images per call (default 10)
562
+ * Override the maximum number of images per call (default 1)
563
563
  */
564
564
  maxImagesPerCall?: number;
565
565
  }
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  import { Experimental_EvaluationLanguageModel as EvaluationLanguageModel } from "@ai-sdk/provider-utils/experimental-evaluation";
9
9
 
10
10
  // src/version.ts
11
- var VERSION = true ? "4.0.74" : "0.0.0-test";
11
+ var VERSION = true ? "4.0.75" : "0.0.0-test";
12
12
 
13
13
  // src/google-embedding-model.ts
14
14
  import {
@@ -306,18 +306,20 @@ import { z as z5 } from "zod/v4";
306
306
  // src/convert-google-usage.ts
307
307
  import { createNullLanguageModelUsage } from "@ai-sdk/provider-utils";
308
308
  function convertGoogleUsage(usage) {
309
- var _a, _b, _c, _d;
309
+ var _a, _b, _c, _d, _e;
310
310
  if (usage == null) {
311
311
  return createNullLanguageModelUsage();
312
312
  }
313
313
  const promptTokens = (_a = usage.promptTokenCount) != null ? _a : 0;
314
314
  const candidatesTokens = (_b = usage.candidatesTokenCount) != null ? _b : 0;
315
- const cachedContentTokens = (_c = usage.cachedContentTokenCount) != null ? _c : 0;
316
- const thoughtsTokens = (_d = usage.thoughtsTokenCount) != null ? _d : 0;
315
+ const toolUsePromptTokens = (_c = usage.toolUsePromptTokenCount) != null ? _c : 0;
316
+ const cachedContentTokens = (_d = usage.cachedContentTokenCount) != null ? _d : 0;
317
+ const thoughtsTokens = (_e = usage.thoughtsTokenCount) != null ? _e : 0;
318
+ const inputTokens = promptTokens + toolUsePromptTokens;
317
319
  return {
318
320
  inputTokens: {
319
- total: promptTokens,
320
- noCache: promptTokens - cachedContentTokens,
321
+ total: inputTokens,
322
+ noCache: inputTokens - cachedContentTokens,
321
323
  cacheRead: cachedContentTokens,
322
324
  cacheWrite: void 0
323
325
  },
@@ -1900,27 +1902,30 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1900
1902
  providerOptionsNames,
1901
1903
  toolNameMapping
1902
1904
  }) {
1903
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
1905
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
1904
1906
  const wrapProviderMetadata = (payload) => Object.fromEntries(
1905
1907
  providerOptionsNames.map((name) => [name, payload])
1906
1908
  );
1907
1909
  const candidate = (_a = response.candidates) == null ? void 0 : _a[0];
1908
1910
  const promptBlockReason = (_b = response.promptFeedback) == null ? void 0 : _b.blockReason;
1909
- const isPromptBlocked = (candidate == null ? void 0 : candidate.finishReason) == null && promptBlockReason != null;
1910
- const rawFinishReason = (_d = (_c = candidate == null ? void 0 : candidate.finishReason) != null ? _c : promptBlockReason) != null ? _d : void 0;
1911
+ const confirmedPromptBlockReason = isConfirmedPromptBlockReason(
1912
+ promptBlockReason
1913
+ ) ? promptBlockReason : void 0;
1914
+ const isPromptBlocked = (candidate == null ? void 0 : candidate.finishReason) == null && confirmedPromptBlockReason != null;
1915
+ const rawFinishReason = (_c = candidate == null ? void 0 : candidate.finishReason) != null ? _c : confirmedPromptBlockReason;
1911
1916
  const content = [];
1912
- const parts = (_f = (_e = candidate == null ? void 0 : candidate.content) == null ? void 0 : _e.parts) != null ? _f : [];
1917
+ const parts = (_e = (_d = candidate == null ? void 0 : candidate.content) == null ? void 0 : _d.parts) != null ? _e : [];
1913
1918
  const usageMetadata = response.usageMetadata;
1914
1919
  let lastCodeExecutionToolCallId;
1915
1920
  let lastServerToolCallId;
1916
1921
  for (const part of parts) {
1917
- if ("executableCode" in part && ((_g = part.executableCode) == null ? void 0 : _g.code)) {
1922
+ if ("executableCode" in part && ((_f = part.executableCode) == null ? void 0 : _f.code)) {
1918
1923
  const toolCallId = config.generateId();
1919
1924
  lastCodeExecutionToolCallId = toolCallId;
1920
1925
  content.push({
1921
1926
  type: "tool-call",
1922
1927
  toolCallId,
1923
- toolName: (_h = toolNameMapping == null ? void 0 : toolNameMapping.toCustomToolName("code_execution")) != null ? _h : "code_execution",
1928
+ toolName: (_g = toolNameMapping == null ? void 0 : toolNameMapping.toCustomToolName("code_execution")) != null ? _g : "code_execution",
1924
1929
  input: JSON.stringify(part.executableCode),
1925
1930
  providerExecuted: true
1926
1931
  });
@@ -1929,10 +1934,10 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1929
1934
  type: "tool-result",
1930
1935
  // Results correspond to the most recent executable code part.
1931
1936
  toolCallId: lastCodeExecutionToolCallId,
1932
- toolName: (_i = toolNameMapping == null ? void 0 : toolNameMapping.toCustomToolName("code_execution")) != null ? _i : "code_execution",
1937
+ toolName: (_h = toolNameMapping == null ? void 0 : toolNameMapping.toCustomToolName("code_execution")) != null ? _h : "code_execution",
1933
1938
  result: {
1934
1939
  outcome: part.codeExecutionResult.outcome,
1935
- output: (_j = part.codeExecutionResult.output) != null ? _j : ""
1940
+ output: (_i = part.codeExecutionResult.output) != null ? _i : ""
1936
1941
  }
1937
1942
  });
1938
1943
  } else if ("text" in part && part.text != null) {
@@ -1956,7 +1961,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1956
1961
  type: "tool-call",
1957
1962
  toolCallId: part.functionCall.id || config.generateId(),
1958
1963
  toolName: part.functionCall.name,
1959
- input: JSON.stringify((_k = part.functionCall.args) != null ? _k : {}),
1964
+ input: JSON.stringify((_j = part.functionCall.args) != null ? _j : {}),
1960
1965
  providerMetadata: part.thoughtSignature ? wrapProviderMetadata({
1961
1966
  thoughtSignature: part.thoughtSignature
1962
1967
  }) : void 0
@@ -1979,7 +1984,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1979
1984
  type: "tool-call",
1980
1985
  toolCallId,
1981
1986
  toolName: `server:${part.toolCall.toolType}`,
1982
- input: JSON.stringify((_l = part.toolCall.args) != null ? _l : {}),
1987
+ input: JSON.stringify((_k = part.toolCall.args) != null ? _k : {}),
1983
1988
  providerExecuted: true,
1984
1989
  dynamic: true,
1985
1990
  providerMetadata: part.thoughtSignature ? wrapProviderMetadata({
@@ -1997,7 +2002,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1997
2002
  type: "tool-result",
1998
2003
  toolCallId: responseToolCallId,
1999
2004
  toolName: `server:${part.toolResponse.toolType}`,
2000
- result: (_m = part.toolResponse.response) != null ? _m : {},
2005
+ result: (_l = part.toolResponse.response) != null ? _l : {},
2001
2006
  providerMetadata: part.thoughtSignature ? wrapProviderMetadata({
2002
2007
  thoughtSignature: part.thoughtSignature,
2003
2008
  serverToolCallId: responseToolCallId,
@@ -2010,10 +2015,10 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2010
2015
  lastServerToolCallId = void 0;
2011
2016
  }
2012
2017
  }
2013
- const sources = (_n = extractSources({
2018
+ const sources = (_m = extractSources({
2014
2019
  groundingMetadata: candidate == null ? void 0 : candidate.groundingMetadata,
2015
2020
  generateId: config.generateId
2016
- })) != null ? _n : [];
2021
+ })) != null ? _m : [];
2017
2022
  for (const source of sources) {
2018
2023
  content.push(source);
2019
2024
  }
@@ -2032,17 +2037,17 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2032
2037
  usage: convertGoogleUsage(usageMetadata),
2033
2038
  warnings,
2034
2039
  providerMetadata: wrapProviderMetadata({
2035
- promptFeedback: (_o = response.promptFeedback) != null ? _o : null,
2036
- groundingMetadata: (_p = candidate == null ? void 0 : candidate.groundingMetadata) != null ? _p : null,
2037
- urlContextMetadata: (_q = candidate == null ? void 0 : candidate.urlContextMetadata) != null ? _q : null,
2038
- safetyRatings: (_r = candidate == null ? void 0 : candidate.safetyRatings) != null ? _r : null,
2040
+ promptFeedback: (_n = response.promptFeedback) != null ? _n : null,
2041
+ groundingMetadata: (_o = candidate == null ? void 0 : candidate.groundingMetadata) != null ? _o : null,
2042
+ urlContextMetadata: (_p = candidate == null ? void 0 : candidate.urlContextMetadata) != null ? _p : null,
2043
+ safetyRatings: (_q = candidate == null ? void 0 : candidate.safetyRatings) != null ? _q : null,
2039
2044
  usageMetadata: usageMetadata != null ? usageMetadata : null,
2040
- finishMessage: (_s = candidate == null ? void 0 : candidate.finishMessage) != null ? _s : null,
2041
- serviceTier: (_t = usageMetadata == null ? void 0 : usageMetadata.serviceTier) != null ? _t : null
2045
+ finishMessage: (_r = candidate == null ? void 0 : candidate.finishMessage) != null ? _r : null,
2046
+ serviceTier: (_s = usageMetadata == null ? void 0 : usageMetadata.serviceTier) != null ? _s : null
2042
2047
  }),
2043
2048
  response: {
2044
2049
  // TODO timestamp, model id
2045
- id: (_u = response.responseId) != null ? _u : void 0
2050
+ id: (_t = response.responseId) != null ? _t : void 0
2046
2051
  }
2047
2052
  };
2048
2053
  }
@@ -3857,7 +3862,7 @@ var GoogleImageModel = class _GoogleImageModel {
3857
3862
  if (this.settings.maxImagesPerCall != null) {
3858
3863
  return this.settings.maxImagesPerCall;
3859
3864
  }
3860
- return 10;
3865
+ return 1;
3861
3866
  }
3862
3867
  get provider() {
3863
3868
  return this.config.provider;
@@ -3871,7 +3876,6 @@ var GoogleImageModel = class _GoogleImageModel {
3871
3876
  }
3872
3877
  const {
3873
3878
  prompt,
3874
- n,
3875
3879
  size,
3876
3880
  aspectRatio,
3877
3881
  seed,
@@ -3887,11 +3891,6 @@ var GoogleImageModel = class _GoogleImageModel {
3887
3891
  "Gemini image models do not support mask-based image editing."
3888
3892
  );
3889
3893
  }
3890
- if (n != null && n > 1) {
3891
- throw new Error(
3892
- "Gemini image models do not support generating a set number of images per call. Use n=1 or omit the n parameter."
3893
- );
3894
- }
3895
3894
  if (size != null) {
3896
3895
  warnings.push({
3897
3896
  type: "unsupported",