@depup/ai-sdk__google 4.0.72-depup.0 → 4.0.74-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,32 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 4.0.74
4
+
5
+ ### Patch Changes
6
+
7
+ - 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.
8
+ - Updated dependencies [215b25e]
9
+ - Updated dependencies [d4d96bf]
10
+ - Updated dependencies [a7dd893]
11
+ - Updated dependencies [3456e2c]
12
+ - Updated dependencies [c4e76de]
13
+ - @ai-sdk/provider-utils@5.0.43
14
+ - @ai-sdk/provider@4.0.17
15
+
16
+ ## 4.0.73
17
+
18
+ ### Patch Changes
19
+
20
+ - a22b5b2: fix(google): preserve prompt feedback and metadata across streaming chunks
21
+ - 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.
22
+ - Updated dependencies [91c2128]
23
+ - Updated dependencies [2cd80b3]
24
+ - Updated dependencies [d06bb2a]
25
+ - Updated dependencies [123d71f]
26
+ - Updated dependencies [2fa5e0e]
27
+ - @ai-sdk/provider-utils@5.0.42
28
+ - @ai-sdk/provider@4.0.16
29
+
3
30
  ## 4.0.72
4
31
 
5
32
  ### 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.74 |
17
+ | Processed | 2026-09-17 |
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-17T00:30:59.000Z",
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: {
@@ -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.74" : "0.0.0-test";
11
12
 
12
13
  // src/google-embedding-model.ts
13
14
  import {
@@ -2122,9 +2123,12 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2122
2123
  raw: void 0
2123
2124
  };
2124
2125
  let usage = void 0;
2125
- let providerMetadata = void 0;
2126
+ let promptFeedback = null;
2126
2127
  let lastGroundingMetadata = null;
2127
2128
  let lastUrlContextMetadata = null;
2129
+ let lastSafetyRatings = null;
2130
+ let lastFinishMessage = null;
2131
+ let confirmedPromptBlockReason;
2128
2132
  const generateId4 = this.config.generateId;
2129
2133
  let hasToolCalls = false;
2130
2134
  let hasEmittedResponseMetadata = false;
@@ -2170,7 +2174,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2170
2174
  controller.enqueue({ type: "stream-start", warnings });
2171
2175
  },
