GeezerVison is showing github.com — fix(models): restore Sol-exclusive 'max' reasoning value; fix Gemini … · simstudioai/sim@6b4e02a
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/sim/providers/gemini/core.ts +10-1Lines changed: 10 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -26,6 +26,7 @@ import { | 26 | 26 | extractTextContent, | 27 | 27 | mapToThinkingBudget, | 28 | 28 | mapToThinkingLevel, | | 29 | + supportsDisablingGemini25Thinking, | 29 | 30 | } from '@/providers/google/utils' | 30 | 31 | import { enrichLastModelSegment } from '@/providers/trace-enrichment' | 31 | 32 | import type { | @@ -953,7 +954,7 @@ export async function executeGeminiRequest( | 953 | 954 | ) | 954 | 955 | } | 955 | 956 |
| 956 | | - // Configure thinking only when the user explicitly selects a thinking level. | | 957 | + // Configure thinking based on the user's selected level. | 957 | 958 | // Gemini 3.x accepts thinkingLevel directly; Gemini 2.5-series rejects thinkingLevel | 958 | 959 | // entirely and requires a numeric thinkingBudget instead. | 959 | 960 | if (request.thinkingLevel && request.thinkingLevel !== 'none') { | @@ -964,6 +965,14 @@ export async function executeGeminiRequest( | 964 | 965 | thinkingConfig.thinkingBudget = mapToThinkingBudget(model, request.thinkingLevel) | 965 | 966 | } | 966 | 967 | geminiConfig.thinkingConfig = thinkingConfig | | 968 | + } else if ( | | 969 | + request.thinkingLevel === 'none' && | | 970 | + !isGemini3Model(model) && | | 971 | + supportsDisablingGemini25Thinking(model) | | 972 | + ) { | | 973 | + // Omitting thinkingConfig entirely falls back to the API's own dynamic default, which | | 974 | + // is ON for gemini-2.5-flash — an explicit budget of 0 is required to actually disable it. | | 975 | + geminiConfig.thinkingConfig = { includeThoughts: false, thinkingBudget: 0 } | 967 | 976 | } | 968 | 977 |
| 969 | 978 | // Prepare tools | |
Collapse file Copy file name to clipboardExpand all lines: apps/sim/providers/google/utils.test.ts +21Lines changed: 21 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 | convertToGeminiFormat, | 7 | 7 | ensureStructResponse, | 8 | 8 | mapToThinkingBudget, | | 9 | + supportsDisablingGemini25Thinking, | 9 | 10 | } from '@/providers/google/utils' | 10 | 11 | import type { ProviderRequest } from '@/providers/types' | 11 | 12 |
| @@ -42,6 +43,26 @@ describe('mapToThinkingBudget', () => { | 42 | 43 | }) | 43 | 44 | }) | 44 | 45 |
| | 46 | +describe('supportsDisablingGemini25Thinking', () => { | | 47 | + it('returns true for gemini-2.5-flash and gemini-2.5-flash-lite', () => { | | 48 | + expect(supportsDisablingGemini25Thinking('gemini-2.5-flash')).toBe(true) | | 49 | + expect(supportsDisablingGemini25Thinking('gemini-2.5-flash-lite')).toBe(true) | | 50 | + }) | | 51 | + | | 52 | + it('returns false for gemini-2.5-pro, which cannot disable thinking', () => { | | 53 | + expect(supportsDisablingGemini25Thinking('gemini-2.5-pro')).toBe(false) | | 54 | + }) | | 55 | + | | 56 | + it('strips the vertex/ prefix before checking', () => { | | 57 | + expect(supportsDisablingGemini25Thinking('vertex/gemini-2.5-flash')).toBe(true) | | 58 | + expect(supportsDisablingGemini25Thinking('vertex/gemini-2.5-pro')).toBe(false) | | 59 | + }) | | 60 | + | | 61 | + it('returns false for models with no explicit mapping', () => { | | 62 | + expect(supportsDisablingGemini25Thinking('gemini-3.5-flash')).toBe(false) | | 63 | + }) | | 64 | +}) | | 65 | + | 45 | 66 | describe('ensureStructResponse', () => { | 46 | 67 | describe('should return objects unchanged', () => { | 47 | 68 | it('should return plain object unchanged', () => { | |
Collapse file Copy file name to clipboardExpand all lines: apps/sim/providers/google/utils.ts +17Lines changed: 17 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -374,6 +374,23 @@ export function mapToThinkingBudget(model: string, level: string): number { | 374 | 374 | return budgets[level.toLowerCase()] ?? budgets.high | 375 | 375 | } | 376 | 376 |
| | 377 | +/** | | 378 | + * Gemini 2.5-series models that accept `thinkingBudget: 0` to explicitly disable thinking. | | 379 | + * gemini-2.5-pro cannot disable thinking at all (its documented budget floor is 128, not 0), | | 380 | + * so it's deliberately excluded here. | | 381 | + */ | | 382 | +const GEMINI_25_MODELS_SUPPORTING_DISABLE = new Set(['gemini-2.5-flash', 'gemini-2.5-flash-lite']) | | 383 | + | | 384 | +/** | | 385 | + * Whether this Gemini 2.5-series model supports explicitly disabling thinking via budget=0. | | 386 | + * Omitting thinkingConfig entirely (the 'none' no-op path) falls back to the API's own | | 387 | + * dynamic default, which is ON for gemini-2.5-flash — not the same as actually disabling it. | | 388 | + */ | | 389 | +export function supportsDisablingGemini25Thinking(model: string): boolean { | | 390 | + const normalized = model.toLowerCase().replace(/^vertex\//, '') | | 391 | + return GEMINI_25_MODELS_SUPPORTING_DISABLE.has(normalized) | | 392 | +} | | 393 | + | 377 | 394 | /** | 378 | 395 | * Result of checking forced tool usage | 379 | 396 | */ | |
Collapse file Copy file name to clipboardExpand all lines: apps/sim/providers/models.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -294,7 +294,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = { | 294 | 294 | }, | 295 | 295 | capabilities: { | 296 | 296 | reasoningEffort: { | 297 | | - values: ['none', 'low', 'medium', 'high', 'xhigh'], | | 297 | + values: ['none', 'low', 'medium', 'high', 'xhigh', 'max'], | 298 | 298 | }, | 299 | 299 | verbosity: { | 300 | 300 | values: ['low', 'medium', 'high'], | |
|