Gemini.Validation.ThinkingConfig (GeminiEx v0.3.0)
View SourceValidation for thinking configuration parameters based on model capabilities.
Gemini 2.5 series models support thinking budgets with model-specific ranges:
- 2.5 Pro: 128-32,768 tokens (cannot disable with 0)
- 2.5 Flash: 0-24,576 tokens (can disable)
- 2.5 Flash Lite: 0 or 512-24,576 tokens
Special value -1
enables dynamic thinking (model decides budget) for all models.
Summary
Functions
Validate complete thinking config including budget and include_thoughts.
Validate thinking budget for a specific model.
Types
@type validation_result() :: :ok | {:error, String.t()}
Functions
@spec validate(map() | struct(), String.t()) :: validation_result()
Validate complete thinking config including budget and include_thoughts.
Parameters
config
: Map or ThinkingConfig structmodel
: Model name string
Returns
:ok
if valid{:error, message}
if invalid
@spec validate_budget(integer(), String.t()) :: validation_result()
Validate thinking budget for a specific model.
Parameters
budget
: Integer budget valuemodel
: Model name string
Returns
:ok
if valid{:error, message}
with helpful error message
Examples
iex> Gemini.Validation.ThinkingConfig.validate_budget(1024, "gemini-2.5-flash")
:ok
iex> Gemini.Validation.ThinkingConfig.validate_budget(0, "gemini-2.5-pro")
{:error, "Gemini 2.5 Pro cannot disable thinking (minimum budget: 128)"}