@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/dist/internal/index.js
CHANGED
|
@@ -2257,21 +2257,23 @@ function resolveThinkingConfig({
|
|
|
2257
2257
|
return void 0;
|
|
2258
2258
|
}
|
|
2259
2259
|
if (getGoogleModelCapabilities(modelId).usesGemini3Features && !modelId.includes("gemini-3-pro-image")) {
|
|
2260
|
-
return resolveGemini3ThinkingConfig({ reasoning, warnings });
|
|
2260
|
+
return resolveGemini3ThinkingConfig({ reasoning, modelId, warnings });
|
|
2261
2261
|
}
|
|
2262
2262
|
return resolveGemini25ThinkingConfig({ reasoning, modelId, warnings });
|
|
2263
2263
|
}
|
|
2264
2264
|
function resolveGemini3ThinkingConfig({
|
|
2265
2265
|
reasoning,
|
|
2266
|
+
modelId,
|
|
2266
2267
|
warnings
|
|
2267
2268
|
}) {
|
|
2269
|
+
const minimumThinkingLevel = getMinimumThinkingLevelForGemini3Model(modelId);
|
|
2268
2270
|
if (reasoning === "none") {
|
|
2269
|
-
return { thinkingLevel:
|
|
2271
|
+
return { thinkingLevel: minimumThinkingLevel };
|
|
2270
2272
|
}
|
|
2271
2273
|
const thinkingLevel = mapReasoningToProviderEffort({
|
|
2272
2274
|
reasoning,
|
|
2273
2275
|
effortMap: {
|
|
2274
|
-
minimal:
|
|
2276
|
+
minimal: minimumThinkingLevel,
|
|
2275
2277
|
low: "low",
|
|
2276
2278
|
medium: "medium",
|
|
2277
2279
|
high: "high",
|
|
@@ -2284,6 +2286,22 @@ function resolveGemini3ThinkingConfig({
|
|
|
2284
2286
|
}
|
|
2285
2287
|
return { thinkingLevel };
|
|
2286
2288
|
}
|
|
2289
|
+
function getMinimumThinkingLevelForGemini3Model(modelId) {
|
|
2290
|
+
var _a;
|
|
2291
|
+
const modelName = (_a = modelId.split("/").at(-1)) == null ? void 0 : _a.toLowerCase();
|
|
2292
|
+
if (modelName === "gemini-flash-latest") {
|
|
2293
|
+
return "low";
|
|
2294
|
+
}
|
|
2295
|
+
const versionMatch = /^gemini-(\d+)\.(\d+)-flash(?:$|-(?!lite(?:-|$)))/.exec(
|
|
2296
|
+
modelName != null ? modelName : ""
|
|
2297
|
+
);
|
|
2298
|
+
if (versionMatch == null) {
|
|
2299
|
+
return "minimal";
|
|
2300
|
+
}
|
|
2301
|
+
const majorVersion = Number(versionMatch[1]);
|
|
2302
|
+
const minorVersion = Number(versionMatch[2]);
|
|
2303
|
+
return majorVersion > 3 || majorVersion === 3 && minorVersion >= 7 ? "low" : "minimal";
|
|
2304
|
+
}
|
|
2287
2305
|
function resolveGemini25ThinkingConfig({
|
|
2288
2306
|
reasoning,
|
|
2289
2307
|
modelId,
|