@ai-sdk/google 3.0.50 → 3.0.51

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.
@@ -112,6 +112,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
112
112
  })[] | null | undefined;
113
113
  } | null | undefined;
114
114
  finishReason?: string | null | undefined;
115
+ finishMessage?: string | null | undefined;
115
116
  safetyRatings?: {
116
117
  category?: string | null | undefined;
117
118
  probability?: string | null | undefined;
@@ -197,6 +198,8 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
197
198
  type GroundingMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
198
199
  type UrlContextMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
199
200
  type SafetyRatingSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['safetyRatings']>[number];
201
+ type PromptFeedbackSchema = NonNullable<InferSchema<typeof responseSchema>['promptFeedback']>;
202
+ type UsageMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['usageMetadata']>;
200
203
 
201
204
  declare const googleTools: {
202
205
  /**
@@ -281,4 +284,4 @@ declare const googleTools: {
281
284
  }>;
282
285
  };
283
286
 
284
- export { GoogleGenerativeAILanguageModel, type GoogleGenerativeAIModelId, type GroundingMetadataSchema, type SafetyRatingSchema, type UrlContextMetadataSchema, getGroundingMetadataSchema, getUrlContextMetadataSchema, googleTools };
287
+ export { GoogleGenerativeAILanguageModel, type GoogleGenerativeAIModelId, type GroundingMetadataSchema, type PromptFeedbackSchema, type SafetyRatingSchema, type UrlContextMetadataSchema, type UsageMetadataSchema, getGroundingMetadataSchema, getUrlContextMetadataSchema, googleTools };
@@ -112,6 +112,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
112
112
  })[] | null | undefined;
113
113
  } | null | undefined;
114
114
  finishReason?: string | null | undefined;
115
+ finishMessage?: string | null | undefined;
115
116
  safetyRatings?: {
116
117
  category?: string | null | undefined;
117
118
  probability?: string | null | undefined;
@@ -197,6 +198,8 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
197
198
  type GroundingMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
198
199
  type UrlContextMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
199
200
  type SafetyRatingSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['safetyRatings']>[number];
201
+ type PromptFeedbackSchema = NonNullable<InferSchema<typeof responseSchema>['promptFeedback']>;
202
+ type UsageMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['usageMetadata']>;
200
203
 
201
204
  declare const googleTools: {
202
205
  /**
@@ -281,4 +284,4 @@ declare const googleTools: {
281
284
  }>;
282
285
  };
283
286
 
284
- export { GoogleGenerativeAILanguageModel, type GoogleGenerativeAIModelId, type GroundingMetadataSchema, type SafetyRatingSchema, type UrlContextMetadataSchema, getGroundingMetadataSchema, getUrlContextMetadataSchema, googleTools };
287
+ export { GoogleGenerativeAILanguageModel, type GoogleGenerativeAIModelId, type GroundingMetadataSchema, type PromptFeedbackSchema, type SafetyRatingSchema, type UrlContextMetadataSchema, type UsageMetadataSchema, getGroundingMetadataSchema, getUrlContextMetadataSchema, googleTools };
@@ -856,7 +856,7 @@ var GoogleGenerativeAILanguageModel = class {
856
856
  };
857
857
  }
858
858
  async doGenerate(options) {
859
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
859
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
860
860
  const { args, warnings, providerOptionsName } = await this.getArgs(options);
861
861
  const mergedHeaders = (0, import_provider_utils4.combineHeaders)(
862
862
  await (0, import_provider_utils4.resolve)(this.config.headers),
@@ -978,7 +978,8 @@ var GoogleGenerativeAILanguageModel = class {
978
978
  groundingMetadata: (_h = candidate.groundingMetadata) != null ? _h : null,
979
979
  urlContextMetadata: (_i = candidate.urlContextMetadata) != null ? _i : null,
980
980
  safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null,
981
- usageMetadata: usageMetadata != null ? usageMetadata : null
981
+ usageMetadata: usageMetadata != null ? usageMetadata : null,
982
+ finishMessage: (_k = candidate.finishMessage) != null ? _k : null
982
983
  }
983
984
  },
984
985
  request: { body: args },
@@ -1028,7 +1029,7 @@ var GoogleGenerativeAILanguageModel = class {
1028
1029
  controller.enqueue({ type: "stream-start", warnings });
1029
1030
  },
1030
1031
  transform(chunk, controller) {
1031
- var _a, _b, _c, _d, _e, _f;
1032
+ var _a, _b, _c, _d, _e, _f, _g;
1032
1033
  if (options.includeRawChunks) {
1033
1034
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
1034
1035
  }
@@ -1230,12 +1231,11 @@ var GoogleGenerativeAILanguageModel = class {
1230
1231
  promptFeedback: (_e = value.promptFeedback) != null ? _e : null,
1231
1232
  groundingMetadata: lastGroundingMetadata,
1232
1233
  urlContextMetadata: lastUrlContextMetadata,
1233
- safetyRatings: (_f = candidate.safetyRatings) != null ? _f : null
1234
+ safetyRatings: (_f = candidate.safetyRatings) != null ? _f : null,
1235
+ usageMetadata: usageMetadata != null ? usageMetadata : null,
1236
+ finishMessage: (_g = candidate.finishMessage) != null ? _g : null
1234
1237
  }
1235
1238
  };
1236
- if (usageMetadata != null) {
1237
- providerMetadata[providerOptionsName].usageMetadata = usageMetadata;
1238
- }
1239
1239
  }
1240
1240
  },
1241
1241
  flush(controller) {
@@ -1495,6 +1495,7 @@ var responseSchema = (0, import_provider_utils4.lazySchema)(
1495
1495
  import_v43.z.object({
1496
1496
  content: getContentSchema().nullish().or(import_v43.z.object({}).strict()),
1497
1497
  finishReason: import_v43.z.string().nullish(),
1498
+ finishMessage: import_v43.z.string().nullish(),
1498
1499
  safetyRatings: import_v43.z.array(getSafetyRatingSchema()).nullish(),
1499
1500
  groundingMetadata: getGroundingMetadataSchema().nullish(),
1500
1501
  urlContextMetadata: getUrlContextMetadataSchema().nullish()
@@ -1515,6 +1516,7 @@ var chunkSchema = (0, import_provider_utils4.lazySchema)(
1515
1516
  import_v43.z.object({
1516
1517
  content: getContentSchema().nullish(),
1517
1518
  finishReason: import_v43.z.string().nullish(),
1519
+ finishMessage: import_v43.z.string().nullish(),
1518
1520
  safetyRatings: import_v43.z.array(getSafetyRatingSchema()).nullish(),
1519
1521
  groundingMetadata: getGroundingMetadataSchema().nullish(),
1520
1522
  urlContextMetadata: getUrlContextMetadataSchema().nullish()