pub struct WorkerPolicy {
pub config: ContextManagementConfig,
pub thresholds: ContextThresholds,
}Expand description
A resolved worker policy for one model window.
Fields§
§config: ContextManagementConfig§thresholds: ContextThresholdsImplementations§
Source§impl WorkerPolicy
impl WorkerPolicy
pub fn target_tokens(&self) -> u64
Sourcepub fn successor_budget(
&self,
overhead_tokens: u64,
calibration: Option<TokenCalibration>,
) -> SuccessorBudget
pub fn successor_budget( &self, overhead_tokens: u64, calibration: Option<TokenCalibration>, ) -> SuccessorBudget
Message budget for the successor (estimator units), exactly as the foreground sizes its successor.
Sourcepub fn hard_capacity_has_room(
&self,
context_window: u64,
required_next_round: u64,
) -> bool
pub fn hard_capacity_has_room( &self, context_window: u64, required_next_round: u64, ) -> bool
Whether rolling over at hard capacity can make real room. Hard
capacity is the footprint context_window - required_next_round,
where the next round’s reserves are its expected output (thinking and
response within max_tokens), the next tool result and the safety
margin. When that line is at or below this policy’s successor target
the window is dominated by its reserves: no successor of the size the
policy aims for passes hard admission, and any successor the window
does hold is a fraction of it, back at hard capacity a few rounds
later. That was every 200k Opus window while the reserve was the full
128k max_tokens (hard capacity near 32k against a 93k target;
workers rolled over every few tool calls to successors of about 9k).
With the realistic reserve it is ~127k there; small windows (about
110k and below) can still be dominated. false: do not roll over at
hard capacity; send the request as before worker rollover existed and
let the provider judge it.
Trait Implementations§
Source§impl Clone for WorkerPolicy
impl Clone for WorkerPolicy
impl Copy for WorkerPolicy
Source§impl Debug for WorkerPolicy
impl Debug for WorkerPolicy
impl Eq for WorkerPolicy
Source§impl PartialEq for WorkerPolicy
impl PartialEq for WorkerPolicy
impl StructuralPartialEq for WorkerPolicy
Auto Trait Implementations§
impl Freeze for WorkerPolicy
impl RefUnwindSafe for WorkerPolicy
impl Send for WorkerPolicy
impl Sync for WorkerPolicy
impl Unpin for WorkerPolicy
impl UnsafeUnpin for WorkerPolicy
impl UnwindSafe for WorkerPolicy
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
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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
key and return true if they are equal.