Struct tokio_openai::Client
source · 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>) -> Result<String>
pub async fn chat(&self, req: impl Into<ChatRequest>) -> 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: ChatRequest
) -> Result<impl Stream<Item = Result<String>>>
pub async fn stream_chat( &self, req: ChatRequest ) -> Result<impl Stream<Item = Result<String>>>
Errors
Returns Err
if there is a network error communicating to OpenAI