@ai-sdk/google 4.0.45 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/google",
3
- "version": "4.0.45",
3
+ "version": "4.0.46",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -1188,9 +1188,7 @@ function resolveGemini3ThinkingConfig({
1188
1188
  modelId: string;
1189
1189
  warnings: SharedV4Warning[];
1190
1190
  }): Pick<GoogleThinkingConfig, 'thinkingLevel'> | undefined {
1191
- const minimumThinkingLevel = /(^|\/)gemini-3\.7-flash$/i.test(modelId)
1192
- ? 'low'
1193
- : 'minimal';
1191
+ const minimumThinkingLevel = getMinimumThinkingLevelForGemini3Model(modelId);
1194
1192
 
1195
1193
  if (reasoning === 'none') {
1196
1194
  // It's not possible to fully disable thinking with Gemini 3.
@@ -1216,6 +1214,31 @@ function resolveGemini3ThinkingConfig({
1216
1214
  return { thinkingLevel };
1217
1215
  }
1218
1216
 
1217
+ function getMinimumThinkingLevelForGemini3Model(
1218
+ modelId: string,
1219
+ ): 'minimal' | 'low' {
1220
+ const modelName = modelId.split('/').at(-1)?.toLowerCase();
1221
+
1222
+ if (modelName === 'gemini-flash-latest') {
1223
+ return 'low';
1224
+ }
1225
+
1226
+ const versionMatch = /^gemini-(\d+)\.(\d+)-flash(?:$|-(?!lite(?:-|$)))/.exec(
1227
+ modelName ?? '',
1228
+ );
1229
+
1230
+ if (versionMatch == null) {
1231
+ return 'minimal';
1232
+ }
1233
+
1234
+ const majorVersion = Number(versionMatch[1]);
1235
+ const minorVersion = Number(versionMatch[2]);
1236
+
1237
+ return majorVersion > 3 || (majorVersion === 3 && minorVersion >= 7)
1238
+ ? 'low'
1239
+ : 'minimal';
1240
+ }
1241
+
1219
1242
  function resolveGemini25ThinkingConfig({
1220
1243
  reasoning,
1221
1244
  modelId,