@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 +10 -0
- package/README.md +2 -2
- package/changes.json +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +32 -33
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +30 -25
- package/dist/internal/index.js.map +1 -1
- package/docs/15-google.mdx +2 -2
- package/package.json +4 -4
- package/src/convert-google-usage.ts +4 -2
- package/src/google-image-model.ts +1 -9
- package/src/google-image-settings.ts +1 -1
- package/src/google-language-model.ts +7 -2
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.
|
|
17
|
-
| Processed | 2026-09-
|
|
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
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
|
|
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.
|
|
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
|
|
316
|
-
const
|
|
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:
|
|
320
|
-
noCache:
|
|
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
|
|
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
|
|
1910
|
-
|
|
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 = (
|
|
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 && ((
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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((
|
|
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((
|
|
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: (
|
|
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 = (
|
|
2018
|
+
const sources = (_m = extractSources({
|
|
2014
2019
|
groundingMetadata: candidate == null ? void 0 : candidate.groundingMetadata,
|
|
2015
2020
|
generateId: config.generateId
|
|
2016
|
-
})) != null ?
|
|
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: (
|
|
2036
|
-
groundingMetadata: (
|
|
2037
|
-
urlContextMetadata: (
|
|
2038
|
-
safetyRatings: (
|
|
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: (
|
|
2041
|
-
serviceTier: (
|
|
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: (
|
|
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
|
|
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",
|