pub struct OffloadConditions {
pub context_utilization: Option<ConditionValue>,
pub block_threshold: Option<ConditionValue>,
pub preserve_recent: Option<ConditionValue>,
}Expand description
Conditions that decide when and how an offload strategy fires (OffloadConditions).
context_utilizationsets when the strategy fires."80%"fires at 80% of the context window; a whole number of 1,000 or more fires at that many conversation tokens, and is rejected if it exceeds the model’s context window.block_thresholdsets how large each block, or each message forOffloadTarget::All, must be to act on. A whole number selects content larger than that many tokens;"5%"selects content larger than 5% of the context window.preserve_recentsets which matching messages it never touches. A whole number keeps that many of the newest;"70%"keeps the newest 70% of them.
With no context_utilization, the strategy runs before every model call, or on each message as
it arrives when the target isn’t OffloadTarget::All and preserve_recent is unset or 0.
Target OffloadTarget::All acts on whole messages: drop removes them, summarize merges each
contiguous run, and truncate elides the middle and takes no block_threshold. Any other target
acts on each block.
Fields§
§context_utilization: Option<ConditionValue>Context usage at or above which the strategy fires: "80%" of the context window, or a
whole number of 1,000 or more for conversation tokens, at most the model’s context window.
block_threshold: Option<ConditionValue>Size above which a message (target All) or block is offloaded: a whole number of tokens
above 0, or "5%" of the context window. Unset, there is no size check. Media the token
count measures as 0, alone or in a tool result, always passes.
preserve_recent: Option<ConditionValue>Newest matching messages never touched: a count, or "70%" of the matches, rounded up so a
share above 0 keeps at least one.
Implementations§
Source§impl OffloadConditions
impl OffloadConditions
Sourcepub fn builder() -> OffloadConditionsBuilder
pub fn builder() -> OffloadConditionsBuilder
Create an instance of OffloadConditions using the builder syntax
Trait Implementations§
Source§impl Clone for OffloadConditions
impl Clone for OffloadConditions
Source§impl Debug for OffloadConditions
impl Debug for OffloadConditions
Source§impl Default for OffloadConditions
impl Default for OffloadConditions
Source§impl PartialEq for OffloadConditions
impl PartialEq for OffloadConditions
impl StructuralPartialEq for OffloadConditions
Auto Trait Implementations§
impl Freeze for OffloadConditions
impl RefUnwindSafe for OffloadConditions
impl Send for OffloadConditions
impl Sync for OffloadConditions
impl Unpin for OffloadConditions
impl UnsafeUnpin for OffloadConditions
impl UnwindSafe for OffloadConditions
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> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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