pub struct LlmClientBuilder { /* private fields */ }Expand description
Builds an LlmClient from a primary provider, optional fallbacks, and a
stack of Tower layers.
Layers are applied outermost-first, matching the order they are added: the
first .layer(...) call sees the request first and the response last.
Implementations§
Source§impl LlmClientBuilder
impl LlmClientBuilder
Sourcepub fn provider<P: LlmProvider>(self, provider: P) -> Self
pub fn provider<P: LlmProvider>(self, provider: P) -> Self
Set the primary provider.
Sourcepub fn fallback<P: LlmProvider>(self, provider: P) -> Self
pub fn fallback<P: LlmProvider>(self, provider: P) -> Self
Add a fallback provider, tried in registration order after the primary.
Sourcepub fn alias(self, alias: impl Into<String>, model: impl Into<String>) -> Self
pub fn alias(self, alias: impl Into<String>, model: impl Into<String>) -> Self
Register a model alias (e.g. "fast" → "gpt-4o-mini").
Sourcepub fn track_cost(self, handle: SessionCost) -> Self
pub fn track_cost(self, handle: SessionCost) -> Self
Track the session-cost handle from a CostTrackingLayer so the client
can report session_cost_usd().
Trait Implementations§
Source§impl Default for LlmClientBuilder
impl Default for LlmClientBuilder
Source§fn default() -> LlmClientBuilder
fn default() -> LlmClientBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for LlmClientBuilder
impl !Send for LlmClientBuilder
impl !Sync for LlmClientBuilder
impl !UnwindSafe for LlmClientBuilder
impl Freeze for LlmClientBuilder
impl Unpin for LlmClientBuilder
impl UnsafeUnpin for LlmClientBuilder
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