pub struct RoutingQualityTracker { /* private fields */ }Expand description
Bounded tracker for recent model-routing outcomes.
Implementations§
Source§impl RoutingQualityTracker
impl RoutingQualityTracker
Sourcepub fn record(&mut self, outcome: RoutingOutcome)
pub fn record(&mut self, outcome: RoutingOutcome)
Records an outcome, retaining only the most recent 1000 outcomes.
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Returns the fraction of recorded outcomes meeting the quality threshold.
Sourcepub fn average_savings(&self) -> f64
pub fn average_savings(&self) -> f64
Returns the average token savings across recorded outcomes.
Sourcepub fn should_fallback(&self) -> bool
pub fn should_fallback(&self) -> bool
Returns whether recent route quality should trigger a fallback.
Trait Implementations§
Source§impl Debug for RoutingQualityTracker
impl Debug for RoutingQualityTracker
Source§impl Default for RoutingQualityTracker
impl Default for RoutingQualityTracker
Source§fn default() -> RoutingQualityTracker
fn default() -> RoutingQualityTracker
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RoutingQualityTracker
impl RefUnwindSafe for RoutingQualityTracker
impl Send for RoutingQualityTracker
impl Sync for RoutingQualityTracker
impl Unpin for RoutingQualityTracker
impl UnsafeUnpin for RoutingQualityTracker
impl UnwindSafe for RoutingQualityTracker
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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