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.
The clock is the caller’s, injected from the one sampling point; the round trip it measures around each call is the lead the next renewal leaves with, so the lead follows the provider this door reaches.
Implementations§
Source§impl<C: FnMut() -> Result<TimeMs, AxError>> Warmed<C>
impl<C: FnMut() -> Result<TimeMs, AxError>> Warmed<C>
Sourcepub fn new(
model: Box<dyn Model + Send>,
setting: KeepWarm,
clock: C,
) -> Warmed<C>
pub fn new( model: Box<dyn Model + Send>, setting: KeepWarm, clock: C, ) -> Warmed<C>
Wraps model; under KeepWarm::Off it only forwards.
Sourcepub fn next_due(&self) -> Option<u64>
pub fn next_due(&self) -> Option<u64>
See Warmth::next_due.
Sourcepub fn renew_due(&mut self, now_ms: u64) -> Result<Vec<ModelReturn>, AxError>
pub fn renew_due(&mut self, now_ms: u64) -> Result<Vec<ModelReturn>, AxError>
Sends every renewal due by now_ms through the adapter this door
owns; see Warmth::renew_due.
§Errors
The model’s failure, unchanged.
Trait Implementations§
Source§impl<C: FnMut() -> Result<TimeMs, AxError>> Model for Warmed<C>
impl<C: FnMut() -> Result<TimeMs, AxError>> Model for Warmed<C>
Source§fn provider_account(&self) -> Option<ProviderAccountBinding>
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>
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)
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.
fn call(&mut self, req: &ModelRequest<'_>) -> Result<ModelReturn, AxError>
Source§fn call_streaming(
&mut self,
req: &ModelRequest<'_>,
onto: Increments<'_>,
) -> Result<ModelReturn, AxError>
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: &mut dyn FnMut(&Increment),
_early: &mut dyn FnMut(&ToolCall),
) -> Result<ModelReturn, AxError>
fn call_speculating( &mut self, req: &ModelRequest<'_>, onto: &mut dyn FnMut(&Increment), _early: &mut dyn FnMut(&ToolCall), ) -> 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> 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