@ai-sdk/google 2.0.17 → 2.1.0-beta.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,25 +1,16 @@
1
1
  # @ai-sdk/google
2
2
 
3
- ## 2.0.17
3
+ ## 2.1.0-beta.0
4
4
 
5
- ### Patch Changes
6
-
7
- - bc5ed71: chore: update zod peer depenedency version
8
- - 356c1f2: chore (provider/google): Add preview modelIds for gemini 2.5 flash and lite
9
- - Updated dependencies [bc5ed71]
10
- - @ai-sdk/provider-utils@3.0.10
11
-
12
- ## 2.0.16
13
-
14
- ### Patch Changes
15
-
16
- - 322901b: feat: add provider version to user-agent header
5
+ ### Minor Changes
17
6
 
18
- ## 2.0.15
7
+ - 78928cb: release: start 5.1 beta
19
8
 
20
9
  ### Patch Changes
21
10
 
22
- - 967c463: add promptFeedback outputs
11
+ - Updated dependencies [78928cb]
12
+ - @ai-sdk/provider@2.1.0-beta.0
13
+ - @ai-sdk/provider-utils@3.1.0-beta.0
23
14
 
24
15
  ## 2.0.14
25
16
 
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-image-preview' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-04-17' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
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
- declare const VERSION: string;
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-image-preview' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-04-17' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
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
- declare const VERSION: string;
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");
@@ -850,7 +846,7 @@ var GoogleGenerativeAILanguageModel = class {
850
846
  };
851
847
  }
852
848
  async doGenerate(options) {
853
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
849
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
854
850
  const { args, warnings } = await this.getArgs(options);
855
851
  const body = JSON.stringify(args);
856
852
  const mergedHeaders = (0, import_provider_utils6.combineHeaders)(
@@ -946,10 +942,9 @@ var GoogleGenerativeAILanguageModel = class {
946
942
  warnings,
947
943
  providerMetadata: {
948
944
  google: {
949
- promptFeedback: (_j = response.promptFeedback) != null ? _j : null,
950
- groundingMetadata: (_k = candidate.groundingMetadata) != null ? _k : null,
951
- urlContextMetadata: (_l = candidate.urlContextMetadata) != null ? _l : null,
952
- safetyRatings: (_m = candidate.safetyRatings) != null ? _m : null,
945
+ groundingMetadata: (_j = candidate.groundingMetadata) != null ? _j : null,
946
+ urlContextMetadata: (_k = candidate.urlContextMetadata) != null ? _k : null,
947
+ safetyRatings: (_l = candidate.safetyRatings) != null ? _l : null,
953
948
  usageMetadata: usageMetadata != null ? usageMetadata : null
954
949
  }
955
950
  },
@@ -1000,7 +995,7 @@ var GoogleGenerativeAILanguageModel = class {
1000
995
  controller.enqueue({ type: "stream-start", warnings });
1001
996
  },
1002
997
  transform(chunk, controller) {
1003
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
998
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
1004
999
  if (options.includeRawChunks) {
1005
1000
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
1006
1001
  }
@@ -1174,10 +1169,9 @@ var GoogleGenerativeAILanguageModel = class {
1174
1169
  });
1175
1170
  providerMetadata = {
1176
1171
  google: {
1177
- promptFeedback: (_i = value.promptFeedback) != null ? _i : null,
1178
- groundingMetadata: (_j = candidate.groundingMetadata) != null ? _j : null,
1179
- urlContextMetadata: (_k = candidate.urlContextMetadata) != null ? _k : null,
1180
- safetyRatings: (_l = candidate.safetyRatings) != null ? _l : null
1172
+ groundingMetadata: (_i = candidate.groundingMetadata) != null ? _i : null,
1173
+ urlContextMetadata: (_j = candidate.urlContextMetadata) != null ? _j : null,
1174
+ safetyRatings: (_k = candidate.safetyRatings) != null ? _k : null
1181
1175
  }
1182
1176
  };
1183
1177
  if (usageMetadata != null) {
@@ -1305,11 +1299,7 @@ var responseSchema = import_v47.z.object({
1305
1299
  urlContextMetadata: urlContextMetadataSchema.nullish()
1306
1300
  })
1307
1301
  ),
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()
1302
+ usageMetadata: usageSchema.nullish()
1313
1303
  });
1314
1304
  var chunkSchema = import_v47.z.object({
1315
1305
  candidates: import_v47.z.array(
@@ -1321,11 +1311,7 @@ var chunkSchema = import_v47.z.object({
1321
1311
  urlContextMetadata: urlContextMetadataSchema.nullish()
1322
1312
  })
1323
1313
  ).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()
1314
+ usageMetadata: usageSchema.nullish()
1329
1315
  });
1330
1316
 
1331
1317
  // src/tool/code-execution.ts
@@ -1475,17 +1461,14 @@ var googleImageProviderOptionsSchema = import_v49.z.object({
1475
1461
  function createGoogleGenerativeAI(options = {}) {
1476
1462
  var _a;
1477
1463
  const baseURL = (_a = (0, import_provider_utils9.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://generativelanguage.googleapis.com/v1beta";
1478
- const getHeaders = () => (0, import_provider_utils9.withUserAgentSuffix)(
1479
- {
1480
- "x-goog-api-key": (0, import_provider_utils9.loadApiKey)({
1481
- apiKey: options.apiKey,
1482
- environmentVariableName: "GOOGLE_GENERATIVE_AI_API_KEY",
1483
- description: "Google Generative AI"
1484
- }),
1485
- ...options.headers
1486
- },
1487
- `ai-sdk/google/${VERSION}`
1488
- );
1464
+ const getHeaders = () => ({
1465
+ "x-goog-api-key": (0, import_provider_utils9.loadApiKey)({
1466
+ apiKey: options.apiKey,
1467
+ environmentVariableName: "GOOGLE_GENERATIVE_AI_API_KEY",
1468
+ description: "Google Generative AI"
1469
+ }),
1470
+ ...options.headers
1471
+ });
1489
1472
  const createChatModel = (modelId) => {
1490
1473
  var _a2;
1491
1474
  return new GoogleGenerativeAILanguageModel(modelId, {
@@ -1542,7 +1525,6 @@ function createGoogleGenerativeAI(options = {}) {
1542
1525
  var google = createGoogleGenerativeAI();
1543
1526
  // Annotate the CommonJS export names for ESM import in node:
1544
1527
  0 && (module.exports = {
1545
- VERSION,
1546
1528
  createGoogleGenerativeAI,
1547
1529
  google
1548
1530
  });