pub struct LlmClient { /* private fields */ }Expand description
A composed, ready-to-use LLM client.
Wraps the layered provider stack and applies model-alias resolution to each
request. Clone is cheap (Arc internally).
Implementations§
Source§impl LlmClient
impl LlmClient
Sourcepub fn chat(&self, req: ChatRequest) -> ChatBuilder
pub fn chat(&self, req: ChatRequest) -> ChatBuilder
Begin a chat request, optionally attaching tools via
ChatBuilder::with_tool. Await the result to run it.
Sourcepub async fn chat_once(&self, req: ChatRequest) -> LlmResult<ChatResponse>
pub async fn chat_once(&self, req: ChatRequest) -> LlmResult<ChatResponse>
Single-shot chat with no tool loop.
Sourcepub async fn chat_stream(&self, req: ChatRequest) -> LlmResult<ChatStream>
pub async fn chat_stream(&self, req: ChatRequest) -> LlmResult<ChatStream>
Streaming chat.
Sourcepub async fn embed(&self, req: EmbedRequest) -> LlmResult<EmbedResponse>
pub async fn embed(&self, req: EmbedRequest) -> LlmResult<EmbedResponse>
Generate embeddings.
Sourcepub fn session_cost_usd(&self) -> f64
pub fn session_cost_usd(&self) -> f64
Cumulative session cost in USD, if a CostTrackingLayer handle was
registered via LlmClientBuilder::track_cost.
Sourcepub fn provider(&self) -> &Arc<dyn LlmProvider>
pub fn provider(&self) -> &Arc<dyn LlmProvider>
The underlying composed provider.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for LlmClient
impl !UnwindSafe for LlmClient
impl Freeze for LlmClient
impl Send for LlmClient
impl Sync for LlmClient
impl Unpin for LlmClient
impl UnsafeUnpin for LlmClient
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