Struct async_openai::Client
source · pub struct Client<C: Config> { /* private fields */ }
Expand description
Client is a container for config, backoff and http_client used to make API calls.
Implementations§
source§impl Client<OpenAIConfig>
impl Client<OpenAIConfig>
sourcepub fn new() -> Self
pub fn new() -> Self
Client with default OpenAIConfig
source§impl<C: Config> Client<C>
impl<C: Config> Client<C>
sourcepub fn build(
http_client: Client,
config: C,
backoff: ExponentialBackoff
) -> Self
pub fn build( http_client: Client, config: C, backoff: ExponentialBackoff ) -> Self
Create client with a custom HTTP client, OpenAI config, and backoff.
sourcepub fn with_config(config: C) -> Self
pub fn with_config(config: C) -> Self
Create client with OpenAIConfig or crate::config::AzureConfig
sourcepub fn with_http_client(self, http_client: Client) -> Self
pub fn with_http_client(self, http_client: Client) -> Self
Provide your own client to make HTTP requests with.
sourcepub fn with_backoff(self, backoff: ExponentialBackoff) -> Self
pub fn with_backoff(self, backoff: ExponentialBackoff) -> Self
Exponential backoff for retrying rate limited requests.
sourcepub fn completions(&self) -> Completions<'_, C>
pub fn completions(&self) -> Completions<'_, C>
To call Completions group related APIs using this client.
sourcepub fn moderations(&self) -> Moderations<'_, C>
pub fn moderations(&self) -> Moderations<'_, C>
To call Moderations group related APIs using this client.
sourcepub fn fine_tuning(&self) -> FineTuning<'_, C>
pub fn fine_tuning(&self) -> FineTuning<'_, C>
To call FineTuning group related APIs using this client.
sourcepub fn embeddings(&self) -> Embeddings<'_, C>
pub fn embeddings(&self) -> Embeddings<'_, C>
To call Embeddings group related APIs using this client.
sourcepub fn assistants(&self) -> Assistants<'_, C>
pub fn assistants(&self) -> Assistants<'_, C>
To call Assistants group related APIs using this client.
sourcepub fn vector_stores(&self) -> VectorStores<'_, C>
pub fn vector_stores(&self) -> VectorStores<'_, C>
To call VectorStores group related APIs using this client.
pub fn config(&self) -> &C
Trait Implementations§
Auto Trait Implementations§
impl<C> Freeze for Client<C>where
C: Freeze,
impl<C> !RefUnwindSafe for Client<C>
impl<C> Send for Client<C>where
C: Send,
impl<C> Sync for Client<C>where
C: Sync,
impl<C> Unpin for Client<C>where
C: Unpin,
impl<C> !UnwindSafe for Client<C>
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