@ai-sdk/google 3.0.0-beta.54 → 3.0.0-beta.56
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 +15 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +24 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -14
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +5 -2
- package/dist/internal/index.d.ts +5 -2
- package/dist/internal/index.js +23 -13
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +23 -13
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -40,9 +40,10 @@ declare const getGroundingMetadataSchema: () => z.ZodObject<{
|
|
|
40
40
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
41
|
}, z.core.$strip>>>;
|
|
42
42
|
retrievedContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
43
|
-
uri: z.ZodString
|
|
43
|
+
uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
44
44
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
45
45
|
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
|
+
fileSearchStore: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
47
|
}, z.core.$strip>>>;
|
|
47
48
|
}, z.core.$strip>>>>;
|
|
48
49
|
groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
@@ -81,6 +82,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
81
82
|
mimeType: string;
|
|
82
83
|
data: string;
|
|
83
84
|
};
|
|
85
|
+
thoughtSignature?: string | null | undefined;
|
|
84
86
|
} | {
|
|
85
87
|
executableCode?: {
|
|
86
88
|
language: string;
|
|
@@ -116,9 +118,10 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
116
118
|
title?: string | null | undefined;
|
|
117
119
|
} | null | undefined;
|
|
118
120
|
retrievedContext?: {
|
|
119
|
-
uri
|
|
121
|
+
uri?: string | null | undefined;
|
|
120
122
|
title?: string | null | undefined;
|
|
121
123
|
text?: string | null | undefined;
|
|
124
|
+
fileSearchStore?: string | null | undefined;
|
|
122
125
|
} | null | undefined;
|
|
123
126
|
}[] | null | undefined;
|
|
124
127
|
groundingSupports?: {
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -40,9 +40,10 @@ declare const getGroundingMetadataSchema: () => z.ZodObject<{
|
|
|
40
40
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
41
|
}, z.core.$strip>>>;
|
|
42
42
|
retrievedContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
43
|
-
uri: z.ZodString
|
|
43
|
+
uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
44
44
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
45
45
|
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
|
+
fileSearchStore: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
47
|
}, z.core.$strip>>>;
|
|
47
48
|
}, z.core.$strip>>>>;
|
|
48
49
|
groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
@@ -81,6 +82,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
81
82
|
mimeType: string;
|
|
82
83
|
data: string;
|
|
83
84
|
};
|
|
85
|
+
thoughtSignature?: string | null | undefined;
|
|
84
86
|
} | {
|
|
85
87
|
executableCode?: {
|
|
86
88
|
language: string;
|
|
@@ -116,9 +118,10 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
116
118
|
title?: string | null | undefined;
|
|
117
119
|
} | null | undefined;
|
|
118
120
|
retrievedContext?: {
|
|
119
|
-
uri
|
|
121
|
+
uri?: string | null | undefined;
|
|
120
122
|
title?: string | null | undefined;
|
|
121
123
|
text?: string | null | undefined;
|
|
124
|
+
fileSearchStore?: string | null | undefined;
|
|
122
125
|
} | null | undefined;
|
|
123
126
|
}[] | null | undefined;
|
|
124
127
|
groundingSupports?: {
|
package/dist/internal/index.js
CHANGED
|
@@ -200,11 +200,6 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
202
|
case "file": {
|
|
203
|
-
if (part.mediaType !== "image/png") {
|
|
204
|
-
throw new import_provider.UnsupportedFunctionalityError({
|
|
205
|
-
functionality: "Only PNG images are supported in assistant messages"
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
203
|
if (part.data instanceof URL) {
|
|
209
204
|
throw new import_provider.UnsupportedFunctionalityError({
|
|
210
205
|
functionality: "File data URLs in assistant messages are not supported"
|
|
@@ -214,7 +209,8 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
214
209
|
inlineData: {
|
|
215
210
|
mimeType: part.mediaType,
|
|
216
211
|
data: (0, import_provider_utils.convertToBase64)(part.data)
|
|
217
|
-
}
|
|
212
|
+
},
|
|
213
|
+
thoughtSignature
|
|
218
214
|
};
|
|
219
215
|
}
|
|
220
216
|
case "tool-call": {
|
|
@@ -808,7 +804,8 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
808
804
|
content.push({
|
|
809
805
|
type: "file",
|
|
810
806
|
data: part.inlineData.data,
|
|
811
|
-
mediaType: part.inlineData.mimeType
|
|
807
|
+
mediaType: part.inlineData.mimeType,
|
|
808
|
+
providerMetadata: part.thoughtSignature ? { google: { thoughtSignature: part.thoughtSignature } } : void 0
|
|
812
809
|
});
|
|
813
810
|
}
|
|
814
811
|
}
|
|
@@ -1115,7 +1112,7 @@ function extractSources({
|
|
|
1115
1112
|
groundingMetadata,
|
|
1116
1113
|
generateId: generateId2
|
|
1117
1114
|
}) {
|
|
1118
|
-
var _a, _b, _c;
|
|
1115
|
+
var _a, _b, _c, _d;
|
|
1119
1116
|
if (!(groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks)) {
|
|
1120
1117
|
return void 0;
|
|
1121
1118
|
}
|
|
@@ -1131,7 +1128,8 @@ function extractSources({
|
|
|
1131
1128
|
});
|
|
1132
1129
|
} else if (chunk.retrievedContext != null) {
|
|
1133
1130
|
const uri = chunk.retrievedContext.uri;
|
|
1134
|
-
|
|
1131
|
+
const fileSearchStore = chunk.retrievedContext.fileSearchStore;
|
|
1132
|
+
if (uri && (uri.startsWith("http://") || uri.startsWith("https://"))) {
|
|
1135
1133
|
sources.push({
|
|
1136
1134
|
type: "source",
|
|
1137
1135
|
sourceType: "url",
|
|
@@ -1139,7 +1137,7 @@ function extractSources({
|
|
|
1139
1137
|
url: uri,
|
|
1140
1138
|
title: (_b = chunk.retrievedContext.title) != null ? _b : void 0
|
|
1141
1139
|
});
|
|
1142
|
-
} else {
|
|
1140
|
+
} else if (uri) {
|
|
1143
1141
|
const title = (_c = chunk.retrievedContext.title) != null ? _c : "Unknown Document";
|
|
1144
1142
|
let mediaType = "application/octet-stream";
|
|
1145
1143
|
let filename = void 0;
|
|
@@ -1169,6 +1167,16 @@ function extractSources({
|
|
|
1169
1167
|
title,
|
|
1170
1168
|
filename
|
|
1171
1169
|
});
|
|
1170
|
+
} else if (fileSearchStore) {
|
|
1171
|
+
const title = (_d = chunk.retrievedContext.title) != null ? _d : "Unknown Document";
|
|
1172
|
+
sources.push({
|
|
1173
|
+
type: "source",
|
|
1174
|
+
sourceType: "document",
|
|
1175
|
+
id: generateId2(),
|
|
1176
|
+
mediaType: "application/octet-stream",
|
|
1177
|
+
title,
|
|
1178
|
+
filename: fileSearchStore.split("/").pop()
|
|
1179
|
+
});
|
|
1172
1180
|
}
|
|
1173
1181
|
}
|
|
1174
1182
|
}
|
|
@@ -1182,9 +1190,10 @@ var getGroundingMetadataSchema = () => import_v43.z.object({
|
|
|
1182
1190
|
import_v43.z.object({
|
|
1183
1191
|
web: import_v43.z.object({ uri: import_v43.z.string(), title: import_v43.z.string().nullish() }).nullish(),
|
|
1184
1192
|
retrievedContext: import_v43.z.object({
|
|
1185
|
-
uri: import_v43.z.string(),
|
|
1193
|
+
uri: import_v43.z.string().nullish(),
|
|
1186
1194
|
title: import_v43.z.string().nullish(),
|
|
1187
|
-
text: import_v43.z.string().nullish()
|
|
1195
|
+
text: import_v43.z.string().nullish(),
|
|
1196
|
+
fileSearchStore: import_v43.z.string().nullish()
|
|
1188
1197
|
}).nullish()
|
|
1189
1198
|
})
|
|
1190
1199
|
).nullish(),
|
|
@@ -1224,7 +1233,8 @@ var getContentSchema = () => import_v43.z.object({
|
|
|
1224
1233
|
inlineData: import_v43.z.object({
|
|
1225
1234
|
mimeType: import_v43.z.string(),
|
|
1226
1235
|
data: import_v43.z.string()
|
|
1227
|
-
})
|
|
1236
|
+
}),
|
|
1237
|
+
thoughtSignature: import_v43.z.string().nullish()
|
|
1228
1238
|
}),
|
|
1229
1239
|
import_v43.z.object({
|
|
1230
1240
|
executableCode: import_v43.z.object({
|