pub struct ChatClient { /* private fields */ }Expand description
Thin facade that pairs per-call default request values with a shared backend.
Constructed via ChatClient::new, typically with a backend produced by a
BackendFactory or by LlmBackend::new directly. Implements
Deref to dyn LlmBackend so the direct and prepared chat execution
paths, plus capability negotiation methods, are accessible directly.
Implementations§
Source§impl ChatClient
impl ChatClient
Sourcepub fn new(backend: Arc<dyn LlmBackend>, options: ChatClientOptions) -> Self
pub fn new(backend: Arc<dyn LlmBackend>, options: ChatClientOptions) -> Self
Create a client pairing per-call defaults with a shared backend.
The backend identity (family) is available via family
through the Deref to LlmBackend.
Sourcepub fn system_prompt(&self) -> Option<&str>
pub fn system_prompt(&self) -> Option<&str>
Returns the configured default system prompt, if any.
Sourcepub fn with_model(self, model: impl Into<String>) -> Self
pub fn with_model(self, model: impl Into<String>) -> Self
Returns the client with a new default model.
Sourcepub fn with_system_prompt(self, system_prompt: impl Into<String>) -> Self
pub fn with_system_prompt(self, system_prompt: impl Into<String>) -> Self
Returns the client with a new default system prompt.
Sourcepub fn clear_system_prompt(self) -> Self
pub fn clear_system_prompt(self) -> Self
Returns the client without a default system prompt.
Sourcepub fn create_request(
&self,
messages: Vec<ChatMessage>,
) -> ChatCompletionRequest
pub fn create_request( &self, messages: Vec<ChatMessage>, ) -> ChatCompletionRequest
Create a request pre-filled with this client’s default model and system prompt.
Trait Implementations§
Source§impl Clone for ChatClient
impl Clone for ChatClient
Source§fn clone(&self) -> ChatClient
fn clone(&self) -> ChatClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more