Struct ContextWindowExceeded
pub struct ContextWindowExceeded {
pub estimated_tokens: usize,
pub model_context_window: usize,
pub raw_estimated_tokens: usize,
pub system_tokens: usize,
pub tool_schema_tokens: usize,
}Expand description
The complete provider-facing request cannot fit the active model’s capacity.
Fields§
§estimated_tokens: usizeThe count the refusal was decided on: the raw estimate, scaled up by the calibration ratio when provider-reported usage supplied one.
model_context_window: usize§raw_estimated_tokens: usizeThe same request’s raw estimate, before calibration. The shares below
are parts of this total, never of estimated_tokens.
system_tokens: usizeRaw estimate of the leading system messages’ share of the request.
tool_schema_tokens: usizeRaw estimate of the native tool schemas’ share of the request; 0
when the request carried no native tools.
Implementations§
Source§impl ContextWindowExceeded
impl ContextWindowExceeded
Sourcepub fn breakdown(&self) -> String
pub fn breakdown(&self) -> String
Operator-facing account of what filled the window.
The Display text is the localized user-facing remediation and
deliberately carries no numbers, which left the operator’s own log line
empty: the one place the cause should be recoverable said nothing.
Every share is in raw-estimate units and the conversation share is the remainder of the raw total. Calibration against provider-reported usage is shown as its own term instead of being folded into any share: folded into the conversation, a 2x correction on a schema-heavy request would report a long conversation and point the operator at the wrong fix.
Trait Implementations§
Source§impl Debug for ContextWindowExceeded
impl Debug for ContextWindowExceeded
Source§impl Display for ContextWindowExceeded
impl Display for ContextWindowExceeded
Source§impl Error for ContextWindowExceeded
impl Error for ContextWindowExceeded
1.30.0 · §fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · §fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for ContextWindowExceeded
impl RefUnwindSafe for ContextWindowExceeded
impl Send for ContextWindowExceeded
impl Sync for ContextWindowExceeded
impl Unpin for ContextWindowExceeded
impl UnsafeUnpin for ContextWindowExceeded
impl UnwindSafe for ContextWindowExceeded
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§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