Thinking Budget • Rust AI Agent SDK
ThinkingBudget: Budget constraints for extended thinking. Controls how much thinking/reasoning the LLM can do before producing a response.
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
| Name | Type | Description |
|---|---|---|
max_tokens | usize | Maximum tokens for thinking |
max_time_seconds | Option<f64> | Maximum time in seconds (optional) |
adaptive | bool | Whether to adapt budget based on complexity |
level | Option<BudgetLevel> | Budget level (if using predefined) |
min_tokens | usize | Minimum tokens for adaptive budgeting |
complexity_multiplier | f64 | Complexity multiplier for adaptive budgeting |
Methods
new
fn new() -> ThinkingBudgetBuilderCreate a new ThinkingBudget with default values.
from_level
fn from_level(level: BudgetLevel) -> SelfCreate a budget from a predefined level.
Parameters:
| Name | Type |
|---|---|
level | BudgetLevel |
minimal
fn minimal() -> SelfCreate a minimal budget.
low
fn low() -> SelfCreate a low budget.
medium
fn medium() -> SelfCreate a medium budget.
high
fn high() -> SelfCreate a high budget.
maximum
fn maximum() -> SelfCreate a maximum budget.
get_tokens_for_complexity
fn get_tokens_for_complexity(&self, complexity: f64) -> usizeGet token budget based on task complexity. # Arguments * complexity – Complexity score (0.0 to 1.0) # Returns Adjusted token budget
Parameters:
| Name | Type |
|---|---|
complexity | f64 |
to_map
fn to_map(&self) -> HashMap<String, serde_json::Value>Convert to HashMap for serialization.
Source
View on GitHubpraisonai/src/thinking/mod.rs at line 80