Skip to main content

Warmed

Struct Warmed 

Source
pub struct Warmed<C> { /* private fields */ }
Expand description

The door a run’s requests enter the keep-warm account by: it owns the adapter a run calls and is itself the Model the turn loop is handed, so every request that reached the provider is recorded without the turn loop knowing keep-warm exists.

It forwards every call method of Model rather than inheriting a default, because a default is correct and only slower: an inherited call_speculating drops the early calls, and no read then starts while the model writes (crates/runtime/spec/Prefix.lean D97).

The clock is the caller’s, injected from the one sampling point. The door measures its endpoint’s Lead from a renewal’s round trip and from a real call’s first increment, never from a whole call, whose generation the provider’s lifetime does not wait for (D100).

Implementations§

Source§

impl<C: FnMut() -> Result<TimeMs, AxError>> Warmed<C>

Source

pub fn new( model: Box<dyn Model + Send>, setting: KeepWarm, clock: C, lead: Lead, ) -> Warmed<C>

Wraps model, which reaches the endpoint lead is read for; under KeepWarm::Off it only forwards.

Source

pub fn next_due(&self) -> Option<u64>

See Warmth::next_due; the lead is the endpoint’s reading now.

Source

pub fn renew_due(&mut self, now_ms: u64) -> RenewalRound

Sends every renewal due by now_ms through the adapter this door owns, and takes each one’s round trip as the endpoint’s lead: a renewal asks for one token, so its answer follows the prefill. A clock or adapter failure ends the round as its refusal.

Trait Implementations§

Source§

impl<C: FnMut() -> Result<TimeMs, AxError>> Model for Warmed<C>

Source§

fn provider_account(&self) -> Option<ProviderAccountBinding>

The non-secret identity recorded before each actual request: the roster’s provider and current account, answered without asking the vault.
Source§

fn account_roster(&self) -> Option<AccountRoster>

The accounts this adapter can call as; None for an adapter with no named account. With two accounts or more each entry’s usable asks the vault, so a caller asks once per round.
Source§

fn select_account(&mut self, account: &ServerLabel)

Selects the account every later request of this adapter uses, without sending a request; a name outside the roster leaves the selection as it was. The credential is redeemed at call time, so selecting cannot fail.
Source§

fn prefix_held(&self) -> Option<PrefixHeld>

The wait the last call took at its endpoint’s gate behind a pre-warm of its shared prefix (crates/kernel/spec/Model.lean D60); None when it took none. Asked after every attempt, on success and on failure, by the turn that writes the prefix_held line; an adapter with no gate answers None.
Source§

fn call(&mut self, req: &ModelRequest<'_>) -> Result<ModelReturn, AxError>

Source§

fn call_streaming( &mut self, req: &ModelRequest<'_>, onto: Increments<'_>, ) -> Result<ModelReturn, AxError>

The same call, reporting text as it arrives. Read more
Source§

fn call_speculating( &mut self, req: &ModelRequest<'_>, onto: Increments<'_>, early: EarlyCalls<'_>, ) -> Result<ModelReturn, AxError>

The streaming call, also handing over each tool call as soon as it is complete. Read more

Auto Trait Implementations§

§

impl<C> !RefUnwindSafe for Warmed<C>

§

impl<C> !Sync for Warmed<C>

§

impl<C> !UnwindSafe for Warmed<C>

§

impl<C> Freeze for Warmed<C>
where C: Freeze,

§

impl<C> Send for Warmed<C>
where C: Send,

§

impl<C> Unpin for Warmed<C>
where C: Unpin,

§

impl<C> UnsafeUnpin for Warmed<C>
where C: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.