Skip to content

Commit 8bd67ff

Browse files
authored
[AI] Documentation improvements to ThinkingConfig (#7641)
Add more detailed description of the difference between `setThinkingBudget` and `setThinkingLevel`.
1 parent b946b5f commit 8bd67ff

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ThinkingConfig.kt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,30 @@ private constructor(
4848
/**
4949
* Indicates the thinking budget in tokens.
5050
*
51-
* Use `0` for disabled, and `-1` for dynamic. The range of
51+
* The range of
5252
* [supported thinking budget values](https://firebase.google.com/docs/ai-logic/thinking#supported-thinking-budget-values)
5353
* depends on the model.
54+
* - To disable thinking, when supported by the model, set this value to `0`.
55+
* - To use dynamic thinking, allowing the model to decide on the thinking budget based on the
56+
* task, set this value to `-1`.
5457
*/
5558
public fun setThinkingBudget(thinkingBudget: Int): Builder = apply {
5659
this.thinkingBudget = thinkingBudget
5760
}
5861

59-
/** Indicates the thinking budget based in Levels. */
62+
/**
63+
* Indicates the thinking budget in [ThinkingLevel]s.
64+
*
65+
* If you don't specify a thinking level, Gemini will use the model's default dynamic thinking
66+
* level.
67+
*
68+
* > Important: Gemini 2.5 series models do not support thinking levels; use [setThinkingBudget]
69+
* to set a thinking budget instead.
70+
*
71+
* @param thinkingLevel A preset that controls the model's "thinking" process. Use
72+
* [ThinkingLevel.LOW] for faster responses on less complex tasks, and [ThinkingLevel.HIGH] for
73+
* better reasoning on more complex tasks.
74+
*/
6075
public fun setThinkingLevel(thinkingLevel: ThinkingLevel): Builder = apply {
6176
this.thinkingLevel = thinkingLevel
6277
}

0 commit comments

Comments
 (0)