@depup/ai-sdk__google 4.0.68-depup.0 → 4.0.69-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 +6 -0
- package/README.md +1 -1
- package/changes.json +1 -1
- package/dist/index.js +108 -16
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +7 -1
- package/dist/internal/index.js +107 -15
- package/dist/internal/index.js.map +1 -1
- package/package.json +3 -3
- package/src/download-tool-result-files.ts +124 -0
- package/src/google-language-model.ts +27 -8
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ 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.
|
|
16
|
+
| Original | [@ai-sdk/google](https://www.npmjs.com/package/@ai-sdk/google) @ 4.0.69 |
|
|
17
17
|
| Processed | 2026-09-12 |
|
|
18
18
|
| Smoke test | failed |
|
|
19
19
|
| Deps updated | 0 |
|
package/changes.json
CHANGED
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.
|
|
10
|
+
var VERSION = true ? "4.0.69" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -1070,6 +1070,90 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
1070
1070
|
};
|
|
1071
1071
|
}
|
|
1072
1072
|
|
|
1073
|
+
// src/download-tool-result-files.ts
|
|
1074
|
+
import {
|
|
1075
|
+
detectMediaType,
|
|
1076
|
+
downloadBlob,
|
|
1077
|
+
isFullMediaType as isFullMediaType2
|
|
1078
|
+
} from "@ai-sdk/provider-utils";
|
|
1079
|
+
async function downloadToolResultFiles(prompt, {
|
|
1080
|
+
abortSignal,
|
|
1081
|
+
maxBytes
|
|
1082
|
+
}) {
|
|
1083
|
+
const result = [];
|
|
1084
|
+
for (const message of prompt) {
|
|
1085
|
+
if (message.role === "assistant") {
|
|
1086
|
+
const content = [];
|
|
1087
|
+
for (const part of message.content) {
|
|
1088
|
+
content.push(
|
|
1089
|
+
part.type === "tool-result" ? {
|
|
1090
|
+
...part,
|
|
1091
|
+
output: await downloadToolResultOutput(part.output, {
|
|
1092
|
+
abortSignal,
|
|
1093
|
+
maxBytes
|
|
1094
|
+
})
|
|
1095
|
+
} : part
|
|
1096
|
+
);
|
|
1097
|
+
}
|
|
1098
|
+
result.push({ ...message, content });
|
|
1099
|
+
continue;
|
|
1100
|
+
}
|
|
1101
|
+
if (message.role === "tool") {
|
|
1102
|
+
const content = [];
|
|
1103
|
+
for (const part of message.content) {
|
|
1104
|
+
if (part.type !== "tool-result") {
|
|
1105
|
+
content.push(part);
|
|
1106
|
+
continue;
|
|
1107
|
+
}
|
|
1108
|
+
content.push({
|
|
1109
|
+
...part,
|
|
1110
|
+
output: await downloadToolResultOutput(part.output, {
|
|
1111
|
+
abortSignal,
|
|
1112
|
+
maxBytes
|
|
1113
|
+
})
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
result.push({ ...message, content });
|
|
1117
|
+
continue;
|
|
1118
|
+
}
|
|
1119
|
+
result.push(message);
|
|
1120
|
+
}
|
|
1121
|
+
return result;
|
|
1122
|
+
}
|
|
1123
|
+
async function downloadToolResultOutput(output, {
|
|
1124
|
+
abortSignal,
|
|
1125
|
+
maxBytes
|
|
1126
|
+
}) {
|
|
1127
|
+
if (output.type !== "content") {
|
|
1128
|
+
return output;
|
|
1129
|
+
}
|
|
1130
|
+
const value = [];
|
|
1131
|
+
for (const part of output.value) {
|
|
1132
|
+
if (part.type !== "file" || part.data.type !== "url") {
|
|
1133
|
+
value.push(part);
|
|
1134
|
+
continue;
|
|
1135
|
+
}
|
|
1136
|
+
const blob = await downloadBlob(part.data.url.toString(), {
|
|
1137
|
+
abortSignal,
|
|
1138
|
+
maxBytes
|
|
1139
|
+
});
|
|
1140
|
+
const data = new Uint8Array(await blob.arrayBuffer());
|
|
1141
|
+
const detectedMediaType = detectMediaType({
|
|
1142
|
+
data,
|
|
1143
|
+
topLevelType: "image"
|
|
1144
|
+
});
|
|
1145
|
+
value.push({
|
|
1146
|
+
...part,
|
|
1147
|
+
data: { type: "data", data },
|
|
1148
|
+
mediaType: detectedMediaType != null ? detectedMediaType : blob.type && !isFullMediaType2(part.mediaType) ? blob.type : part.mediaType
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
return {
|
|
1152
|
+
...output,
|
|
1153
|
+
value
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1073
1157
|
// src/google-language-model-options.ts
|
|
1074
1158
|
import {
|
|
1075
1159
|
lazySchema as lazySchema4,
|
|
@@ -1858,7 +1942,8 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1858
1942
|
tools,
|
|
1859
1943
|
toolChoice,
|
|
1860
1944
|
reasoning,
|
|
1861
|
-
providerOptions
|
|
1945
|
+
providerOptions,
|
|
1946
|
+
abortSignal
|
|
1862
1947
|
},
|
|
1863
1948
|
isStreaming = false
|
|
1864
1949
|
}) {
|
|
@@ -1955,14 +2040,21 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1955
2040
|
});
|
|
1956
2041
|
}
|
|
1957
2042
|
const { usesGemini3Features } = getGoogleModelCapabilities(modelId);
|
|
1958
|
-
const
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
2043
|
+
const promptWithDownloadedToolResultFiles = config.downloadToolResultFiles ? await downloadToolResultFiles(prompt, {
|
|
2044
|
+
abortSignal,
|
|
2045
|
+
maxBytes: config.downloadToolResultFiles.maxBytes
|
|
2046
|
+
}) : prompt;
|
|
2047
|
+
const { contents, systemInstruction } = convertToGoogleMessages(
|
|
2048
|
+
promptWithDownloadedToolResultFiles,
|
|
2049
|
+
{
|
|
2050
|
+
isGemmaModel,
|
|
2051
|
+
isGemini3Model: usesGemini3Features,
|
|
2052
|
+
onWarning: (warning) => warnings.push(warning),
|
|
2053
|
+
providerOptionsNames,
|
|
2054
|
+
supportsFunctionResponseParts: usesGemini3Features,
|
|
2055
|
+
includeFunctionCallIds: !isVertexProvider
|
|
2056
|
+
}
|
|
2057
|
+
);
|
|
1966
2058
|
const {
|
|
1967
2059
|
tools: googleTools2,
|
|
1968
2060
|
toolConfig: googleToolConfig,
|
|
@@ -5758,7 +5850,7 @@ function buildGoogleInteractionsStreamTransform({
|
|
|
5758
5850
|
import {
|
|
5759
5851
|
convertToBase64 as convertToBase644,
|
|
5760
5852
|
getTopLevelMediaType as getTopLevelMediaType2,
|
|
5761
|
-
isFullMediaType as
|
|
5853
|
+
isFullMediaType as isFullMediaType3,
|
|
5762
5854
|
resolveFullMediaType as resolveFullMediaType2,
|
|
5763
5855
|
resolveProviderReference as resolveProviderReference2,
|
|
5764
5856
|
secureJsonParse as secureJsonParse2
|
|
@@ -5967,7 +6059,7 @@ function convertFilePartToContent({
|
|
|
5967
6059
|
return {
|
|
5968
6060
|
type: kind,
|
|
5969
6061
|
uri: part.data.url.toString(),
|
|
5970
|
-
...
|
|
6062
|
+
...isFullMediaType3(part.mediaType) ? { mime_type: part.mediaType } : {},
|
|
5971
6063
|
...resolutionField,
|
|
5972
6064
|
...processingField
|
|
5973
6065
|
};
|
|
@@ -5980,7 +6072,7 @@ function convertFilePartToContent({
|
|
|
5980
6072
|
return {
|
|
5981
6073
|
type: kind,
|
|
5982
6074
|
uri,
|
|
5983
|
-
...
|
|
6075
|
+
...isFullMediaType3(part.mediaType) ? { mime_type: part.mediaType } : {},
|
|
5984
6076
|
...resolutionField,
|
|
5985
6077
|
...processingField
|
|
5986
6078
|
};
|
|
@@ -6135,7 +6227,7 @@ function filePartToImageBlock({
|
|
|
6135
6227
|
}) {
|
|
6136
6228
|
switch (part.data.type) {
|
|
6137
6229
|
case "data": {
|
|
6138
|
-
const mimeType =
|
|
6230
|
+
const mimeType = isFullMediaType3(part.mediaType) ? part.mediaType : resolveFullMediaType2({
|
|
6139
6231
|
part: {
|
|
6140
6232
|
type: "file",
|
|
6141
6233
|
mediaType: part.mediaType,
|
|
@@ -6152,7 +6244,7 @@ function filePartToImageBlock({
|
|
|
6152
6244
|
return {
|
|
6153
6245
|
type: "image",
|
|
6154
6246
|
uri: part.data.url.toString(),
|
|
6155
|
-
...
|
|
6247
|
+
...isFullMediaType3(part.mediaType) ? { mime_type: part.mediaType } : {}
|
|
6156
6248
|
};
|
|
6157
6249
|
case "reference": {
|
|
6158
6250
|
const uri = resolveProviderReference2({
|
|
@@ -6162,7 +6254,7 @@ function filePartToImageBlock({
|
|
|
6162
6254
|
return {
|
|
6163
6255
|
type: "image",
|
|
6164
6256
|
uri,
|
|
6165
|
-
...
|
|
6257
|
+
...isFullMediaType3(part.mediaType) ? { mime_type: part.mediaType } : {}
|
|
6166
6258
|
};
|
|
6167
6259
|
}
|
|
6168
6260
|
case "text": {
|