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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.