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<'s, M>(
&'s self,
params: ChatCompleteParameters<M>,
) -> Pin<Box<dyn Future<Output = Result<GenericChatCompletionResponse<GenericMessage>>> + Send + 's>>
fn chat_complete<'s, M>( &'s self, params: ChatCompleteParameters<M>, ) -> Pin<Box<dyn Future<Output = Result<GenericChatCompletionResponse<GenericMessage>>> + Send + 's>>
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 · Source§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 Message = <B as StreamingChatProvider>::Message
type Message = <B as StreamingChatProvider>::Message
Chat message type consumed by this backend.
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<'s, M>(
&'s self,
params: ChatCompleteParameters<M>,
) -> Self::Delta<'s>
fn chat_complete_stream<'s, M>( &'s self, params: ChatCompleteParameters<M>, ) -> Self::Delta<'s>
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<'s, M>( &'s self, params: ChatCompleteParameters<M>, ) -> Self::EventStream<'s>
Source§impl<B: TranscriptionProvider> TranscriptionProvider for ArtificialClient<B>
impl<B: TranscriptionProvider> TranscriptionProvider for ArtificialClient<B>
fn transcribe<'s>( &'s self, request: TranscriptionRequest, ) -> Pin<Box<dyn Future<Output = Result<TranscriptionResult>> + Send + 's>>
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> UnsafeUnpin for ArtificialClient<B>
impl<B> UnwindSafe for ArtificialClient<B>where
B: RefUnwindSafe,
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