pub struct Client { /* private fields */ }
Expand description
The OpenAI
client
Implementations§
Source§impl Client
impl Client
Sourcepub async fn raw_chat(&self, req: &ChatRequest) -> Result<ChatResponse>
pub async fn raw_chat(&self, req: &ChatRequest) -> Result<ChatResponse>
§Errors
Returns Err
if there is a network error communicating to OpenAI
Sourcepub async fn chat(&self, req: impl Into<ChatRequest> + Send) -> Result<String>
pub async fn chat(&self, req: impl Into<ChatRequest> + Send) -> Result<String>
§Errors
Returns Err
if there is a network error communicating to OpenAI
Sourcepub async fn stream_text(
&self,
req: TextRequest<'_>,
) -> Result<impl Stream<Item = Result<String>>>
pub async fn stream_text( &self, req: TextRequest<'_>, ) -> Result<impl Stream<Item = Result<String>>>
§Errors
Returns Err
if there is a network error communicating to OpenAI
Sourcepub async fn stream_chat(
&self,
req: impl Into<ChatRequest> + Send,
) -> Result<impl Stream<Item = Result<String>>>
pub async fn stream_chat( &self, req: impl Into<ChatRequest> + Send, ) -> Result<impl Stream<Item = Result<String>>>
§Errors
Returns Err
if there is a network error communicating to OpenAI
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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