pub struct ArtificialClient<B> { /* private fields */ }
Expand description
A client bound to a single provider backend B
.
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: Backend,
impl<B> ArtificialClient<B>where
B: Backend,
Sourcepub async fn chat_complete<P>(&self, prompt: P) -> Result<P::Output>
pub async fn chat_complete<P>(&self, prompt: P) -> Result<P::Output>
Run a prompt on the backend and return the deserialised output.
§Errors
Any provider-specific failure is converted into
crate::error::ArtificialError
and bubbled up transparently.
Sourcepub fn backend(&self) -> &B
pub fn backend(&self) -> &B
Access the underlying backend (e.g. to tweak provider-specific settings).
Sourcepub fn into_backend(self) -> B
pub fn into_backend(self) -> B
Consume the client and return the inner backend.
Trait Implementations§
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 moreAuto Trait Implementations§
impl<B> Freeze for ArtificialClient<B>where
B: Freeze,
impl<B> RefUnwindSafe for ArtificialClient<B>where
B: RefUnwindSafe,
impl<B> Send for ArtificialClient<B>where
B: Send,
impl<B> Sync for ArtificialClient<B>where
B: Sync,
impl<B> Unpin for ArtificialClient<B>where
B: Unpin,
impl<B> UnwindSafe for ArtificialClient<B>where
B: UnwindSafe,
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