@ai-sdk/google 2.0.63 → 2.0.64

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/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  } from "@ai-sdk/provider-utils";
8
8
 
9
9
  // src/version.ts
10
- var VERSION = true ? "2.0.63" : "0.0.0-test";
10
+ var VERSION = true ? "2.0.64" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -704,7 +704,15 @@ var googleGenerativeAIProviderOptions = lazySchema4(
704
704
  latitude: z4.number(),
705
705
  longitude: z4.number()
706
706
  }).optional()
707
- }).optional()
707
+ }).optional(),
708
+ /**
709
+ * Optional. The service tier to use for the request.
710
+ */
711
+ serviceTier: z4.enum([
712
+ "SERVICE_TIER_STANDARD",
713
+ "SERVICE_TIER_FLEX",
714
+ "SERVICE_TIER_PRIORITY"
715
+ ]).optional()
708
716
  })
709
717
  )
710
718
  );
@@ -1037,13 +1045,14 @@ var GoogleGenerativeAILanguageModel = class {
1037
1045
  retrievalConfig: googleOptions.retrievalConfig
1038
1046
  } : googleToolConfig,
1039
1047
  cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
1040
- labels: googleOptions == null ? void 0 : googleOptions.labels
1048
+ labels: googleOptions == null ? void 0 : googleOptions.labels,
1049
+ serviceTier: googleOptions == null ? void 0 : googleOptions.serviceTier
1041
1050
  },
1042
1051
  warnings: [...warnings, ...toolWarnings]
1043
1052
  };
1044
1053
  }
1045
1054
  async doGenerate(options) {
1046
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
1055
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
1047
1056
  const { args, warnings } = await this.getArgs(options);
1048
1057
  const body = JSON.stringify(args);
1049
1058
  const mergedHeaders = combineHeaders2(
@@ -1153,7 +1162,7 @@ var GoogleGenerativeAILanguageModel = class {
1153
1162
  groundingMetadata: (_k = candidate.groundingMetadata) != null ? _k : null,
1154
1163
  urlContextMetadata: (_l = candidate.urlContextMetadata) != null ? _l : null,
1155
1164
  safetyRatings: (_m = candidate.safetyRatings) != null ? _m : null,
1156
- usageMetadata: usageMetadata != null ? usageMetadata : null
1165
+ serviceTier: (_n = response.serviceTier) != null ? _n : null
1157
1166
  }
1158
1167
  },
1159
1168
  request: { body },
@@ -1191,6 +1200,7 @@ var GoogleGenerativeAILanguageModel = class {
1191
1200
  let providerMetadata = void 0;
1192
1201
  let lastGroundingMetadata = null;
1193
1202
  let lastUrlContextMetadata = null;
1203
+ let serviceTier = null;
1194
1204
  const generateId3 = this.config.generateId;
1195
1205
  let hasToolCalls = false;
1196
1206
  let currentTextBlockId = null;
@@ -1222,6 +1232,9 @@ var GoogleGenerativeAILanguageModel = class {
1222
1232
  usage.reasoningTokens = (_d = usageMetadata.thoughtsTokenCount) != null ? _d : void 0;
1223
1233
  usage.cachedInputTokens = (_e = usageMetadata.cachedContentTokenCount) != null ? _e : void 0;
1224
1234
  }
1235
+ if (value.serviceTier != null) {
1236
+ serviceTier = value.serviceTier;
1237
+ }
1225
1238
  const candidate = (_f = value.candidates) == null ? void 0 : _f[0];
1226
1239
  if (candidate == null) {
1227
1240
  return;
@@ -1386,7 +1399,8 @@ var GoogleGenerativeAILanguageModel = class {
1386
1399
  promptFeedback: (_i = value.promptFeedback) != null ? _i : null,
1387
1400
  groundingMetadata: lastGroundingMetadata,
1388
1401
  urlContextMetadata: lastUrlContextMetadata,
1389
- safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null
1402
+ safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null,
1403
+ serviceTier
1390
1404
  }
1391
1405
  };
1392
1406
  if (usageMetadata != null) {
@@ -1653,7 +1667,8 @@ var responseSchema = lazySchema5(
1653
1667
  promptFeedback: z5.object({
1654
1668
  blockReason: z5.string().nullish(),
1655
1669
  safetyRatings: z5.array(getSafetyRatingSchema()).nullish()
1656
- }).nullish()
1670
+ }).nullish(),
1671
+ serviceTier: z5.string().nullish()
1657
1672
  })
1658
1673
  )
1659
1674
  );
@@ -1673,7 +1688,8 @@ var chunkSchema = lazySchema5(
1673
1688
  promptFeedback: z5.object({
1674
1689
  blockReason: z5.string().nullish(),
1675
1690
  safetyRatings: z5.array(getSafetyRatingSchema()).nullish()
1676
- }).nullish()
1691
+ }).nullish(),
1692
+ serviceTier: z5.string().nullish()
1677
1693
  })
1678
1694
  )
1679
1695
  );