Thinking level support for Gemini 3 Pro#1444
Conversation
c7d01d3 to
70af8b9
Compare
|
Thanks for this, @maciej-nexos Will review this quickly and merge |
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for the thinking_level parameter in Gemini 3 Pro model, which is mutually exclusive with the existing thinking_budget parameter used by Gemini 2.5 series models.
- Added
thinking_levelfield to theParamsinterface - Updated Google and Google Vertex AI providers to handle
thinking_levelwith mutual exclusivity logic - Modified
include_thoughtscondition to accept eitherbudget_tokensorthinking_level
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/types/requestBody.ts | Added optional thinking_level field to the thinking configuration type |
| src/providers/google/chatComplete.ts | Updated transformation logic to prioritize thinking_level over budget_tokens when present |
| src/providers/google-vertex-ai/transformGenerationConfig.ts | Applied same mutual exclusivity logic for Vertex AI provider |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| thinkingConfig['thinking_budget'] = budget_tokens; | ||
| } |
There was a problem hiding this comment.
When thinking_level is not provided but budget_tokens is undefined or 0, this will set thinking_budget to a falsy value. This could cause issues if the API expects either a valid budget or no field at all. Consider only setting thinking_budget when budget_tokens has a meaningful value.
| thinkingConfig['thinking_budget'] = budget_tokens; | |
| } | |
| if (budget_tokens != null && budget_tokens !== 0) { | |
| thinkingConfig['thinking_budget'] = budget_tokens; | |
| } |
| thinkingConfig['thinking_budget'] = budget_tokens; | ||
| } |
There was a problem hiding this comment.
When thinking_level is not provided but budget_tokens is undefined or 0, this will set thinking_budget to a falsy value. This could cause issues if the API expects either a valid budget or no field at all. Consider only setting thinking_budget when budget_tokens has a meaningful value.
| thinkingConfig['thinking_budget'] = budget_tokens; | |
| } | |
| if (budget_tokens != null && budget_tokens !== 0) { | |
| thinkingConfig['thinking_budget'] = budget_tokens; | |
| } |
70af8b9 to
601838b
Compare
|
I think it would be best to map reasoning_effort to thinking_level |
|
We would really love to see this feature added as users of Portkey. |
|
anything blocking this from being merged in? |
|
merging this @davidwhite-spec and @maciej-nexos |
Description: (required)
Gemini 3 Pro model supports thinking_level parameter.
This new parameter is mutually exclusive with existing thinking_budget parameter for Gemini 2.5 series models.
Tests Run/Test cases added: (required)
Type of Change: