Struct ResolvedContextLimits
pub struct ResolvedContextLimits {
pub model_context_window: usize,
pub model_context_window_source: ModelContextWindowSource,
pub context_token_budget: usize,
}Expand description
Capacity and proactive-trim budget resolved together for one selected provider alias and model. This is a per-route materialized view, not a new configuration source: model capacity remains owned by provider config and budget policy remains owned by the agent’s runtime profile.
Fields§
§model_context_window: usize§model_context_window_source: ModelContextWindowSource§context_token_budget: usizeImplementations§
Source§impl ResolvedContextLimits
impl ResolvedContextLimits
Sourcepub fn legacy_fallback(budget: usize) -> Self
pub fn legacy_fallback(budget: usize) -> Self
Compatibility-fallback limits for paths that cannot resolve a route
(missing config or an empty agent alias): the unconfigured-window
fallback bound to the caller’s budget. 0 stays 0 (proactive
trimming disabled); a positive budget is honored, raising the stub
window to meet it, because the stub is not model truth (see
Self::bind_budget).
Sourcepub fn bind_budget(capacity: ResolvedModelContextWindow, budget: usize) -> Self
pub fn bind_budget(capacity: ResolvedModelContextWindow, budget: usize) -> Self
Bind an already-resolved proactive budget to a route’s capacity.
A configured capacity is a hard cap on every positive budget. The
UNCONFIGURED_CONTEXT_WINDOW_FALLBACK stub is not: it exists only so
budget arithmetic has an operand, and an operator’s explicit budget is
better evidence of the model’s real window than that stub. When the
capacity is a compatibility fallback, the window operand is raised to
the budget so context_token_budget <= model_context_window still
holds, while the source keeps reporting the capacity as unconfigured.
Sourcepub fn configured_model_context_window(self) -> Option<usize>
pub fn configured_model_context_window(self) -> Option<usize>
Return capacity only when it is configured for the selected route. Wire/UI consumers use absence to distinguish the 32k compatibility fallback from known model capacity.
Trait Implementations§
Source§impl Clone for ResolvedContextLimits
impl Clone for ResolvedContextLimits
Source§fn clone(&self) -> ResolvedContextLimits
fn clone(&self) -> ResolvedContextLimits
1.0.0 (const: unstable) · §fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ResolvedContextLimits
Source§impl Debug for ResolvedContextLimits
impl Debug for ResolvedContextLimits
impl Eq for ResolvedContextLimits
Source§impl PartialEq for ResolvedContextLimits
impl PartialEq for ResolvedContextLimits
impl StructuralPartialEq for ResolvedContextLimits
Auto Trait Implementations§
impl Freeze for ResolvedContextLimits
impl RefUnwindSafe for ResolvedContextLimits
impl Send for ResolvedContextLimits
impl Sync for ResolvedContextLimits
impl Unpin for ResolvedContextLimits
impl UnsafeUnpin for ResolvedContextLimits
impl UnwindSafe for ResolvedContextLimits
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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