pub struct ArtificialClient<B> { /* private fields */ }Expand description
A client bound to a single provider.
Clone the client if you need to share it across tasks—B controls whether
that’s cheap (e.g. wraps an Arc) or a deep copy.
Implementations§
Source§impl<B> ArtificialClient<B>where
B: PromptExecutionProvider,
impl<B> ArtificialClient<B>where
B: PromptExecutionProvider,
Trait Implementations§
Source§impl<B: ChatCompletionProvider> ChatCompletionProvider for ArtificialClient<B>
impl<B: ChatCompletionProvider> ChatCompletionProvider for ArtificialClient<B>
Source§type Message = <B as ChatCompletionProvider>::Message
type Message = <B as ChatCompletionProvider>::Message
Chat message type consumed by this backend.
Source§fn chat_complete<'p, M>(
&self,
params: ChatCompleteParameters<M>,
) -> Pin<Box<dyn Future<Output = Result<GenericChatCompletionResponse<GenericMessage>>> + Send + 'p>>
fn chat_complete<'p, M>( &self, params: ChatCompleteParameters<M>, ) -> Pin<Box<dyn Future<Output = Result<GenericChatCompletionResponse<GenericMessage>>> + Send + 'p>>
Execute the chat prompt and deserialize the provider’s reply into
P::Output.Source§impl<B: Clone> Clone for ArtificialClient<B>
impl<B: Clone> Clone for ArtificialClient<B>
Source§fn clone(&self) -> ArtificialClient<B>
fn clone(&self) -> ArtificialClient<B>
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<B: Debug> Debug for ArtificialClient<B>
impl<B: Debug> Debug for ArtificialClient<B>
Source§impl<B: PromptExecutionProvider> PromptExecutionProvider for ArtificialClient<B>
impl<B: PromptExecutionProvider> PromptExecutionProvider for ArtificialClient<B>
Source§type Message = <B as PromptExecutionProvider>::Message
type Message = <B as PromptExecutionProvider>::Message
Chat message type consumed by this backend. Read more
Source§fn prompt_execute<'a, 'p, P>(
&'a self,
prompt: P,
) -> Pin<Box<dyn Future<Output = Result<GenericChatCompletionResponse<P::Output>>> + Send + 'p>>where
P: PromptTemplate + Send + Sync + 'p,
<P as IntoPrompt>::Message: Into<Self::Message>,
'a: 'p,
fn prompt_execute<'a, 'p, P>(
&'a self,
prompt: P,
) -> Pin<Box<dyn Future<Output = Result<GenericChatCompletionResponse<P::Output>>> + Send + 'p>>where
P: PromptTemplate + Send + Sync + 'p,
<P as IntoPrompt>::Message: Into<Self::Message>,
'a: 'p,
Execute the prompt and deserialize the provider’s reply into
P::Output. Read moreSource§impl<B: StreamingChatProvider> StreamingChatProvider for ArtificialClient<B>
impl<B: StreamingChatProvider> StreamingChatProvider for ArtificialClient<B>
Source§type Delta<'s> = <B as StreamingChatProvider>::Delta<'s>
where
Self: 's
type Delta<'s> = <B as StreamingChatProvider>::Delta<'s> where Self: 's
The item type returned on the stream. For now it is plain UTF-8 text
chunks, but back-ends are free to wrap it in richer enums if needed.
Source§fn chat_complete_stream<'p, M>(
&self,
params: ChatCompleteParameters<M>,
) -> Self::Delta<'p>
fn chat_complete_stream<'p, M>( &self, params: ChatCompleteParameters<M>, ) -> Self::Delta<'p>
Start a streaming chat completion.
Source§impl<B: StreamingEventsProvider> StreamingEventsProvider for ArtificialClient<B>
impl<B: StreamingEventsProvider> StreamingEventsProvider for ArtificialClient<B>
type EventStream<'s> = <B as StreamingEventsProvider>::EventStream<'s> where Self: 's
fn chat_complete_events_stream<'p, M>( &self, params: ChatCompleteParameters<M>, ) -> Self::EventStream<'p>
Auto Trait Implementations§
impl<B> Freeze for ArtificialClient<B>
impl<B> RefUnwindSafe for ArtificialClient<B>where
B: RefUnwindSafe,
impl<B> Send for ArtificialClient<B>
impl<B> Sync for ArtificialClient<B>
impl<B> Unpin for ArtificialClient<B>
impl<B> UnwindSafe for ArtificialClient<B>where
B: RefUnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)