pub struct DefaultCtx {
pub ctx_window: usize,
/* private fields */
}Expand description
Fallback strategy — matches legacy behavior byte-for-byte.
Fields§
§ctx_window: usizeToken budget for this provider (from ProviderConfig.context_window,
clamped to a defensive minimum of 8000 to avoid divide-by-zero
and thrashing in pathological configs).
Implementations§
Source§impl DefaultCtx
impl DefaultCtx
Sourcepub fn new(provider: &ProviderConfig) -> Self
pub fn new(provider: &ProviderConfig) -> Self
Construct a DefaultCtx from a provider config.
Trait Implementations§
Source§impl Clone for DefaultCtx
impl Clone for DefaultCtx
Source§fn clone(&self) -> DefaultCtx
fn clone(&self) -> DefaultCtx
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 CtxBuilder for DefaultCtx
impl CtxBuilder for DefaultCtx
Source§fn build_messages(
&self,
conv: &Conversation,
system_prompt: &str,
turn_reminder: &str,
) -> (Vec<Message>, ContextStats)
fn build_messages( &self, conv: &Conversation, system_prompt: &str, turn_reminder: &str, ) -> (Vec<Message>, ContextStats)
Build the messages array to send to the LLM for this turn. Read more
Source§fn needs_compression(&self, conv: &Conversation, system_tokens: usize) -> bool
fn needs_compression(&self, conv: &Conversation, system_tokens: usize) -> bool
Whether the conversation should be compressed. Default: never.
Source§fn compression_plan(&self, conv: &Conversation) -> Option<(String, usize)>
fn compression_plan(&self, conv: &Conversation) -> Option<(String, usize)>
Produce a compression plan
(content_to_summarize, messages_to_remove). Default: None (no compression).Source§fn truncate_tool_output(&self, result: &mut ToolResult, tool_name: &str)
fn truncate_tool_output(&self, result: &mut ToolResult, tool_name: &str)
Truncate a single tool output in place.
Source§fn ctx_window(&self) -> usize
fn ctx_window(&self) -> usize
Effective token budget for this strategy. Read more
Auto Trait Implementations§
impl Freeze for DefaultCtx
impl RefUnwindSafe for DefaultCtx
impl Send for DefaultCtx
impl Sync for DefaultCtx
impl Unpin for DefaultCtx
impl UnsafeUnpin for DefaultCtx
impl UnwindSafe for DefaultCtx
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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