@ai-sdk/google 4.0.44 → 4.0.46
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 +12 -0
- package/dist/index.js +22 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +21 -3
- package/dist/internal/index.js.map +1 -1
- package/docs/15-google.mdx +36 -36
- package/package.json +1 -1
- package/src/google-language-model.ts +32 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 4.0.46
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f69920a: fix(google): use low as the minimum reasoning level for full Gemini Flash 3.7 and later
|
|
8
|
+
|
|
9
|
+
## 4.0.45
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- bb0cf2e: fix(google): coerce minimal reasoning to low for Gemini 3.7 Flash
|
|
14
|
+
|
|
3
15
|
## 4.0.44
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var VERSION = true ? "4.0.
|
|
10
|
+
var VERSION = true ? "4.0.46" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -2486,21 +2486,23 @@ function resolveThinkingConfig({
|
|
|
2486
2486
|
return void 0;
|
|
2487
2487
|
}
|
|
2488
2488
|
if (getGoogleModelCapabilities(modelId).usesGemini3Features && !modelId.includes("gemini-3-pro-image")) {
|
|
2489
|
-
return resolveGemini3ThinkingConfig({ reasoning, warnings });
|
|
2489
|
+
return resolveGemini3ThinkingConfig({ reasoning, modelId, warnings });
|
|
2490
2490
|
}
|
|
2491
2491
|
return resolveGemini25ThinkingConfig({ reasoning, modelId, warnings });
|
|
2492
2492
|
}
|
|
2493
2493
|
function resolveGemini3ThinkingConfig({
|
|
2494
2494
|
reasoning,
|
|
2495
|
+
modelId,
|
|
2495
2496
|
warnings
|
|
2496
2497
|
}) {
|
|
2498
|
+
const minimumThinkingLevel = getMinimumThinkingLevelForGemini3Model(modelId);
|
|
2497
2499
|
if (reasoning === "none") {
|
|
2498
|
-
return { thinkingLevel:
|
|
2500
|
+
return { thinkingLevel: minimumThinkingLevel };
|
|
2499
2501
|
}
|
|
2500
2502
|
const thinkingLevel = mapReasoningToProviderEffort({
|
|
2501
2503
|
reasoning,
|
|
2502
2504
|
effortMap: {
|
|
2503
|
-
minimal:
|
|
2505
|
+
minimal: minimumThinkingLevel,
|
|
2504
2506
|
low: "low",
|
|
2505
2507
|
medium: "medium",
|
|
2506
2508
|
high: "high",
|
|
@@ -2513,6 +2515,22 @@ function resolveGemini3ThinkingConfig({
|
|
|
2513
2515
|
}
|
|
2514
2516
|
return { thinkingLevel };
|
|
2515
2517
|
}
|
|
2518
|
+
function getMinimumThinkingLevelForGemini3Model(modelId) {
|
|
2519
|
+
var _a;
|
|
2520
|
+
const modelName = (_a = modelId.split("/").at(-1)) == null ? void 0 : _a.toLowerCase();
|
|
2521
|
+
if (modelName === "gemini-flash-latest") {
|
|
2522
|
+
return "low";
|
|
2523
|
+
}
|
|
2524
|
+
const versionMatch = /^gemini-(\d+)\.(\d+)-flash(?:$|-(?!lite(?:-|$)))/.exec(
|
|
2525
|
+
modelName != null ? modelName : ""
|
|
2526
|
+
);
|
|
2527
|
+
if (versionMatch == null) {
|
|
2528
|
+
return "minimal";
|
|
2529
|
+
}
|
|
2530
|
+
const majorVersion = Number(versionMatch[1]);
|
|
2531
|
+
const minorVersion = Number(versionMatch[2]);
|
|
2532
|
+
return majorVersion > 3 || majorVersion === 3 && minorVersion >= 7 ? "low" : "minimal";
|
|
2533
|
+
}
|
|
2516
2534
|
function resolveGemini25ThinkingConfig({
|
|
2517
2535
|
reasoning,
|
|
2518
2536
|
modelId,
|