@@ -7,11 +7,13 @@ import {
77 getAnthropicReasoning ,
88 getOpenAiReasoning ,
99 getRooReasoning ,
10+ getGeminiReasoning ,
1011 GetModelReasoningOptions ,
1112 OpenRouterReasoningParams ,
1213 AnthropicReasoningParams ,
1314 OpenAiReasoningParams ,
1415 RooReasoningParams ,
16+ GeminiReasoningParams ,
1517} from "../reasoning"
1618
1719describe ( "reasoning.ts" , ( ) => {
@@ -587,6 +589,61 @@ describe("reasoning.ts", () => {
587589 } )
588590 } )
589591
592+ describe ( "Gemini reasoning (effort models)" , ( ) => {
593+ it ( "should return thinkingLevel when effort is set to low or high and budget is not used" , ( ) => {
594+ const geminiModel : ModelInfo = {
595+ ...baseModel ,
596+ // Effort-only reasoning model (no budget fields)
597+ supportsReasoningEffort : [ "low" , "high" ] as ModelInfo [ "supportsReasoningEffort" ] ,
598+ reasoningEffort : "low" ,
599+ }
600+
601+ const settings : ProviderSettings = {
602+ apiProvider : "gemini" ,
603+ enableReasoningEffort : true ,
604+ reasoningEffort : "high" ,
605+ }
606+
607+ const options : GetModelReasoningOptions = {
608+ model : geminiModel ,
609+ reasoningBudget : 2048 ,
610+ reasoningEffort : "high" ,
611+ settings,
612+ }
613+
614+ const result = getGeminiReasoning ( options ) as GeminiReasoningParams | undefined
615+
616+ // Budget should not be used for effort-only models
617+ expect ( result ) . toEqual ( { thinkingLevel : "high" , includeThoughts : true } )
618+ } )
619+
620+ it ( "should still return thinkingLevel when enableReasoningEffort is false but effort is explicitly set" , ( ) => {
621+ const geminiModel : ModelInfo = {
622+ ...baseModel ,
623+ // Effort-only reasoning model
624+ supportsReasoningEffort : [ "low" , "high" ] as ModelInfo [ "supportsReasoningEffort" ] ,
625+ reasoningEffort : "low" ,
626+ }
627+
628+ const settings : ProviderSettings = {
629+ apiProvider : "gemini" ,
630+ // Even with this flag false, an explicit effort selection should win
631+ enableReasoningEffort : false ,
632+ reasoningEffort : "high" ,
633+ }
634+
635+ const options : GetModelReasoningOptions = {
636+ model : geminiModel ,
637+ reasoningBudget : 2048 ,
638+ reasoningEffort : "high" ,
639+ settings,
640+ }
641+
642+ const result = getGeminiReasoning ( options ) as GeminiReasoningParams | undefined
643+ expect ( result ) . toEqual ( { thinkingLevel : "high" , includeThoughts : true } )
644+ } )
645+ } )
646+
590647 describe ( "Integration scenarios" , ( ) => {
591648 it ( "should handle model with requiredReasoningBudget across all providers" , ( ) => {
592649 const modelWithRequired : ModelInfo = {
0 commit comments