pub struct BudgetConfig {
pub max_tokens: Option<u64>,
pub max_cost_usd: Option<f64>,
pub max_duration: Option<Duration>,
pub max_steps: Option<usize>,
pub on_exceeded: BudgetExceededAction,
}Expand description
Budget configuration limits
Defines the maximum limits for various budget dimensions.
Fields§
§max_tokens: Option<u64>Maximum tokens to consume (None = unlimited)
max_cost_usd: Option<f64>Maximum cost in USD (None = unlimited)
max_duration: Option<Duration>Maximum execution duration (None = unlimited)
max_steps: Option<usize>Maximum number of steps (None = unlimited)
on_exceeded: BudgetExceededActionAction to take when budget is exceeded
Implementations§
Source§impl BudgetConfig
impl BudgetConfig
Sourcepub const fn with_max_tokens(self, tokens: u64) -> Self
pub const fn with_max_tokens(self, tokens: u64) -> Self
Set maximum tokens
Sourcepub const fn with_max_cost_usd(self, cost: f64) -> Self
pub const fn with_max_cost_usd(self, cost: f64) -> Self
Set maximum cost in USD
Sourcepub const fn with_max_duration(self, duration: Duration) -> Self
pub const fn with_max_duration(self, duration: Duration) -> Self
Set maximum duration
Sourcepub const fn with_max_steps(self, steps: usize) -> Self
pub const fn with_max_steps(self, steps: usize) -> Self
Set maximum steps
Sourcepub const fn has_limits(&self) -> bool
pub const fn has_limits(&self) -> bool
Check if this config has any limits set
Trait Implementations§
Source§impl Clone for BudgetConfig
impl Clone for BudgetConfig
Source§fn clone(&self) -> BudgetConfig
fn clone(&self) -> BudgetConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BudgetConfig
impl Debug for BudgetConfig
Source§impl Default for BudgetConfig
impl Default for BudgetConfig
Source§fn default() -> BudgetConfig
fn default() -> BudgetConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for BudgetConfig
impl !UnwindSafe for BudgetConfig
impl Freeze for BudgetConfig
impl Send for BudgetConfig
impl Sync for BudgetConfig
impl Unpin for BudgetConfig
impl UnsafeUnpin for BudgetConfig
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