2172
2176
  transform(chunk, controller) {
2173
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
2177
+ var _a, _b, _c, _d, _e, _f, _g;
2174
2178
  if (options.includeRawChunks) {
2175
2179
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
2176
2180
  }
@@ -2190,33 +2194,35 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2190
2194
  if (usageMetadata != null) {
2191
2195
  usage = usageMetadata;
2192
2196
  }
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) {
2197
+ if (value.promptFeedback != null && confirmedPromptBlockReason == null) {
2198
+ promptFeedback = value.promptFeedback;
2199
+ if (isConfirmedPromptBlockReason(value.promptFeedback.blockReason)) {
2200
+ confirmedPromptBlockReason = value.promptFeedback.blockReason;
2197
2201
  finishReason = {
2198
2202
  unified: "content-filter",
2199
- raw: promptBlockReason2
2203
+ raw: confirmedPromptBlockReason
2200
2204
  };
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
2205
  }
2211
- return;
2212
2206
  }
2213
- const content = candidate.content;
2214
- if (candidate.groundingMetadata != null) {
2215
- lastGroundingMetadata = candidate.groundingMetadata;
2207
+ const candidate = (_a = value.candidates) == null ? void 0 : _a[0];
2208
+ if (candidate != null) {
2209
+ if (candidate.groundingMetadata != null) {
2210
+ lastGroundingMetadata = candidate.groundingMetadata;
2211
+ }
2212
+ if (candidate.urlContextMetadata != null) {
2213
+ lastUrlContextMetadata = candidate.urlContextMetadata;
2214
+ }
2215
+ if (candidate.safetyRatings != null) {
2216
+ lastSafetyRatings = candidate.safetyRatings;
2217
+ }
2218
+ if (candidate.finishMessage != null) {
2219
+ lastFinishMessage = candidate.finishMessage;
2220
+ }
2216
2221
  }
2217
- if (candidate.urlContextMetadata != null) {
2218
- lastUrlContextMetadata = candidate.urlContextMetadata;
2222
+ if (confirmedPromptBlockReason != null || candidate == null) {
2223
+ return;
2219
2224
  }
2225
+ const content = candidate.content;
2220
2226
  const sources = extractSources({
2221
2227
  groundingMetadata: candidate.groundingMetadata,
2222
2228
  generateId: generateId4
@@ -2230,9 +2236,9 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2230
2236
  }
2231
2237
  }
2232
2238
  if (content != null) {
2233
- const parts = (_e = content.parts) != null ? _e : [];
2239
+ const parts = (_b = content.parts) != null ? _b : [];
2234
2240
  for (const part of parts) {
2235
- if ("executableCode" in part && ((_f = part.executableCode) == null ? void 0 : _f.code)) {
2241
+ if ("executableCode" in part && ((_c = part.executableCode) == null ? void 0 : _c.code)) {
2236
2242
  const toolCallId = generateId4();
2237
2243
  lastCodeExecutionToolCallId = toolCallId;
2238
2244
  controller.enqueue({
@@ -2251,7 +2257,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2251
2257
  toolName: toolNameMapping.toCustomToolName("code_execution"),
2252
2258
  result: {
2253
2259
  outcome: part.codeExecutionResult.outcome,
2254
- output: (_g = part.codeExecutionResult.output) != null ? _g : ""
2260
+ output: (_d = part.codeExecutionResult.output) != null ? _d : ""
2255
2261
  }
2256
2262
  });
2257
2263
  }
@@ -2351,7 +2357,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2351
2357
  type: "tool-call",
2352
2358
  toolCallId,
2353
2359
  toolName: `server:${part.toolCall.toolType}`,
2354
- input: JSON.stringify((_h = part.toolCall.args) != null ? _h : {}),
2360
+ input: JSON.stringify((_e = part.toolCall.args) != null ? _e : {}),
2355
2361
  providerExecuted: true,
2356
2362
  dynamic: true,
2357
2363
  providerMetadata: serverMeta
@@ -2367,7 +2373,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2367
2373
  type: "tool-result",
2368
2374
  toolCallId: responseToolCallId,
2369
2375
  toolName: `server:${part.toolResponse.toolType}`,
2370
- result: (_i = part.toolResponse.response) != null ? _i : {},
2376
+ result: (_f = part.toolResponse.response) != null ? _f : {},
2371
2377
  providerMetadata: serverMeta
2372
2378
  });
2373
2379
  lastServerToolCallId = void 0;
@@ -2434,7 +2440,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2434
2440
  } else if (isCompleteCall) {
2435
2441
  const toolCallId = part.functionCall.id || generateId4();
2436
2442
  const toolName = part.functionCall.name;
2437
- const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((_j = part.functionCall.args) != null ? _j : {});
2443
+ const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((_g = part.functionCall.args) != null ? _g : {});
2438
2444
  controller.enqueue({
2439
2445
  type: "tool-input-start",
2440
2446
  id: toolCallId,
@@ -2485,29 +2491,18 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2485
2491
  }
2486
2492
  }
2487
2493
  }
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) {
2494
+ if (candidate.finishReason != null) {
2492
2495
  finishReason = {
2493
- unified: isPromptBlocked ? "content-filter" : mapGoogleFinishReason({
2494
- finishReason: rawFinishReason,
2496
+ unified: mapGoogleFinishReason({
2497
+ finishReason: candidate.finishReason,
2495
2498
  hasToolCalls
2496
2499
  }),
2497
- raw: rawFinishReason
2500
+ raw: candidate.finishReason
2498
2501
  };
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
2502
  }
2509
2503
  },
2510
2504
  flush(controller) {
2505
+ var _a;
2511
2506
  if (currentTextBlockId !== null) {
2512
2507
  controller.enqueue({
2513
2508
  type: "text-end",
@@ -2524,7 +2519,15 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2524
2519
  type: "finish",
2525
2520
  finishReason,
2526
2521
  usage: convertGoogleUsage(usage),
2527
- providerMetadata
2522
+ providerMetadata: wrapProviderMetadata({
2523
+ promptFeedback,
2524
+ groundingMetadata: lastGroundingMetadata,
2525
+ urlContextMetadata: lastUrlContextMetadata,
2526
+ safetyRatings: lastSafetyRatings,
2527
+ usageMetadata: usage != null ? usage : null,
2528
+ finishMessage: lastFinishMessage,
2529
+ serviceTier: (_a = usage == null ? void 0 : usage.serviceTier) != null ? _a : null
2530
+ })
2528
2531
  });
2529
2532
  }
2530
2533
  })
@@ -2905,6 +2908,9 @@ var chunkSchema = lazySchema5(
2905
2908
  })
2906
2909
  )
2907
2910
  );
2911
+ function isConfirmedPromptBlockReason(blockReason) {
2912
+ return blockReason != null && blockReason !== "" && blockReason !== "BLOCK_REASON_UNSPECIFIED" && blockReason !== "BLOCKED_REASON_UNSPECIFIED";
2913
+ }
2908
2914
 
2909
2915
  // src/google-image-model-options.ts
2910
2916
  import { lazySchema as lazySchema7, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
@@ -9484,6 +9490,10 @@ function createGoogle(options = {}) {
9484
9490
  provider.languageModel = createChatModel;
9485
9491
  provider.chat = createChatModel;
9486
9492
  provider.generativeAI = createChatModel;
9493
+ provider.evaluationModel = (modelId) => new EvaluationLanguageModel({
9494
+ model: createChatModel(modelId),
9495
+ provider: `${providerName.replace(/\.generative-ai$/, "")}.evaluation`
9496
+ });
9487
9497
  provider.experimental_batch = createBatch;
9488
9498
  provider.embedding = createEmbeddingModel;
9489
9499
  provider.embeddingModel = createEmbeddingModel;