#[non_exhaustive]pub struct ToolBudget {
pub max_steps: u32,
pub max_total_tokens: Option<u64>,
}Expand description
How far a tool loop may run (issue #665): a hard cap on model calls, and an optional cap on the tokens those calls may spend.
#[non_exhaustive]: build one with ToolBudget::steps and the
builder method rather than a struct literal, so another limit (wall
clock, tool calls per step) is not a breaking change.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_steps: u32The most model calls the loop may make. A budget of N means at
most N calls: the loop makes no N+1th, even when the Nth still
asks for a tool, and a budget of 0 makes none at all.
max_total_tokens: Option<u64>The most input + output tokens the loop may spend in total, where a
caller names one. None is unbounded.
Implementations§
Source§impl ToolBudget
impl ToolBudget
Trait Implementations§
Source§impl Clone for ToolBudget
impl Clone for ToolBudget
Source§impl Debug for ToolBudget
impl Debug for ToolBudget
impl Eq for ToolBudget
Source§impl PartialEq for ToolBudget
impl PartialEq for ToolBudget
impl StructuralPartialEq for ToolBudget
Auto Trait Implementations§
impl Freeze for ToolBudget
impl RefUnwindSafe for ToolBudget
impl Send for ToolBudget
impl Sync for ToolBudget
impl Unpin for ToolBudget
impl UnsafeUnpin for ToolBudget
impl UnwindSafe for ToolBudget
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.