@ai-sdk/google 2.0.17 → 2.1.0-beta.1
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 +11 -11
- package/dist/index.d.mts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +21 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -43
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +13 -26
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +13 -26
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
# @ai-sdk/google
|
2
2
|
|
3
|
-
## 2.0.
|
3
|
+
## 2.1.0-beta.1
|
4
4
|
|
5
5
|
### Patch Changes
|
6
6
|
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
- @ai-sdk/provider-utils@3.0.
|
7
|
+
- Updated dependencies [953d0f2]
|
8
|
+
- Updated dependencies [cbb1d35]
|
9
|
+
- @ai-sdk/test-server@1.0.0-beta.0
|
10
|
+
- @ai-sdk/provider-utils@3.1.0-beta.1
|
11
11
|
|
12
|
-
## 2.0.
|
12
|
+
## 2.1.0-beta.0
|
13
13
|
|
14
|
-
###
|
15
|
-
|
16
|
-
- 322901b: feat: add provider version to user-agent header
|
14
|
+
### Minor Changes
|
17
15
|
|
18
|
-
|
16
|
+
- 78928cb: release: start 5.1 beta
|
19
17
|
|
20
18
|
### Patch Changes
|
21
19
|
|
22
|
-
-
|
20
|
+
- Updated dependencies [78928cb]
|
21
|
+
- @ai-sdk/provider@2.1.0-beta.0
|
22
|
+
- @ai-sdk/provider-utils@3.1.0-beta.0
|
23
23
|
|
24
24
|
## 2.0.14
|
25
25
|
|
package/dist/index.d.mts
CHANGED
@@ -12,7 +12,7 @@ declare const googleErrorDataSchema: z.ZodObject<{
|
|
12
12
|
}, z.core.$strip>;
|
13
13
|
type GoogleErrorData = z.infer<typeof googleErrorDataSchema>;
|
14
14
|
|
15
|
-
type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-
|
15
|
+
type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-image-preview' | 'gemini-2.5-pro-exp-03-25' | 'gemini-2.5-flash-preview-04-17' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
|
16
16
|
declare const googleGenerativeAIProviderOptions: z.ZodObject<{
|
17
17
|
responseModalities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
18
18
|
TEXT: "TEXT";
|
@@ -240,6 +240,4 @@ Default Google Generative AI provider instance.
|
|
240
240
|
*/
|
241
241
|
declare const google: GoogleGenerativeAIProvider;
|
242
242
|
|
243
|
-
|
244
|
-
|
245
|
-
export { type GoogleErrorData, type GoogleGenerativeAIEmbeddingProviderOptions, type GoogleGenerativeAIImageProviderOptions, type GoogleGenerativeAIProvider, type GoogleGenerativeAIProviderMetadata, type GoogleGenerativeAIProviderOptions, type GoogleGenerativeAIProviderSettings, VERSION, createGoogleGenerativeAI, google };
|
243
|
+
export { type GoogleErrorData, type GoogleGenerativeAIEmbeddingProviderOptions, type GoogleGenerativeAIImageProviderOptions, type GoogleGenerativeAIProvider, type GoogleGenerativeAIProviderMetadata, type GoogleGenerativeAIProviderOptions, type GoogleGenerativeAIProviderSettings, createGoogleGenerativeAI, google };
|
package/dist/index.d.ts
CHANGED
@@ -12,7 +12,7 @@ declare const googleErrorDataSchema: z.ZodObject<{
|
|
12
12
|
}, z.core.$strip>;
|
13
13
|
type GoogleErrorData = z.infer<typeof googleErrorDataSchema>;
|
14
14
|
|
15
|
-
type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-
|
15
|
+
type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-image-preview' | 'gemini-2.5-pro-exp-03-25' | 'gemini-2.5-flash-preview-04-17' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
|
16
16
|
declare const googleGenerativeAIProviderOptions: z.ZodObject<{
|
17
17
|
responseModalities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
18
18
|
TEXT: "TEXT";
|
@@ -240,6 +240,4 @@ Default Google Generative AI provider instance.
|
|
240
240
|
*/
|
241
241
|
declare const google: GoogleGenerativeAIProvider;
|
242
242
|
|
243
|
-
|
244
|
-
|
245
|
-
export { type GoogleErrorData, type GoogleGenerativeAIEmbeddingProviderOptions, type GoogleGenerativeAIImageProviderOptions, type GoogleGenerativeAIProvider, type GoogleGenerativeAIProviderMetadata, type GoogleGenerativeAIProviderOptions, type GoogleGenerativeAIProviderSettings, VERSION, createGoogleGenerativeAI, google };
|
243
|
+
export { type GoogleErrorData, type GoogleGenerativeAIEmbeddingProviderOptions, type GoogleGenerativeAIImageProviderOptions, type GoogleGenerativeAIProvider, type GoogleGenerativeAIProviderMetadata, type GoogleGenerativeAIProviderOptions, type GoogleGenerativeAIProviderSettings, createGoogleGenerativeAI, google };
|
package/dist/index.js
CHANGED
@@ -20,7 +20,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
20
20
|
// src/index.ts
|
21
21
|
var src_exports = {};
|
22
22
|
__export(src_exports, {
|
23
|
-
VERSION: () => VERSION,
|
24
23
|
createGoogleGenerativeAI: () => createGoogleGenerativeAI,
|
25
24
|
google: () => google
|
26
25
|
});
|
@@ -29,9 +28,6 @@ module.exports = __toCommonJS(src_exports);
|
|
29
28
|
// src/google-provider.ts
|
30
29
|
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
31
30
|
|
32
|
-
// src/version.ts
|
33
|
-
var VERSION = true ? "2.0.17" : "0.0.0-test";
|
34
|
-
|
35
31
|
// src/google-generative-ai-embedding-model.ts
|
36
32
|
var import_provider = require("@ai-sdk/provider");
|
37
33
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
@@ -211,12 +207,9 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
|
211
207
|
enum: enumValues
|
212
208
|
} = jsonSchema;
|
213
209
|
const result = {};
|
214
|
-
if (description)
|
215
|
-
|
216
|
-
if (
|
217
|
-
result.required = required;
|
218
|
-
if (format)
|
219
|
-
result.format = format;
|
210
|
+
if (description) result.description = description;
|
211
|
+
if (required) result.required = required;
|
212
|
+
if (format) result.format = format;
|
220
213
|
if (constValue !== void 0) {
|
221
214
|
result.enum = [constValue];
|
222
215
|
}
|
@@ -850,7 +843,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
850
843
|
};
|
851
844
|
}
|
852
845
|
async doGenerate(options) {
|
853
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l
|
846
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
854
847
|
const { args, warnings } = await this.getArgs(options);
|
855
848
|
const body = JSON.stringify(args);
|
856
849
|
const mergedHeaders = (0, import_provider_utils6.combineHeaders)(
|
@@ -946,10 +939,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
946
939
|
warnings,
|
947
940
|
providerMetadata: {
|
948
941
|
google: {
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
safetyRatings: (_m = candidate.safetyRatings) != null ? _m : null,
|
942
|
+
groundingMetadata: (_j = candidate.groundingMetadata) != null ? _j : null,
|
943
|
+
urlContextMetadata: (_k = candidate.urlContextMetadata) != null ? _k : null,
|
944
|
+
safetyRatings: (_l = candidate.safetyRatings) != null ? _l : null,
|
953
945
|
usageMetadata: usageMetadata != null ? usageMetadata : null
|
954
946
|
}
|
955
947
|
},
|
@@ -1000,7 +992,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
1000
992
|
controller.enqueue({ type: "stream-start", warnings });
|
1001
993
|
},
|
1002
994
|
transform(chunk, controller) {
|
1003
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k
|
995
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
1004
996
|
if (options.includeRawChunks) {
|
1005
997
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
1006
998
|
}
|
@@ -1174,10 +1166,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
1174
1166
|
});
|
1175
1167
|
providerMetadata = {
|
1176
1168
|
google: {
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
safetyRatings: (_l = candidate.safetyRatings) != null ? _l : null
|
1169
|
+
groundingMetadata: (_i = candidate.groundingMetadata) != null ? _i : null,
|
1170
|
+
urlContextMetadata: (_j = candidate.urlContextMetadata) != null ? _j : null,
|
1171
|
+
safetyRatings: (_k = candidate.safetyRatings) != null ? _k : null
|
1181
1172
|
}
|
1182
1173
|
};
|
1183
1174
|
if (usageMetadata != null) {
|
@@ -1305,11 +1296,7 @@ var responseSchema = import_v47.z.object({
|
|
1305
1296
|
urlContextMetadata: urlContextMetadataSchema.nullish()
|
1306
1297
|
})
|
1307
1298
|
),
|
1308
|
-
usageMetadata: usageSchema.nullish()
|
1309
|
-
promptFeedback: import_v47.z.object({
|
1310
|
-
blockReason: import_v47.z.string().nullish(),
|
1311
|
-
safetyRatings: import_v47.z.array(safetyRatingSchema).nullish()
|
1312
|
-
}).nullish()
|
1299
|
+
usageMetadata: usageSchema.nullish()
|
1313
1300
|
});
|
1314
1301
|
var chunkSchema = import_v47.z.object({
|
1315
1302
|
candidates: import_v47.z.array(
|
@@ -1321,11 +1308,7 @@ var chunkSchema = import_v47.z.object({
|
|
1321
1308
|
urlContextMetadata: urlContextMetadataSchema.nullish()
|
1322
1309
|
})
|
1323
1310
|
).nullish(),
|
1324
|
-
usageMetadata: usageSchema.nullish()
|
1325
|
-
promptFeedback: import_v47.z.object({
|
1326
|
-
blockReason: import_v47.z.string().nullish(),
|
1327
|
-
safetyRatings: import_v47.z.array(safetyRatingSchema).nullish()
|
1328
|
-
}).nullish()
|
1311
|
+
usageMetadata: usageSchema.nullish()
|
1329
1312
|
});
|
1330
1313
|
|
1331
1314
|
// src/tool/code-execution.ts
|
@@ -1475,17 +1458,14 @@ var googleImageProviderOptionsSchema = import_v49.z.object({
|
|
1475
1458
|
function createGoogleGenerativeAI(options = {}) {
|
1476
1459
|
var _a;
|
1477
1460
|
const baseURL = (_a = (0, import_provider_utils9.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://generativelanguage.googleapis.com/v1beta";
|
1478
|
-
const getHeaders = () => (
|
1479
|
-
{
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
},
|
1487
|
-
`ai-sdk/google/${VERSION}`
|
1488
|
-
);
|
1461
|
+
const getHeaders = () => ({
|
1462
|
+
"x-goog-api-key": (0, import_provider_utils9.loadApiKey)({
|
1463
|
+
apiKey: options.apiKey,
|
1464
|
+
environmentVariableName: "GOOGLE_GENERATIVE_AI_API_KEY",
|
1465
|
+
description: "Google Generative AI"
|
1466
|
+
}),
|
1467
|
+
...options.headers
|
1468
|
+
});
|
1489
1469
|
const createChatModel = (modelId) => {
|
1490
1470
|
var _a2;
|
1491
1471
|
return new GoogleGenerativeAILanguageModel(modelId, {
|
@@ -1542,7 +1522,6 @@ function createGoogleGenerativeAI(options = {}) {
|
|
1542
1522
|
var google = createGoogleGenerativeAI();
|
1543
1523
|
// Annotate the CommonJS export names for ESM import in node:
|
1544
1524
|
0 && (module.exports = {
|
1545
|
-
VERSION,
|
1546
1525
|
createGoogleGenerativeAI,
|
1547
1526
|
google
|
1548
1527
|
});
|