pub struct FailoverModel { /* private fields */ }Expand description
A chat model that tries its candidates in order (see the module docs).
request.model is replaced by each candidate’s model.
Implementations§
Source§impl FailoverModel
impl FailoverModel
Sourcepub fn new(
candidates: Vec<Candidate>,
breakers: Arc<Breakers>,
clock: Arc<dyn Clock>,
last_attempt: bool,
) -> Self
pub fn new( candidates: Vec<Candidate>, breakers: Arc<Breakers>, clock: Arc<dyn Clock>, last_attempt: bool, ) -> Self
candidates: the primary first. last_attempt: whether the node
retries no more after this attempt (rate limits then fail over).
Sourcepub fn with_headers_timeout(self, timeout: Duration) -> Self
pub fn with_headers_timeout(self, timeout: Duration) -> Self
Change how long a candidate may take to answer (tests).
Trait Implementations§
Source§impl ChatModel for FailoverModel
impl ChatModel for FailoverModel
Source§fn chat(
&self,
request: ChatRequest,
) -> BoxFuture<'_, Result<ChatStream, LlmError>>
fn chat( &self, request: ChatRequest, ) -> BoxFuture<'_, Result<ChatStream, LlmError>>
Start a streaming chat completion.
Source§fn default_max_tokens(&self) -> Option<u32>
fn default_max_tokens(&self) -> Option<u32>
The output limit this model sends when a request sets none (a
providers file’s
defaults.max_tokens), so a node can tell whether the
run’s budget or this default limits its call.Auto Trait Implementations§
impl !RefUnwindSafe for FailoverModel
impl !UnwindSafe for FailoverModel
impl Forget for FailoverModel
impl Freeze for FailoverModel
impl Move for FailoverModel
impl Send for FailoverModel
impl Sync for FailoverModel
impl Unpin for FailoverModel
impl UnsafeUnpin for FailoverModelwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Candidate>: UnsafeUnpin,
*const ArcInner<Breakers> is !null: UnsafeUnpin,
PhantomData<ArcInner<Breakers>>: UnsafeUnpin,
*const ArcInner<dyn Clock> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Clock>>: 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