Skip to content

Commit ae4513e

Browse files
feat: add thinkingLevel and thinkingBudget config for Gemini models (#1110)
* feat: add thinkingLevel and thinkingBudget config for Gemini models Add per-model thinking configuration for Google Generative AI and Google Vertex providers. `thinkingLevel` controls reasoning depth for Gemini 3 models, and `thinkingBudget` sets the thinking token budget for Gemini 2.5 models. Deprecates the GOOGLE_VERTEX_THINKING_BUDGET_TOKENS env var in favor of the new per-model config (with fallback). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: add changelog entry for thinkingLevel/thinkingBudget Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * remove GOOGLE_VERTEX_INCLUDE_THOUGHTS * docs: add changelog entry for GOOGLE_VERTEX_INCLUDE_THOUGHTS removal Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a944d5b commit ae4513e

File tree

11 files changed

+326
-8
lines changed

11 files changed

+326
-8
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- Added `thinkingLevel` and `thinkingBudget` configuration options for Google Generative AI and Google Vertex providers. [#1110](https://github.com/sourcebot-dev/sourcebot/pull/1110)
12+
13+
### Changed
14+
- Deprecated `GOOGLE_VERTEX_THINKING_BUDGET_TOKENS` environment variable in favor of per-model `thinkingBudget` config. [#1110](https://github.com/sourcebot-dev/sourcebot/pull/1110)
15+
- Removed `GOOGLE_VERTEX_INCLUDE_THOUGHTS` environment variable. Thoughts are now always included. [#1110](https://github.com/sourcebot-dev/sourcebot/pull/1110)
16+
1017
## [4.16.8] - 2026-04-09
1118

1219
### Added

docs/docs/configuration/language-model-providers.mdx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ The `reasoningSummary` field controls whether the model returns its reasoning pr
157157

158158
[Vercel AI SDK Google Generative AI Docs](https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai)
159159

160+
The `thinkingLevel` field controls the depth of reasoning for Gemini 3 models. Valid values are `minimal`, `low`, `medium`, and `high`. See [thinking levels](https://ai.google.dev/gemini-api/docs/thinking#thinking-levels).
161+
162+
The `thinkingBudget` field sets the number of thinking tokens for Gemini 2.5 models. Set to `-1` for dynamic thinking. See [thinking budget](https://ai.google.dev/gemini-api/docs/thinking#set-budget).
163+
160164
```json wrap icon="code" Example config with Google Generative AI provider
161165
{
162166
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
@@ -168,7 +172,9 @@ The `reasoningSummary` field controls whether the model returns its reasoning pr
168172
"token": {
169173
"env": "GOOGLE_GENERATIVE_AI_API_KEY"
170174
},
171-
"baseUrl": "OPTIONAL_BASE_URL"
175+
"baseUrl": "OPTIONAL_BASE_URL",
176+
"thinkingLevel": "high", // "minimal" | "low" | "medium" | "high" (Gemini 3 models)
177+
"thinkingBudget": -1 // number of thinking tokens, -1 for dynamic (Gemini 2.5 models)
172178
}
173179
]
174180
}
@@ -181,6 +187,10 @@ The `reasoningSummary` field controls whether the model returns its reasoning pr
181187

182188
[Vercel AI SDK Google Vertex AI Docs](https://ai-sdk.dev/providers/ai-sdk-providers/google-vertex)
183189

190+
The `thinkingLevel` field controls the depth of reasoning for Gemini 3 models. Valid values are `minimal`, `low`, `medium`, and `high`. See [thinking levels](https://ai.google.dev/gemini-api/docs/thinking#thinking-levels).
191+
192+
The `thinkingBudget` field sets the number of thinking tokens for Gemini 2.5 models. Set to `-1` for dynamic thinking. See [thinking budget](https://ai.google.dev/gemini-api/docs/thinking#set-budget).
193+
184194
```json wrap icon="code" Example config with Google Vertex provider
185195
{
186196
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
@@ -194,7 +204,9 @@ The `reasoningSummary` field controls whether the model returns its reasoning pr
194204
"credentials": {
195205
"env": "GOOGLE_APPLICATION_CREDENTIALS"
196206
},
197-
"baseUrl": "OPTIONAL_BASE_URL"
207+
"baseUrl": "OPTIONAL_BASE_URL",
208+
"thinkingLevel": "high", // "minimal" | "low" | "medium" | "high" (Gemini 3 models)
209+
"thinkingBudget": -1 // number of thinking tokens, -1 for dynamic (Gemini 2.5 models)
198210
}
199211
]
200212
}

docs/snippets/schemas/v3/index.schema.mdx

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,6 +2300,20 @@
23002300
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
23012301
"description": "Optional base URL."
23022302
},
2303+
"thinkingLevel": {
2304+
"type": "string",
2305+
"description": "Optional thinking level for Gemini 3 models. Controls the depth of reasoning the model performs. See https://ai.google.dev/gemini-api/docs/thinking#thinking-levels",
2306+
"enum": [
2307+
"minimal",
2308+
"low",
2309+
"medium",
2310+
"high"
2311+
]
2312+
},
2313+
"thinkingBudget": {
2314+
"type": "integer",
2315+
"description": "Optional thinking budget for Gemini 2.5 models. Sets the number of thinking tokens the model can use when generating a response. Set to -1 for dynamic thinking. See https://ai.google.dev/gemini-api/docs/thinking#set-budget"
2316+
},
23032317
"temperature": {
23042318
"type": "number",
23052319
"description": "Optional temperature setting to use with the model."
@@ -2548,6 +2562,20 @@
25482562
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
25492563
"description": "Optional base URL."
25502564
},
2565+
"thinkingLevel": {
2566+
"type": "string",
2567+
"description": "Optional thinking level for Gemini 3 models. Controls the depth of reasoning the model performs. See https://ai.google.dev/gemini-api/docs/thinking#thinking-levels",
2568+
"enum": [
2569+
"minimal",
2570+
"low",
2571+
"medium",
2572+
"high"
2573+
]
2574+
},
2575+
"thinkingBudget": {
2576+
"type": "integer",
2577+
"description": "Optional thinking budget for Gemini 2.5 models. Sets the number of thinking tokens the model can use when generating a response. Set to -1 for dynamic thinking. See https://ai.google.dev/gemini-api/docs/thinking#set-budget"
2578+
},
25512579
"temperature": {
25522580
"type": "number",
25532581
"description": "Optional temperature setting to use with the model."
@@ -3838,6 +3866,20 @@
38383866
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
38393867
"description": "Optional base URL."
38403868
},
3869+
"thinkingLevel": {
3870+
"type": "string",
3871+
"description": "Optional thinking level for Gemini 3 models. Controls the depth of reasoning the model performs. See https://ai.google.dev/gemini-api/docs/thinking#thinking-levels",
3872+
"enum": [
3873+
"minimal",
3874+
"low",
3875+
"medium",
3876+
"high"
3877+
]
3878+
},
3879+
"thinkingBudget": {
3880+
"type": "integer",
3881+
"description": "Optional thinking budget for Gemini 2.5 models. Sets the number of thinking tokens the model can use when generating a response. Set to -1 for dynamic thinking. See https://ai.google.dev/gemini-api/docs/thinking#set-budget"
3882+
},
38413883
"temperature": {
38423884
"type": "number",
38433885
"description": "Optional temperature setting to use with the model."
@@ -4086,6 +4128,20 @@
40864128
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
40874129
"description": "Optional base URL."
40884130
},
4131+
"thinkingLevel": {
4132+
"type": "string",
4133+
"description": "Optional thinking level for Gemini 3 models. Controls the depth of reasoning the model performs. See https://ai.google.dev/gemini-api/docs/thinking#thinking-levels",
4134+
"enum": [
4135+
"minimal",
4136+
"low",
4137+
"medium",
4138+
"high"
4139+
]
4140+
},
4141+
"thinkingBudget": {
4142+
"type": "integer",
4143+
"description": "Optional thinking budget for Gemini 2.5 models. Sets the number of thinking tokens the model can use when generating a response. Set to -1 for dynamic thinking. See https://ai.google.dev/gemini-api/docs/thinking#set-budget"
4144+
},
40894145
"temperature": {
40904146
"type": "number",
40914147
"description": "Optional temperature setting to use with the model."

docs/snippets/schemas/v3/languageModel.schema.mdx

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,20 @@
614614
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
615615
"description": "Optional base URL."
616616
},
617+
"thinkingLevel": {
618+
"type": "string",
619+
"description": "Optional thinking level for Gemini 3 models. Controls the depth of reasoning the model performs. See https://ai.google.dev/gemini-api/docs/thinking#thinking-levels",
620+
"enum": [
621+
"minimal",
622+
"low",
623+
"medium",
624+
"high"
625+
]
626+
},
627+
"thinkingBudget": {
628+
"type": "integer",
629+
"description": "Optional thinking budget for Gemini 2.5 models. Sets the number of thinking tokens the model can use when generating a response. Set to -1 for dynamic thinking. See https://ai.google.dev/gemini-api/docs/thinking#set-budget"
630+
},
617631
"temperature": {
618632
"type": "number",
619633
"description": "Optional temperature setting to use with the model."
@@ -862,6 +876,20 @@
862876
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
863877
"description": "Optional base URL."
864878
},
879+
"thinkingLevel": {
880+
"type": "string",
881+
"description": "Optional thinking level for Gemini 3 models. Controls the depth of reasoning the model performs. See https://ai.google.dev/gemini-api/docs/thinking#thinking-levels",
882+
"enum": [
883+
"minimal",
884+
"low",
885+
"medium",
886+
"high"
887+
]
888+
},
889+
"thinkingBudget": {
890+
"type": "integer",
891+
"description": "Optional thinking budget for Gemini 2.5 models. Sets the number of thinking tokens the model can use when generating a response. Set to -1 for dynamic thinking. See https://ai.google.dev/gemini-api/docs/thinking#set-budget"
892+
},
865893
"temperature": {
866894
"type": "number",
867895
"description": "Optional temperature setting to use with the model."
@@ -2152,6 +2180,20 @@
21522180
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
21532181
"description": "Optional base URL."
21542182
},
2183+
"thinkingLevel": {
2184+
"type": "string",
2185+
"description": "Optional thinking level for Gemini 3 models. Controls the depth of reasoning the model performs. See https://ai.google.dev/gemini-api/docs/thinking#thinking-levels",
2186+
"enum": [
2187+
"minimal",
2188+
"low",
2189+
"medium",
2190+
"high"
2191+
]
2192+
},
2193+
"thinkingBudget": {
2194+
"type": "integer",
2195+
"description": "Optional thinking budget for Gemini 2.5 models. Sets the number of thinking tokens the model can use when generating a response. Set to -1 for dynamic thinking. See https://ai.google.dev/gemini-api/docs/thinking#set-budget"
2196+
},
21552197
"temperature": {
21562198
"type": "number",
21572199
"description": "Optional temperature setting to use with the model."
@@ -2400,6 +2442,20 @@
24002442
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
24012443
"description": "Optional base URL."
24022444
},
2445+
"thinkingLevel": {
2446+
"type": "string",
2447+
"description": "Optional thinking level for Gemini 3 models. Controls the depth of reasoning the model performs. See https://ai.google.dev/gemini-api/docs/thinking#thinking-levels",
2448+
"enum": [
2449+
"minimal",
2450+
"low",
2451+
"medium",
2452+
"high"
2453+
]
2454+
},
2455+
"thinkingBudget": {
2456+
"type": "integer",
2457+
"description": "Optional thinking budget for Gemini 2.5 models. Sets the number of thinking tokens the model can use when generating a response. Set to -1 for dynamic thinking. See https://ai.google.dev/gemini-api/docs/thinking#set-budget"
2458+
},
24032459
"temperature": {
24042460
"type": "number",
24052461
"description": "Optional temperature setting to use with the model."

packages/schemas/src/v3/index.schema.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2299,6 +2299,20 @@ const schema = {
22992299
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
23002300
"description": "Optional base URL."
23012301
},
2302+
"thinkingLevel": {
2303+
"type": "string",
2304+
"description": "Optional thinking level for Gemini 3 models. Controls the depth of reasoning the model performs. See https://ai.google.dev/gemini-api/docs/thinking#thinking-levels",
2305+
"enum": [
2306+
"minimal",
2307+
"low",
2308+
"medium",
2309+
"high"
2310+
]
2311+
},
2312+
"thinkingBudget": {
2313+
"type": "integer",
2314+
"description": "Optional thinking budget for Gemini 2.5 models. Sets the number of thinking tokens the model can use when generating a response. Set to -1 for dynamic thinking. See https://ai.google.dev/gemini-api/docs/thinking#set-budget"
2315+
},
23022316
"temperature": {
23032317
"type": "number",
23042318
"description": "Optional temperature setting to use with the model."
@@ -2547,6 +2561,20 @@ const schema = {
25472561
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
25482562
"description": "Optional base URL."
25492563
},
2564+
"thinkingLevel": {
2565+
"type": "string",
2566+
"description": "Optional thinking level for Gemini 3 models. Controls the depth of reasoning the model performs. See https://ai.google.dev/gemini-api/docs/thinking#thinking-levels",
2567+
"enum": [
2568+
"minimal",
2569+
"low",
2570+
"medium",
2571+
"high"
2572+
]
2573+
},
2574+
"thinkingBudget": {
2575+
"type": "integer",
2576+
"description": "Optional thinking budget for Gemini 2.5 models. Sets the number of thinking tokens the model can use when generating a response. Set to -1 for dynamic thinking. See https://ai.google.dev/gemini-api/docs/thinking#set-budget"
2577+
},
25502578
"temperature": {
25512579
"type": "number",
25522580
"description": "Optional temperature setting to use with the model."
@@ -3837,6 +3865,20 @@ const schema = {
38373865
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
38383866
"description": "Optional base URL."
38393867
},
3868+
"thinkingLevel": {
3869+
"type": "string",
3870+
"description": "Optional thinking level for Gemini 3 models. Controls the depth of reasoning the model performs. See https://ai.google.dev/gemini-api/docs/thinking#thinking-levels",
3871+
"enum": [
3872+
"minimal",
3873+
"low",
3874+
"medium",
3875+
"high"
3876+
]
3877+
},
3878+
"thinkingBudget": {
3879+
"type": "integer",
3880+
"description": "Optional thinking budget for Gemini 2.5 models. Sets the number of thinking tokens the model can use when generating a response. Set to -1 for dynamic thinking. See https://ai.google.dev/gemini-api/docs/thinking#set-budget"
3881+
},
38403882
"temperature": {
38413883
"type": "number",
38423884
"description": "Optional temperature setting to use with the model."
@@ -4085,6 +4127,20 @@ const schema = {
40854127
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
40864128
"description": "Optional base URL."
40874129
},
4130+
"thinkingLevel": {
4131+
"type": "string",
4132+
"description": "Optional thinking level for Gemini 3 models. Controls the depth of reasoning the model performs. See https://ai.google.dev/gemini-api/docs/thinking#thinking-levels",
4133+
"enum": [
4134+
"minimal",
4135+
"low",
4136+
"medium",
4137+
"high"
4138+
]
4139+
},
4140+
"thinkingBudget": {
4141+
"type": "integer",
4142+
"description": "Optional thinking budget for Gemini 2.5 models. Sets the number of thinking tokens the model can use when generating a response. Set to -1 for dynamic thinking. See https://ai.google.dev/gemini-api/docs/thinking#set-budget"
4143+
},
40884144
"temperature": {
40894145
"type": "number",
40904146
"description": "Optional temperature setting to use with the model."

packages/schemas/src/v3/index.type.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,14 @@ export interface GoogleGenerativeAILanguageModel {
962962
* Optional base URL.
963963
*/
964964
baseUrl?: string;
965+
/**
966+
* Optional thinking level for Gemini 3 models. Controls the depth of reasoning the model performs. See https://ai.google.dev/gemini-api/docs/thinking#thinking-levels
967+
*/
968+
thinkingLevel?: "minimal" | "low" | "medium" | "high";
969+
/**
970+
* Optional thinking budget for Gemini 2.5 models. Sets the number of thinking tokens the model can use when generating a response. Set to -1 for dynamic thinking. See https://ai.google.dev/gemini-api/docs/thinking#set-budget
971+
*/
972+
thinkingBudget?: number;
965973
/**
966974
* Optional temperature setting to use with the model.
967975
*/
@@ -1056,6 +1064,14 @@ export interface GoogleVertexLanguageModel {
10561064
* Optional base URL.
10571065
*/
10581066
baseUrl?: string;
1067+
/**
1068+
* Optional thinking level for Gemini 3 models. Controls the depth of reasoning the model performs. See https://ai.google.dev/gemini-api/docs/thinking#thinking-levels
1069+
*/
1070+
thinkingLevel?: "minimal" | "low" | "medium" | "high";
1071+
/**
1072+
* Optional thinking budget for Gemini 2.5 models. Sets the number of thinking tokens the model can use when generating a response. Set to -1 for dynamic thinking. See https://ai.google.dev/gemini-api/docs/thinking#set-budget
1073+
*/
1074+
thinkingBudget?: number;
10591075
/**
10601076
* Optional temperature setting to use with the model.
10611077
*/

0 commit comments

Comments
 (0)