@depup/ai-sdk__google 4.0.70-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 +54 -0
- package/README.md +2 -2
- package/changes.json +1 -1
- package/dist/index.d.ts +38 -1
- package/dist/index.js +89 -50
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +50 -45
- package/dist/internal/index.js.map +1 -1
- package/docs/15-google.mdx +95 -0
- package/package.json +5 -5
- package/src/google-language-model.ts +61 -47
- package/src/google-provider.ts +10 -0
- package/src/realtime/google-realtime-event-mapper.ts +63 -6
- package/src/realtime/google-realtime-model-options.ts +39 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
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
|
+
|
|
30
|
+
## 4.0.72
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- 4a994ad: feat(google): realtime session options for Gemini 3.8 Live
|
|
35
|
+
|
|
36
|
+
Add `thinkingConfig` (`thinkingLevel`, `thinkingBudget`, `includeThoughts`) and
|
|
37
|
+
`defaultToolBehavior` to `GoogleRealtimeModelOptions`. `thinkingConfig` is merged
|
|
38
|
+
into the Live `setup.generationConfig`. Background-reasoning Live models such as
|
|
39
|
+
`gemini-3.8-live-extended-thinking` require exactly one of `thinkingLevel` or
|
|
40
|
+
`thinkingBudget`, so the provider sends `thinkingLevel: 'low'` on those models
|
|
41
|
+
when neither is set. `defaultToolBehavior` stamps `behavior` on every function
|
|
42
|
+
declaration in the setup.
|
|
43
|
+
|
|
44
|
+
Forward the Live `interactionStatus` and `waitingForInput` server messages as
|
|
45
|
+
custom events so applications can tell when a background-reasoning model is idle,
|
|
46
|
+
since `turnComplete` alone no longer means that.
|
|
47
|
+
|
|
48
|
+
## 4.0.71
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- Updated dependencies [5c0054d]
|
|
53
|
+
- Updated dependencies [39535af]
|
|
54
|
+
- @ai-sdk/provider@4.0.15
|
|
55
|
+
- @ai-sdk/provider-utils@5.0.41
|
|
56
|
+
|
|
3
57
|
## 4.0.70
|
|
4
58
|
|
|
5
59
|
### 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.
|
|
17
|
-
| Processed | 2026-09-
|
|
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
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;
|
|
@@ -762,6 +764,41 @@ type GoogleRealtimeModelOptions = {
|
|
|
762
764
|
*/
|
|
763
765
|
echoTargetLanguage?: boolean;
|
|
764
766
|
};
|
|
767
|
+
/**
|
|
768
|
+
* Gemini Live thinking configuration.
|
|
769
|
+
*
|
|
770
|
+
* Supported by Live models with background reasoning (e.g.
|
|
771
|
+
* `gemini-3.8-live-extended-thinking`), which can process multi-step
|
|
772
|
+
* reasoning and function calls while streaming audio responses. Not
|
|
773
|
+
* supported by latency-optimized models (e.g. `gemini-3.8-live`).
|
|
774
|
+
*/
|
|
775
|
+
thinkingConfig?: {
|
|
776
|
+
/**
|
|
777
|
+
* Thinking effort level. Background-reasoning Live models require exactly
|
|
778
|
+
* one of `thinkingLevel` or `thinkingBudget`; when neither is set, the
|
|
779
|
+
* provider sends `thinkingLevel: 'low'` on those models.
|
|
780
|
+
*/
|
|
781
|
+
thinkingLevel?: 'low' | 'medium' | 'high';
|
|
782
|
+
/**
|
|
783
|
+
* Token budget for background thinking. Mutually exclusive with
|
|
784
|
+
* `thinkingLevel`; setting it suppresses the default level.
|
|
785
|
+
*/
|
|
786
|
+
thinkingBudget?: number;
|
|
787
|
+
/**
|
|
788
|
+
* Whether thought summaries should be included in the response.
|
|
789
|
+
*/
|
|
790
|
+
includeThoughts?: boolean;
|
|
791
|
+
};
|
|
792
|
+
/**
|
|
793
|
+
* Default `behavior` stamped onto every function declaration in the
|
|
794
|
+
* session setup.
|
|
795
|
+
*
|
|
796
|
+
* Gemini 3.8 Live models default to `NON_BLOCKING` (asynchronous) function
|
|
797
|
+
* calling. Set to `BLOCKING` for synchronous calls on models that support it
|
|
798
|
+
* (e.g. `gemini-3.8-live`); background-reasoning models accept only
|
|
799
|
+
* `NON_BLOCKING`.
|
|
800
|
+
*/
|
|
801
|
+
defaultToolBehavior?: 'BLOCKING' | 'NON_BLOCKING';
|
|
765
802
|
};
|
|
766
803
|
|
|
767
804
|
interface GoogleTranscriptionModelConfig {
|
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.
|
|
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
|
|
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
|
|
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
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
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:
|
|
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
|
|
2214
|
-
if (candidate
|
|
2215
|
-
|
|
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 (
|
|
2218
|
-
|
|
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 = (
|
|
2239
|
+
const parts = (_b = content.parts) != null ? _b : [];
|
|
2234
2240
|
for (const part of parts) {
|
|
2235
|
-
if ("executableCode" in part && ((
|
|
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: (
|
|
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((
|
|
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: (
|
|
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((
|
|
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
|
-
|
|
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:
|
|
2494
|
-
finishReason:
|
|
2496
|
+
unified: mapGoogleFinishReason({
|
|
2497
|
+
finishReason: candidate.finishReason,
|
|
2495
2498
|
hasToolCalls
|
|
2496
2499
|
}),
|
|
2497
|
-
raw:
|
|
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";
|
|
@@ -8057,6 +8063,20 @@ var GoogleRealtimeEventMapper = class {
|
|
|
8057
8063
|
raw
|
|
8058
8064
|
});
|
|
8059
8065
|
}
|
|
8066
|
+
if (serverContent.interactionStatus != null) {
|
|
8067
|
+
events.push({
|
|
8068
|
+
type: "custom",
|
|
8069
|
+
rawType: "interactionStatus",
|
|
8070
|
+
raw
|
|
8071
|
+
});
|
|
8072
|
+
}
|
|
8073
|
+
if (serverContent.waitingForInput) {
|
|
8074
|
+
events.push({
|
|
8075
|
+
type: "custom",
|
|
8076
|
+
rawType: "waitingForInput",
|
|
8077
|
+
raw
|
|
8078
|
+
});
|
|
8079
|
+
}
|
|
8060
8080
|
if (serverContent.turnComplete) {
|
|
8061
8081
|
if (this.hasAudio) {
|
|
8062
8082
|
events.push({
|
|
@@ -8167,10 +8187,18 @@ async function serializeFunctionCallOutput(item) {
|
|
|
8167
8187
|
}
|
|
8168
8188
|
};
|
|
8169
8189
|
}
|
|
8190
|
+
function isThinkingLiveModel(modelId) {
|
|
8191
|
+
var _a, _b;
|
|
8192
|
+
const modelName = (_b = (_a = modelId.split("/").at(-1)) == null ? void 0 : _a.toLowerCase()) != null ? _b : "";
|
|
8193
|
+
return /^gemini-\d+\.\d+-live\b.*thinking/.test(modelName);
|
|
8194
|
+
}
|
|
8170
8195
|
function buildGoogleSessionConfig(config, modelId) {
|
|
8196
|
+
var _a, _b;
|
|
8171
8197
|
const setup = {
|
|
8172
8198
|
model: getModelPath(modelId)
|
|
8173
8199
|
};
|
|
8200
|
+
const { google: google2, ...restProviderOptions } = (_a = config == null ? void 0 : config.providerOptions) != null ? _a : {};
|
|
8201
|
+
const googleOptions = isRecord(google2) ? google2 : void 0;
|
|
8174
8202
|
const generationConfig = {};
|
|
8175
8203
|
if ((config == null ? void 0 : config.outputModalities) != null) {
|
|
8176
8204
|
generationConfig.responseModalities = config.outputModalities.map(
|
|
@@ -8200,7 +8228,8 @@ function buildGoogleSessionConfig(config, modelId) {
|
|
|
8200
8228
|
functionDeclarations: config.tools.map((tool) => ({
|
|
8201
8229
|
name: tool.name,
|
|
8202
8230
|
description: tool.description,
|
|
8203
|
-
parametersJsonSchema: tool.parameters
|
|
8231
|
+
parametersJsonSchema: tool.parameters,
|
|
8232
|
+
...(googleOptions == null ? void 0 : googleOptions.defaultToolBehavior) != null ? { behavior: googleOptions.defaultToolBehavior } : {}
|
|
8204
8233
|
}))
|
|
8205
8234
|
}
|
|
8206
8235
|
];
|
|
@@ -8211,12 +8240,17 @@ function buildGoogleSessionConfig(config, modelId) {
|
|
|
8211
8240
|
if ((config == null ? void 0 : config.outputAudioTranscription) != null) {
|
|
8212
8241
|
setup.outputAudioTranscription = {};
|
|
8213
8242
|
}
|
|
8243
|
+
const thinkingConfig = (_b = googleOptions == null ? void 0 : googleOptions.thinkingConfig) != null ? _b : isThinkingLiveModel(modelId) ? { thinkingLevel: "low" } : void 0;
|
|
8244
|
+
const applyThinkingConfig = () => {
|
|
8245
|
+
if (thinkingConfig == null) return;
|
|
8246
|
+
const target = isRecord(setup.generationConfig) ? setup.generationConfig : generationConfig;
|
|
8247
|
+
setup.generationConfig = { ...target, thinkingConfig };
|
|
8248
|
+
};
|
|
8214
8249
|
if ((config == null ? void 0 : config.providerOptions) == null) {
|
|
8250
|
+
applyThinkingConfig();
|
|
8215
8251
|
return setup;
|
|
8216
8252
|
}
|
|
8217
|
-
|
|
8218
|
-
Object.assign(setup, providerOptions);
|
|
8219
|
-
const googleOptions = isRecord(google2) ? google2 : void 0;
|
|
8253
|
+
Object.assign(setup, restProviderOptions);
|
|
8220
8254
|
if ((googleOptions == null ? void 0 : googleOptions.translationConfig) != null) {
|
|
8221
8255
|
const target = isRecord(setup.generationConfig) ? setup.generationConfig : generationConfig;
|
|
8222
8256
|
setup.generationConfig = {
|
|
@@ -8224,6 +8258,7 @@ function buildGoogleSessionConfig(config, modelId) {
|
|
|
8224
8258
|
translationConfig: googleOptions.translationConfig
|
|
8225
8259
|
};
|
|
8226
8260
|
}
|
|
8261
|
+
applyThinkingConfig();
|
|
8227
8262
|
return setup;
|
|
8228
8263
|
}
|
|
8229
8264
|
|
|
@@ -9455,6 +9490,10 @@ function createGoogle(options = {}) {
|
|
|
9455
9490
|
provider.languageModel = createChatModel;
|
|
9456
9491
|
provider.chat = createChatModel;
|
|
9457
9492
|
provider.generativeAI = createChatModel;
|
|
9493
|
+
provider.evaluationModel = (modelId) => new EvaluationLanguageModel({
|
|
9494
|
+
model: createChatModel(modelId),
|
|
9495
|
+
provider: `${providerName.replace(/\.generative-ai$/, "")}.evaluation`
|
|
9496
|
+
});
|
|
9458
9497
|
provider.experimental_batch = createBatch;
|
|
9459
9498
|
provider.embedding = createEmbeddingModel;
|
|
9460
9499
|
provider.embeddingModel = createEmbeddingModel;
|