FirebaseAI Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
ThinkingConfig
public struct ThinkingConfig : Sendable
extension ThinkingConfig: Encodable
Configuration for controlling the “thinking” behavior of compatible Gemini models.
Certain models, like Gemini 2.5 Flash and Pro, utilize a thinking process before generating a
response. This allows them to reason through complex problems and plan a more coherent and
accurate answer.
-
Initializes a new ThinkingConfig
.
Declaration
Swift
public init(thinkingBudget: Int? = nil, includeThoughts: Bool? = nil)
Parameters
thinkingBudget
|
The maximum number of tokens to be used for the model’s thinking process.
|
includeThoughts
|
If true, summaries of the model’s “thoughts” are included in responses.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[],[],null,["# FirebaseAI Framework Reference\n\nThinkingConfig\n==============\n\n public struct ThinkingConfig : Sendable\n\n extension ThinkingConfig: Encodable\n\nConfiguration for controlling the \"thinking\" behavior of compatible Gemini models.\n\nCertain models, like Gemini 2.5 Flash and Pro, utilize a thinking process before generating a\nresponse. This allows them to reason through complex problems and plan a more coherent and\naccurate answer.\n- `\n ``\n ``\n `\n\n ### [init(thinkingBudget:)](#/s:10FirebaseAI14ThinkingConfigV14thinkingBudgetACSiSg_tcfc)\n\n `\n ` \n Initializes a new `ThinkingConfig`. \n\n #### Declaration\n\n Swift \n\n public init(thinkingBudget: Int? = nil)\n\n #### Parameters\n\n |------------------------|---------------------------------------------------------------------------|\n | ` `*thinkingBudget*` ` | The maximum number of tokens to be used for the model's thinking process. |"]]