pub struct Budget { /* private fields */ }Implementations§
Source§impl Budget
impl Budget
pub fn new(max_steps: u32, max_tokens: u64, deadline: Instant) -> Budget
Sourcepub fn record_step(&mut self)
pub fn record_step(&mut self)
Count one completed loop turn.
Sourcepub fn record_usage(&mut self, usage: Usage)
pub fn record_usage(&mut self, usage: Usage)
Add a model call’s token usage to the running total.
pub fn tokens(&self) -> u64
pub fn steps(&self) -> u32
Sourcepub fn max_steps(&self) -> u32
pub fn max_steps(&self) -> u32
The configured step ceiling (for an informational loop.start field).
Sourcepub fn exceeded(&self) -> Option<TerminalStatus>
pub fn exceeded(&self) -> Option<TerminalStatus>
The terminal status for whichever bound is hit, if any. Checked at the top of each turn so the loop stops before spending more. Deadline is checked first (it’s the hardest bound).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Budget
impl RefUnwindSafe for Budget
impl Send for Budget
impl Sync for Budget
impl Unpin for Budget
impl UnsafeUnpin for Budget
impl UnwindSafe for Budget
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