pub struct ContextBudgetSignal {
pub estimated_tokens: usize,
pub accumulated_cost: f64,
pub budget_limit: Option<f64>,
pub context_upgrade_threshold: Option<usize>,
}Expand description
Signals derived from token budget and cost constraints.
Fields§
§estimated_tokens: usize§accumulated_cost: f64§budget_limit: Option<f64>§context_upgrade_threshold: Option<usize>Implementations§
Source§impl ContextBudgetSignal
impl ContextBudgetSignal
Sourcepub fn extract(
estimated_tokens: usize,
accumulated_cost: f64,
budget_limit: Option<f64>,
context_upgrade_threshold: Option<usize>,
) -> ContextBudgetSignal
pub fn extract( estimated_tokens: usize, accumulated_cost: f64, budget_limit: Option<f64>, context_upgrade_threshold: Option<usize>, ) -> ContextBudgetSignal
Extract budget signals from token estimate, cost, and config.
Sourcepub fn should_upgrade_context(&self) -> bool
pub fn should_upgrade_context(&self) -> bool
Returns true if context length exceeds the upgrade threshold.
Sourcepub fn is_over_budget(&self) -> bool
pub fn is_over_budget(&self) -> bool
Returns true if accumulated cost exceeds budget.
Sourcepub fn budget_utilization(&self) -> f64
pub fn budget_utilization(&self) -> f64
Budget utilization ratio [0, 1] (1.0 = at/over limit).
Sourcepub fn normalized(&self) -> f64
pub fn normalized(&self) -> f64
Normalize to [0, 1] for scoring (higher = more resource pressure).
Trait Implementations§
Source§impl Clone for ContextBudgetSignal
impl Clone for ContextBudgetSignal
Source§fn clone(&self) -> ContextBudgetSignal
fn clone(&self) -> ContextBudgetSignal
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 ContextBudgetSignal
impl Debug for ContextBudgetSignal
Source§impl Default for ContextBudgetSignal
impl Default for ContextBudgetSignal
Source§fn default() -> ContextBudgetSignal
fn default() -> ContextBudgetSignal
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ContextBudgetSignal
impl RefUnwindSafe for ContextBudgetSignal
impl Send for ContextBudgetSignal
impl Sync for ContextBudgetSignal
impl Unpin for ContextBudgetSignal
impl UnsafeUnpin for ContextBudgetSignal
impl UnwindSafe for ContextBudgetSignal
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