pub struct CompactionPolicy {
pub auto_enabled: bool,
pub auto_threshold_percent: u8,
pub tail_turns: usize,
pub tail_token_budget: usize,
pub tool_output_max_chars: usize,
pub summary_max_tokens: usize,
pub summarizer_input_token_budget: usize,
pub min_response_reserve_tokens: usize,
pub max_response_reserve_tokens: usize,
}Fields§
§auto_enabled: bool§auto_threshold_percent: u8§tail_turns: usize§tail_token_budget: usize§tool_output_max_chars: usize§summary_max_tokens: usize§summarizer_input_token_budget: usize§min_response_reserve_tokens: usize§max_response_reserve_tokens: usizeImplementations§
Source§impl CompactionPolicy
impl CompactionPolicy
Sourcepub fn summary_output_tokens(self, window: Option<usize>) -> usize
pub fn summary_output_tokens(self, window: Option<usize>) -> usize
The summarizer’s output cap for a model whose window is window.
Unknown window keeps the flat summary_max_tokens (the remote-provider
case — nothing better to go on). A known window caps the summary at
1/SUMMARY_OUTPUT_WINDOW_SHARE of it, so the input budget always has
room left; large windows are unaffected because summary_max_tokens
stays the ceiling.
Sourcepub fn summary_input_budget(self, window: Option<usize>) -> usize
pub fn summary_input_budget(self, window: Option<usize>) -> usize
Total input budget (fixed scaffold + history excerpt) for the summarizer, given the model’s window.
Monotonic in the window, which the previous computation was NOT: it subtracted a flat output cap and then treated a non-positive result as “window unknown”, falling back to the most permissive budget. An 8k model therefore got a 64k input budget while a 9k model got 1k — shrinking the window made the request bigger, and 8k-and-below could never compact.
Sourcepub fn response_reserve(self, request: &ChatRequest) -> usize
pub fn response_reserve(self, request: &ChatRequest) -> usize
Window room to hold back for the model’s response when sizing
compaction. Decoupled from the on-wire output cap: an explicit user cap
is the best reserve estimate, but AUTO (max_tokens == 0) reserves the
baseline plus the reasoning headroom the level implies — a High/Max
turn needs more room before the window counts as “full”.
Trait Implementations§
Source§impl Clone for CompactionPolicy
impl Clone for CompactionPolicy
Source§fn clone(&self) -> CompactionPolicy
fn clone(&self) -> CompactionPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CompactionPolicy
Source§impl Debug for CompactionPolicy
impl Debug for CompactionPolicy
Source§impl Default for CompactionPolicy
impl Default for CompactionPolicy
Source§impl<'de> Deserialize<'de> for CompactionPolicy
impl<'de> Deserialize<'de> for CompactionPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for CompactionPolicy
Source§impl PartialEq for CompactionPolicy
impl PartialEq for CompactionPolicy
Source§impl Serialize for CompactionPolicy
impl Serialize for CompactionPolicy
impl StructuralPartialEq for CompactionPolicy
Auto Trait Implementations§
impl Freeze for CompactionPolicy
impl RefUnwindSafe for CompactionPolicy
impl Send for CompactionPolicy
impl Sync for CompactionPolicy
impl Unpin for CompactionPolicy
impl UnsafeUnpin for CompactionPolicy
impl UnwindSafe for CompactionPolicy
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
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more