@depup/ai-sdk__google 4.0.72-depup.0 → 4.0.75-depup.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,5 +1,42 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 4.0.75
4
+
5
+ ### Patch Changes
6
+
7
+ - e369c4d: fix(google): advertise the supported Gemini image per-call limit
8
+ - 2b391f8: fix(google): ignore default prompt block reasons in non-streaming responses
9
+ - 1284569: fix(google): include tool-use prompt tokens in input usage
10
+ - Updated dependencies [0455398]
11
+ - @ai-sdk/provider-utils@5.0.44
12
+
13
+ ## 4.0.74
14
+
15
+ ### Patch Changes
16
+
17
+ - d4d96bf: Add `google.evaluationModel()` for experimental Choice, Score, and Boolean evaluations through Gemini structured output, preserving provider thinking options and validating exact labels and score bounds. Boolean answers contain prompted P(true) estimates validated to be in [0, 1]. Boolean estimates are not guaranteed to be calibrated; application code chooses thresholds.
18
+ - Updated dependencies [215b25e]
19
+ - Updated dependencies [d4d96bf]
20
+ - Updated dependencies [a7dd893]
21
+ - Updated dependencies [3456e2c]
22
+ - Updated dependencies [c4e76de]
23
+ - @ai-sdk/provider-utils@5.0.43
24
+ - @ai-sdk/provider@4.0.17
25
+
26
+ ## 4.0.73
27
+
28
+ ### Patch Changes
29
+
30
+ - a22b5b2: fix(google): preserve prompt feedback and metadata across streaming chunks
31
+ - 2cd80b3: Keep default Node.js downloads protected by DNS validation and connection pinning when frameworks or instrumentation wrap global fetch before or after the SDK loads.
32
+ - Updated dependencies [91c2128]
33
+ - Updated dependencies [2cd80b3]
34
+ - Updated dependencies [d06bb2a]
35
+ - Updated dependencies [123d71f]
36
+ - Updated dependencies [2fa5e0e]
37
+ - @ai-sdk/provider-utils@5.0.42
38
+ - @ai-sdk/provider@4.0.16
39
+
3
40
  ## 4.0.72
4
41
 
5
42
  ### Patch Changes
