@@ -215,23 +215,25 @@ func convertHarmBlockThreshold(threshold HarmBlockThreshold) genai.HarmBlockThre
215215}
216216
217217// convertThinkingConfig converts llms.ThinkingConfig to genai.ThinkingConfig.
218+ // Note: Gemini 3 Pro only supports "low" and "high" thinking levels.
219+ // See: https://ai.google.dev/gemini-api/docs/gemini-3?thinking=high#thinking_level
218220func convertThinkingConfig (config * llms.ThinkingConfig ) * genai.ThinkingConfig {
219221 if config == nil {
220222 return nil
221223 }
222224
223225 genaiConfig := & genai.ThinkingConfig {}
224226
225- // Only set ThinkingLevel for HIGH mode - for other modes, we just enable IncludeThoughts
226- // Setting ThinkingLevel forces extended thinking which can cause the model to only produce
227- // thinking content without actual output. By only setting IncludeThoughts, we get the
228- // thinking without forcing extended thinking behavior.
227+ // Map ThinkingMode to Gemini ThinkingLevel
228+ // Gemini 3 Pro only supports LOW and HIGH levels
229+ // LOW: Minimizes latency and cost, best for simple tasks
230+ // HIGH: Maximizes reasoning depth, may take longer but more carefully reasoned
229231 switch config .Mode {
232+ case llms .ThinkingModeLow , llms .ThinkingModeMedium , llms .ThinkingModeAuto :
233+ // Map medium/auto to low for Gemini 3 Pro compatibility
234+ genaiConfig .ThinkingLevel = genai .ThinkingLevelLow
230235 case llms .ThinkingModeHigh :
231236 genaiConfig .ThinkingLevel = genai .ThinkingLevelHigh
232- case llms .ThinkingModeLow , llms .ThinkingModeMedium , llms .ThinkingModeAuto :
233- // Don't set ThinkingLevel - just enable IncludeThoughts
234- // This allows the model to think naturally without forcing extended thinking
235237 default :
236238 return nil // ThinkingModeNone or unknown
237239 }
0 commit comments