pub struct ContextCompressionConfig {
pub enabled: bool,
pub threshold_ratio: f64,
pub protect_first_n: usize,
pub protect_last_n: usize,
pub max_passes: u32,
pub summary_max_chars: usize,
pub source_max_chars: usize,
pub timeout_secs: u64,
pub summary_model: Option<String>,
pub identifier_policy: String,
pub tool_result_retrim_chars: usize,
pub tool_result_trim_exempt: Vec<String>,
}Fields§
§enabled: boolEnable automatic context compression. Default: true.
threshold_ratio: f64Fraction of context window that triggers compression (0.0–1.0). Default: 0.50.
protect_first_n: usizeNumber of messages to protect at the start (system prompt + initial context). Default: 3.
protect_last_n: usizeNumber of messages to protect at the end (recent conversation). Default: 4.
max_passes: u32Maximum compression passes before giving up. Default: 3.
summary_max_chars: usizeMaximum characters retained in stored compaction summary. Default: 4000.
source_max_chars: usizeSafety cap for compaction source transcript passed to the summarizer. Default: 50000.
timeout_secs: u64Timeout in seconds for the summarization LLM call. Default: 60.
summary_model: Option<String>Override model for summarization (cheaper/faster). Default: same as main model.
identifier_policy: StringIdentifier preservation policy: "strict" or "off". Default: "strict".
tool_result_retrim_chars: usizeMaximum chars for old tool results during fast-trim pass. Default: 2000.
tool_result_trim_exempt: Vec<String>Tool names exempt from result trimming. Default: [].
Trait Implementations§
Source§impl Clone for ContextCompressionConfig
impl Clone for ContextCompressionConfig
Source§fn clone(&self) -> ContextCompressionConfig
fn clone(&self) -> ContextCompressionConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContextCompressionConfig
impl Debug for ContextCompressionConfig
Source§impl Default for ContextCompressionConfig
impl Default for ContextCompressionConfig
Source§impl<'de> Deserialize<'de> for ContextCompressionConfig
impl<'de> Deserialize<'de> for ContextCompressionConfig
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>,
Source§impl JsonSchema for ContextCompressionConfig
impl JsonSchema for ContextCompressionConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for ContextCompressionConfig
impl RefUnwindSafe for ContextCompressionConfig
impl Send for ContextCompressionConfig
impl Sync for ContextCompressionConfig
impl Unpin for ContextCompressionConfig
impl UnsafeUnpin for ContextCompressionConfig
impl UnwindSafe for ContextCompressionConfig
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<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