pub struct TokenBudgetBuilder {
total: i32,
system: f32,
instructions: f32,
evidence: f32,
memory: f32,
tool_results: f32,
history: f32,
slack: f32,
}Expand description
Builder for constructing TokenBudget with custom ratios.
Provides a fluent API for configuring token budget allocation. All ratios default to the standard allocation if not specified.
Fields§
§total: i32§system: f32§instructions: f32§evidence: f32§memory: f32§tool_results: f32§history: f32§slack: f32Implementations§
Source§impl TokenBudgetBuilder
impl TokenBudgetBuilder
Sourcepub fn instructions(self, ratio: f32) -> Self
pub fn instructions(self, ratio: f32) -> Self
Set the instructions ratio (default: 0.15).
Sourcepub fn tool_results(self, ratio: f32) -> Self
pub fn tool_results(self, ratio: f32) -> Self
Set the tool results ratio (default: 0.15).
Sourcepub fn build(self) -> TokenBudget
pub fn build(self) -> TokenBudget
Build the TokenBudget.
Converts ratios to absolute token counts based on total. Validates that segment ratios sum to 1.0 (±0.05 tolerance).
Trait Implementations§
Source§impl Clone for TokenBudgetBuilder
impl Clone for TokenBudgetBuilder
Source§fn clone(&self) -> TokenBudgetBuilder
fn clone(&self) -> TokenBudgetBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TokenBudgetBuilder
impl RefUnwindSafe for TokenBudgetBuilder
impl Send for TokenBudgetBuilder
impl Sync for TokenBudgetBuilder
impl Unpin for TokenBudgetBuilder
impl UnwindSafe for TokenBudgetBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more