package/README.md CHANGED
@@ -13,8 +13,8 @@ npm install @depup/ai-sdk__google
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [@ai-sdk/google](https://www.npmjs.com/package/@ai-sdk/google) @ 4.0.72 |
17
- | Processed | 2026-09-16 |
16
+ | Original | [@ai-sdk/google](https://www.npmjs.com/package/@ai-sdk/google) @ 4.0.75 |
17
+ | Processed | 2026-09-18 |
18
18
  | Smoke test | failed |
19
19
  | Deps updated | 0 |
20
20
 
package/changes.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "bumped": {},
3
- "timestamp": "2026-09-16T00:30:55.501Z",
3
+ "timestamp": "2026-09-18T08:11:03.559Z",
4
4
  "totalUpdated": 0
5
5
  }
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
2
  import { InferSchema, FetchFunction, WebSocketConstructor, WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE, Resolvable } from '@ai-sdk/provider-utils';
3
3
  import { z } from 'zod/v4';
4
4
  import * as _ai_sdk_provider from '@ai-sdk/provider';
5
- import { ProviderV4, LanguageModelV4, Experimental_BatchV4, ImageModelV4, EmbeddingModelV4, Experimental_VideoModelV4, Experimental_SpeechTranslationModelV4, SpeechModelV4, TranscriptionModelV4, FilesV4, Experimental_RealtimeFactoryV4, Experimental_RealtimeModelV4, Experimental_RealtimeModelV4ClientSecretOptions, Experimental_RealtimeModelV4ClientSecretResult, Experimental_RealtimeModelV4ServerEvent, Experimental_RealtimeModelV4ClientEvent, Experimental_RealtimeModelV4SessionConfig, JSONObject, Experimental_TranscriptionModelV4StreamOptions, Experimental_SpeechTranslationModelV4StreamOptions } from '@ai-sdk/provider';
5
+ import { ProviderV4, LanguageModelV4, Experimental_EvaluationModelV4, Experimental_BatchV4, ImageModelV4, EmbeddingModelV4, Experimental_VideoModelV4, Experimental_SpeechTranslationModelV4, SpeechModelV4, TranscriptionModelV4, FilesV4, Experimental_RealtimeFactoryV4, Experimental_RealtimeModelV4, Experimental_RealtimeModelV4ClientSecretOptions, Experimental_RealtimeModelV4ClientSecretResult, Experimental_RealtimeModelV4ServerEvent, Experimental_RealtimeModelV4ClientEvent, Experimental_RealtimeModelV4SessionConfig, JSONObject, Experimental_TranscriptionModelV4StreamOptions, Experimental_SpeechTranslationModelV4StreamOptions } from '@ai-sdk/provider';
6
6
 
7
7
  declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
8
8
  error: {
@@ -559,7 +559,7 @@ declare const googleTools: {
559
559
  type GoogleImageModelId = 'gemini-2.5-flash-image' | 'gemini-3-pro-image-preview' | 'gemini-3.1-flash-image-preview' | (string & {});
560
560
  interface GoogleImageSettings {
561
561
  /**
562
- * Override the maximum number of images per call (default 10)
562
+ * Override the maximum number of images per call (default 1)
563
563
  */
564
564
  maxImagesPerCall?: number;
565
565
  }
@@ -592,6 +592,8 @@ interface GoogleProvider extends ProviderV4 {
592
592
  (modelId: GoogleModelId): LanguageModelV4;
593
593
  languageModel(modelId: GoogleModelId): LanguageModelV4;
594
594
  chat(modelId: GoogleModelId): LanguageModelV4;
595
+ /** Creates an experimental Choice/Score/Boolean evaluation model using Gemini. */
596
+ evaluationModel(modelId: GoogleModelId): Experimental_EvaluationModelV4;
595
597
  experimental_batch(): Experimental_BatchV4<{
596
598
  text: GoogleModelId;
597
599
  image: GoogleImageModelId;
package/dist/index.js CHANGED
@@ -5,9 +5,10 @@ import {
5
5
  withoutTrailingSlash,
6
6
  withUserAgentSuffix as withUserAgentSuffix2
7
7
  } from "@ai-sdk/provider-utils";
8
+ import { Experimental_EvaluationLanguageModel as EvaluationLanguageModel } from "@ai-sdk/provider-utils/experimental-evaluation";
8
9
 
9
10
  // src/version.ts
10
- var VERSION = true ? "4.0.72" : "0.0.0-test";
11
+ var VERSION = true ? "4.0.75" : "0.0.0-test";
11
12
 
12
13
  // src/google-embedding-model.ts
13
14
  import {
@@ -305,18 +306,20 @@ import { z as z5 } from "zod/v4";
305
306
  // src/convert-google-usage.ts
306
307
  import { createNullLanguageModelUsage } from "@ai-sdk/provider-utils";
307
308
  function convertGoogleUsage(usage) {
308
- var _a, _b, _c, _d;
309
+ var _a, _b, _c, _d, _e;
309
310
  if (usage == null) {
310
311
  return createNullLanguageModelUsage();
311
312
  }
312
313
  const promptTokens = (_a = usage.promptTokenCount) != null ? _a : 0;
313
314
  const candidatesTokens = (_b = usage.candidatesTokenCount) != null ? _b : 0;
314
- const cachedContentTokens = (_c = usage.cachedContentTokenCount) != null ? _c : 0;
315
- const thoughtsTokens = (_d = usage.thoughtsTokenCount) != null ? _d : 0;
315
+ const toolUsePromptTokens = (_c = usage.toolUsePromptTokenCount) != null ? _c : 0;
316
+ const cachedContentTokens = (_d = usage.cachedContentTokenCount) != null ? _d : 0;
317
+ const thoughtsTokens = (_e = usage.thoughtsTokenCount) != null ? _e : 0;
318
+ const inputTokens = promptTokens + toolUsePromptTokens;
316
319
  return {
317
320
  inputTokens: {
318
- total: promptTokens,
319
- noCache: promptTokens - cachedContentTokens,
321
+ total: inputTokens,
322
+ noCache: inputTokens - cachedContentTokens,
320
323
  cacheRead: cachedContentTokens,
321
324
  cacheWrite: void 0
322
325
  },
@@ -1899,27 +1902,30 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1899
1902
  providerOptionsNames,
1900
1903
  toolNameMapping
1901
1904
  }) {
1902
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
1905
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
1903
1906
  const wrapProviderMetadata = (payload) => Object.fromEntries(
1904
1907
  providerOptionsNames.map((name) => [name, payload])
1905
1908
  );
1906
1909
  const candidate = (_a = response.candidates) == null ? void 0 : _a[0];
1907
1910
  const promptBlockReason = (_b = response.promptFeedback) == null ? void 0 : _b.blockReason;
1908
- const isPromptBlocked = (candidate == null ? void 0 : candidate.finishReason) == null && promptBlockReason != null;
1909
- const rawFinishReason = (_d = (_c = candidate == null ? void 0 : candidate.finishReason) != null ? _c : promptBlockReason) != null ? _d : void 0;
1911
+ const confirmedPromptBlockReason = isConfirmedPromptBlockReason(
1912
+ promptBlockReason
1913
+ ) ? promptBlockReason : void 0;
1914
+ const isPromptBlocked = (candidate == null ? void 0 : candidate.finishReason) == null && confirmedPromptBlockReason != null;
1915
+ const rawFinishReason = (_c = candidate == null ? void 0 : candidate.finishReason) != null ? _c : confirmedPromptBlockReason;
1910
1916
  const content = [];
1911
- const parts = (_f = (_e = candidate == null ? void 0 : candidate.content) == null ? void 0 : _e.parts) != null ? _f : [];
1917
+ const parts = (_e = (_d = candidate == null ? void 0 : candidate.content) == null ? void 0 : _d.parts) != null ? _e : [];
1912
1918
  const usageMetadata = response.usageMetadata;
1913
1919
  let lastCodeExecutionToolCallId;
1914
1920
  let lastServerToolCallId;
1915
1921
  for (const part of parts) {
1916
- if ("executableCode" in part && ((_g = part.executableCode) == null ? void 0 : _g.code)) {
1922
+ if ("executableCode" in part && ((_f = part.executableCode) == null ? void 0 : _f.code)) {
1917
1923
  const toolCallId = config.generateId();
1918
1924
  lastCodeExecutionToolCallId = toolCallId;
1919
1925
  content.push({
1920
1926
  type: "tool-call",
1921
1927
  toolCallId,
1922
- toolName: (_h = toolNameMapping == null ? void 0 : toolNameMapping.toCustomToolName("code_execution")) != null ? _h : "code_execution",
1928
+ toolName: (_g = toolNameMapping == null ? void 0 : toolNameMapping.toCustomToolName("code_execution")) != null ? _g : "code_execution",
1923
1929
  input: JSON.stringify(part.executableCode),
1924
1930
  providerExecuted: true
1925
1931
  });
@@ -1928,10 +1934,10 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1928
1934
  type: "tool-result",
1929
1935
  // Results correspond to the most recent executable code part.
1930
1936
  toolCallId: lastCodeExecutionToolCallId,
1931
- toolName: (_i = toolNameMapping == null ? void 0 : toolNameMapping.toCustomToolName("code_execution")) != null ? _i : "code_execution",
1937
+ toolName: (_h = toolNameMapping == null ? void 0 : toolNameMapping.toCustomToolName("code_execution")) != null ? _h : "code_execution",
1932
1938
  result: {
1933
1939
  outcome: part.codeExecutionResult.outcome,
1934
- output: (_j = part.codeExecutionResult.output) != null ? _j : ""
1940
+ output: (_i = part.codeExecutionResult.output) != null ? _i : ""
1935
1941
  }
1936
1942
  });
1937
1943
  } else if ("text" in part && part.text != null) {
@@ -1955,7 +1961,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1955
1961
  type: "tool-call",
1956
1962
  toolCallId: part.functionCall.id || config.generateId(),
1957
1963
  toolName: part.functionCall.name,
1958
- input: JSON.stringify((_k = part.functionCall.args) != null ? _k : {}),
1964
+ input: JSON.stringify((_j = part.functionCall.args) != null ? _j : {}),
1959
1965
  providerMetadata: part.thoughtSignature ? wrapProviderMetadata({
1960
1966
  thoughtSignature: part.thoughtSignature
1961
1967
  }) : void 0
@@ -1978,7 +1984,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1978
1984
  type: "tool-call",
1979
1985
  toolCallId,
1980
1986
  toolName: `server:${part.toolCall.toolType}`,
1981
- input: JSON.stringify((_l = part.toolCall.args) != null ? _l : {}),
1987
+ input: JSON.stringify((_k = part.toolCall.args) != null ? _k : {}),
1982
1988
  providerExecuted: true,
1983
1989
  dynamic: true,
1984
1990
  providerMetadata: part.thoughtSignature ? wrapProviderMetadata({
@@ -1996,7 +2002,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1996
2002
  type: "tool-result",
1997
2003
  toolCallId: responseToolCallId,
1998
2004
  toolName: `server:${part.toolResponse.toolType}`,
1999
- result: (_m = part.toolResponse.response) != null ? _m : {},
2005
+ result: (_l = part.toolResponse.response) != null ? _l : {},
2000
2006
  providerMetadata: part.thoughtSignature ? wrapProviderMetadata({
2001
2007
  thoughtSignature: part.thoughtSignature,
2002
2008
  serverToolCallId: responseToolCallId,
@@ -2009,10 +2015,10 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2009
2015
  lastServerToolCallId = void 0;
2010
2016
  }
2011
2017
  }
2012
- const sources = (_n = extractSources({
2018
+ const sources = (_m = extractSources({
2013
2019
  groundingMetadata: candidate == null ? void 0 : candidate.groundingMetadata,
2014
2020
  generateId: config.generateId
2015
- })) != null ? _n : [];
2021
+ })) != null ? _m : [];
2016
2022
  for (const source of sources) {
2017
2023
  content.push(source);
2018
2024
  }
@@ -2031,17 +2037,17 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2031
2037
  usage: convertGoogleUsage(usageMetadata),
2032
2038
  warnings,
2033
2039
  providerMetadata: wrapProviderMetadata({
2034
- promptFeedback: (_o = response.promptFeedback) != null ? _o : null,
2035
- groundingMetadata: (_p = candidate == null ? void 0 : candidate.groundingMetadata) != null ? _p : null,
2036
- urlContextMetadata: (_q = candidate == null ? void 0 : candidate.urlContextMetadata) != null ? _q : null,
2037
- safetyRatings: (_r = candidate == null ? void 0 : candidate.safetyRatings) != null ? _r : null,
2040
+ promptFeedback: (_n = response.promptFeedback) != null ? _n : null,
2041
+ groundingMetadata: (_o = candidate == null ? void 0 : candidate.groundingMetadata) != null ? _o : null,
2042
+ urlContextMetadata: (_p = candidate == null ? void 0 : candidate.urlContextMetadata) != null ? _p : null,
2043
+ safetyRatings: (_q = candidate == null ? void 0 : candidate.safetyRatings) != null ? _q : null,
2038
2044
  usageMetadata: usageMetadata != null ? usageMetadata : null,
2039
- finishMessage: (_s = candidate == null ? void 0 : candidate.finishMessage) != null ? _s : null,
2040
- serviceTier: (_t = usageMetadata == null ? void 0 : usageMetadata.serviceTier) != null ? _t : null
2045
+ finishMessage: (_r = candidate == null ? void 0 : candidate.finishMessage) != null ? _r : null,
2046
+ serviceTier: (_s = usageMetadata == null ? void 0 : usageMetadata.serviceTier) != null ? _s : null
2041
2047
  }),
2042
2048
  response: {
2043
2049
  // TODO timestamp, model id
2044
- id: (_u = response.responseId) != null ? _u : void 0
2050
+ id: (_t = response.responseId) != null ? _t : void 0
2045
2051
  }
2046
2052
  };
2047
2053
  }
@@ -2122,9 +2128,12 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2122
2128
  raw: void 0
2123
2129
  };
2124
2130
  let usage = void 0;
2125
- let providerMetadata = void 0;
2131
+ let promptFeedback = null;
2126
2132
  let lastGroundingMetadata = null;
2127
2133
  let lastUrlContextMetadata = null;
2134
+ let lastSafetyRatings = null;
2135
+ let lastFinishMessage = null;
2136
+ let confirmedPromptBlockReason;
2128
2137
  const generateId4 = this.config.generateId;
2129
2138
  let hasToolCalls = false;
2130
2139
  let hasEmittedResponseMetadata = false;
@@ -2170,7 +2179,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2170
2179
  controller.enqueue({ type: "stream-start", warnings });
2171
2180
  },
2172
2181
  transform(chunk, controller) {
2173
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
2182
+ var _a, _b, _c, _d, _e, _f, _g;
2174
2183
  if (options.includeRawChunks) {
2175
2184
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
2176
2185
  }
@@ -2190,33 +2199,35 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2190
2199
  if (usageMetadata != null) {
2191
2200
  usage = usageMetadata;
2192
2201
  }
2193
- const candidate = (_a = value.candidates) == null ? void 0 : _a[0];
2194
- if (candidate == null) {
2195
- const promptBlockReason2 = (_b = value.promptFeedback) == null ? void 0 : _b.blockReason;
2196
- if (promptBlockReason2 != null) {
2202
+ if (value.promptFeedback != null && confirmedPromptBlockReason == null) {
2203
+ promptFeedback = value.promptFeedback;
2204
+ if (isConfirmedPromptBlockReason(value.promptFeedback.blockReason)) {
2205
+ confirmedPromptBlockReason = value.promptFeedback.blockReason;
2197
2206
  finishReason = {
2198
2207
  unified: "content-filter",
2199
- raw: promptBlockReason2
2208
+ raw: confirmedPromptBlockReason
2200
2209
  };
2201
- providerMetadata = wrapProviderMetadata({
2202
- promptFeedback: (_c = value.promptFeedback) != null ? _c : null,
2203
- groundingMetadata: lastGroundingMetadata,
2204
- urlContextMetadata: lastUrlContextMetadata,
2205
- safetyRatings: null,
2206
- usageMetadata: usageMetadata != null ? usageMetadata : null,
2207
- finishMessage: null,
2208
- serviceTier: (_d = usage == null ? void 0 : usage.serviceTier) != null ? _d : null
2209
- });
2210
2210
  }
2211
- return;
2212
2211
  }
2213
- const content = candidate.content;
2214
- if (candidate.groundingMetadata != null) {
2215
- lastGroundingMetadata = candidate.groundingMetadata;
2212
+ const candidate = (_a = value.candidates) == null ? void 0 : _a[0];
2213
+ if (candidate != null) {
2214
+ if (candidate.groundingMetadata != null) {
2215
+ lastGroundingMetadata = candidate.groundingMetadata;
2216
+ }
2217
+ if (candidate.urlContextMetadata != null) {
2218
+ lastUrlContextMetadata = candidate.urlContextMetadata;
2219
+ }
2220
+ if (candidate.safetyRatings != null) {
2221
+ lastSafetyRatings = candidate.safetyRatings;
2222
+ }
2223
+ if (candidate.finishMessage != null) {
2224
+ lastFinishMessage = candidate.finishMessage;
2225
+ }
2216
2226
  }
2217
- if (candidate.urlContextMetadata != null) {
2218
- lastUrlContextMetadata = candidate.urlContextMetadata;
2227
+ if (confirmedPromptBlockReason != null || candidate == null) {
2228
+ return;
2219
2229
  }
2230
+ const content = candidate.content;
2220
2231
  const sources = extractSources({
2221
2232
  groundingMetadata: candidate.groundingMetadata,
2222
2233
  generateId: generateId4
@@ -2230,9 +2241,9 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2230
2241
  }
2231
2242
  }
2232
2243
  if (content != null) {
2233
- const parts = (_e = content.parts) != null ? _e : [];
2244
+ const parts = (_b = content.parts) != null ? _b : [];
2234
2245
  for (const part of parts) {
2235
- if ("executableCode" in part && ((_f = part.executableCode) == null ? void 0 : _f.code)) {
2246
+ if ("executableCode" in part && ((_c = part.executableCode) == null ? void 0 : _c.code)) {
2236
2247
  const toolCallId = generateId4();
2237
2248
  lastCodeExecutionToolCallId = toolCallId;
2238
2249
  controller.enqueue({
@@ -2251,7 +2262,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2251
2262
  toolName: toolNameMapping.toCustomToolName("code_execution"),
2252
2263
  result: {
2253
2264
  outcome: part.codeExecutionResult.outcome,
2254
- output: (_g = part.codeExecutionResult.output) != null ? _g : ""
2265
+ output: (_d = part.codeExecutionResult.output) != null ? _d : ""
2255
2266
  }
2256
2267
  });
2257
2268
  }
@@ -2351,7 +2362,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2351
2362
  type: "tool-call",
2352
2363
  toolCallId,
2353
2364
  toolName: `server:${part.toolCall.toolType}`,
2354
- input: JSON.stringify((_h = part.toolCall.args) != null ? _h : {}),
2365
+ input: JSON.stringify((_e = part.toolCall.args) != null ? _e : {}),
2355
2366
  providerExecuted: true,
2356
2367
  dynamic: true,
2357
2368
  providerMetadata: serverMeta
@@ -2367,7 +2378,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2367
2378
  type: "tool-result",
2368
2379
  toolCallId: responseToolCallId,
2369
2380
  toolName: `server:${part.toolResponse.toolType}`,
2370
- result: (_i = part.toolResponse.response) != null ? _i : {},
2381
+ result: (_f = part.toolResponse.response) != null ? _f : {},
2371
2382
  providerMetadata: serverMeta
2372
2383
  });
2373
2384
  lastServerToolCallId = void 0;
@@ -2434,7 +2445,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2434
2445
  } else if (isCompleteCall) {
2435
2446
  const toolCallId = part.functionCall.id || generateId4();
2436
2447
  const toolName = part.functionCall.name;
2437
- const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((_j = part.functionCall.args) != null ? _j : {});
2448
+ const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((_g = part.functionCall.args) != null ? _g : {});
2438
2449
  controller.enqueue({
2439
2450
  type: "tool-input-start",
2440
2451
  id: toolCallId,
@@ -2485,29 +2496,18 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2485
2496
  }
2486
2497
  }
2487
2498
  }
2488
- const promptBlockReason = (_k = value.promptFeedback) == null ? void 0 : _k.blockReason;
2489
- const isPromptBlocked = candidate.finishReason == null && promptBlockReason != null;
2490
- const rawFinishReason = (_m = (_l = candidate.finishReason) != null ? _l : promptBlockReason) != null ? _m : void 0;
2491
- if (rawFinishReason != null) {
2499
+ if (candidate.finishReason != null) {
2492
2500
  finishReason = {
2493
- unified: isPromptBlocked ? "content-filter" : mapGoogleFinishReason({
2494
- finishReason: rawFinishReason,
2501
+ unified: mapGoogleFinishReason({
2502
+ finishReason: candidate.finishReason,
2495
2503
  hasToolCalls
2496
2504
  }),
2497
- raw: rawFinishReason
2505
+ raw: candidate.finishReason
2498
2506
  };
2499
- providerMetadata = wrapProviderMetadata({
2500
- promptFeedback: (_n = value.promptFeedback) != null ? _n : null,
2501
- groundingMetadata: lastGroundingMetadata,
2502
- urlContextMetadata: lastUrlContextMetadata,
2503
- safetyRatings: (_o = candidate.safetyRatings) != null ? _o : null,
2504
- usageMetadata: usageMetadata != null ? usageMetadata : null,
2505
- finishMessage: (_p = candidate.finishMessage) != null ? _p : null,
2506
- serviceTier: (_q = usage == null ? void 0 : usage.serviceTier) != null ? _q : null
2507
- });
2508
2507
  }
2509
2508
  },
2510
2509
  flush(controller) {
2510
+ var _a;
2511
2511
  if (currentTextBlockId !== null) {
2512
2512
  controller.enqueue({
2513
2513
  type: "text-end",
@@ -2524,7 +2524,15 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2524
2524
  type: "finish",
2525
2525
  finishReason,
2526
2526
  usage: convertGoogleUsage(usage),
2527
- providerMetadata
2527
+ providerMetadata: wrapProviderMetadata({
2528
+ promptFeedback,
2529
+ groundingMetadata: lastGroundingMetadata,
2530
+ urlContextMetadata: lastUrlContextMetadata,
2531
+ safetyRatings: lastSafetyRatings,
2532
+ usageMetadata: usage != null ? usage : null,
2533
+ finishMessage: lastFinishMessage,
2534
+ serviceTier: (_a = usage == null ? void 0 : usage.serviceTier) != null ? _a : null
2535
+ })
2528
2536
  });
2529
2537
  }
2530
2538
  })
@@ -2905,6 +2913,9 @@ var chunkSchema = lazySchema5(
2905
2913
  })
2906
2914
  )
2907
2915
  );
2916
+ function isConfirmedPromptBlockReason(blockReason) {
2917
+ return blockReason != null && blockReason !== "" && blockReason !== "BLOCK_REASON_UNSPECIFIED" && blockReason !== "BLOCKED_REASON_UNSPECIFIED";
2918
+ }
2908
2919
 
2909
2920
  // src/google-image-model-options.ts
2910
2921
  import { lazySchema as lazySchema7, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
@@ -3851,7 +3862,7 @@ var GoogleImageModel = class _GoogleImageModel {
3851
3862
  if (this.settings.maxImagesPerCall != null) {
3852
3863
  return this.settings.maxImagesPerCall;
3853
3864
  }
3854
- return 10;
3865
+ return 1;
3855
3866
  }
3856
3867
  get provider() {
3857
3868
  return this.config.provider;
@@ -3865,7 +3876,6 @@ var GoogleImageModel = class _GoogleImageModel {
3865
3876
  }
3866
3877
  const {
3867
3878
  prompt,
3868
- n,
3869
3879
  size,
3870
3880
  aspectRatio,
3871
3881
  seed,
@@ -3881,11 +3891,6 @@ var GoogleImageModel = class _GoogleImageModel {
3881
3891
  "Gemini image models do not support mask-based image editing."
3882
3892
  );
3883
3893
  }
3884
- if (n != null && n > 1) {
3885
- throw new Error(
3886
- "Gemini image models do not support generating a set number of images per call. Use n=1 or omit the n parameter."
3887
- );
3888
- }
3889
3894
  if (size != null) {
3890
3895
  warnings.push({
3891
3896
  type: "unsupported",
@@ -9484,6 +9489,10 @@ function createGoogle(options = {}) {
9484
9489
  provider.languageModel = createChatModel;
9485
9490
  provider.chat = createChatModel;
9486
9491
  provider.generativeAI = createChatModel;
9492
+ provider.evaluationModel = (modelId) => new EvaluationLanguageModel({
9493
+ model: createChatModel(modelId),
9494
+ provider: `${providerName.replace(/\.generative-ai$/, "")}.evaluation`
9495
+ });
9487
9496
  provider.experimental_batch = createBatch;
9488
9497
  provider.embedding = createEmbeddingModel;
9489
9498
  provider.embeddingModel = createEmbeddingModel;