pub struct ChatClient { /* private fields */ }👎Deprecated since 2.0.0:
The OpenAI direct clients are deprecated; use the Session API instead (ChatSession::new(&model)).
Expand description
Client for OpenAI-compatible chat completions backed by a local model.
Implementations§
Source§impl ChatClient
impl ChatClient
Sourcepub fn frequency_penalty(self, v: f64) -> Self
pub fn frequency_penalty(self, v: f64) -> Self
Set the frequency penalty.
Sourcepub fn max_tokens(self, v: u32) -> Self
pub fn max_tokens(self, v: u32) -> Self
Set the maximum number of tokens to generate.
Sourcepub fn temperature(self, v: f64) -> Self
pub fn temperature(self, v: f64) -> Self
Set the sampling temperature.
Sourcepub fn presence_penalty(self, v: f64) -> Self
pub fn presence_penalty(self, v: f64) -> Self
Set the presence penalty.
Sourcepub fn random_seed(self, v: u64) -> Self
pub fn random_seed(self, v: u64) -> Self
Set the random seed for reproducible results (Foundry extension).
Sourcepub fn response_format(self, v: ChatResponseFormat) -> Self
pub fn response_format(self, v: ChatResponseFormat) -> Self
Set the desired response format.
Sourcepub fn tool_choice(self, v: ChatToolChoice) -> Self
pub fn tool_choice(self, v: ChatToolChoice) -> Self
Set the tool choice strategy.
Sourcepub async fn complete_chat(
&self,
messages: &[ChatCompletionRequestMessage],
tools: Option<&[ChatCompletionTools]>,
) -> Result<CreateChatCompletionResponse, FoundryLocalError>
pub async fn complete_chat( &self, messages: &[ChatCompletionRequestMessage], tools: Option<&[ChatCompletionTools]>, ) -> Result<CreateChatCompletionResponse, FoundryLocalError>
Perform a non-streaming chat completion.
Sourcepub async fn complete_streaming_chat(
&self,
messages: &[ChatCompletionRequestMessage],
tools: Option<&[ChatCompletionTools]>,
) -> Result<ChatCompletionStream, FoundryLocalError>
pub async fn complete_streaming_chat( &self, messages: &[ChatCompletionRequestMessage], tools: Option<&[ChatCompletionTools]>, ) -> Result<ChatCompletionStream, FoundryLocalError>
Perform a streaming chat completion, returning a ChatCompletionStream.
Use the stream with futures_core::StreamExt::next() or
tokio_stream::StreamExt::next().
Auto Trait Implementations§
impl Freeze for ChatClient
impl RefUnwindSafe for ChatClient
impl Send for ChatClient
impl Sync for ChatClient
impl Unpin for ChatClient
impl UnsafeUnpin for ChatClient
impl UnwindSafe for ChatClient
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