Skip to main content

ThinkingBudget

Defined in the thinking module.
Rust AI Agent SDK Budget constraints for extended thinking. Controls how much thinking/reasoning the LLM can do before producing a response.

Fields

NameTypeDescription
max_tokensusizeMaximum tokens for thinking
max_time_secondsOption<f64>Maximum time in seconds (optional)
adaptiveboolWhether to adapt budget based on complexity
levelOption<BudgetLevel>Budget level (if using predefined)
min_tokensusizeMinimum tokens for adaptive budgeting
complexity_multiplierf64Complexity multiplier for adaptive budgeting

Methods

new

fn new() -> ThinkingBudgetBuilder
Create a new ThinkingBudget with default values.

from_level

fn from_level(level: BudgetLevel) -> Self
Create a budget from a predefined level. Parameters:
NameType
levelBudgetLevel

minimal

fn minimal() -> Self
Create a minimal budget.

low

fn low() -> Self
Create a low budget.

medium

fn medium() -> Self
Create a medium budget.

high

fn high() -> Self
Create a high budget.

maximum

fn maximum() -> Self
Create a maximum budget.

get_tokens_for_complexity

fn get_tokens_for_complexity(&self, complexity: f64) -> usize
Get token budget based on task complexity. # Arguments * complexity - Complexity score (0.0 to 1.0) # Returns Adjusted token budget Parameters:
NameType
complexityf64

to_map

fn to_map(&self) -> HashMap<String, serde_json::Value>
Convert to HashMap for serialization.

Source

View on GitHub

praisonai/src/thinking/mod.rs at line 80