Client

Struct Client 

Source
pub struct Client<C: Config> { /* private fields */ }
Available on crate feature _api only.
Expand description

Client is a container for config, backoff and http_client used to make API calls.

Implementations§

Source§

impl Client<OpenAIConfig>

Source

pub fn new() -> Self

Client with default OpenAIConfig

Source§

impl<C: Config> Client<C>

Source

pub fn build( http_client: Client, config: C, backoff: ExponentialBackoff, ) -> Self

Create client with a custom HTTP client, OpenAI config, and backoff.

Source

pub fn with_config(config: C) -> Self

Source

pub fn with_http_client(self, http_client: Client) -> Self

Provide your own client to make HTTP requests with.

Source

pub fn with_backoff(self, backoff: ExponentialBackoff) -> Self

Exponential backoff for retrying rate limited requests.

Source

pub fn models(&self) -> Models<'_, C>

Available on crate feature model only.

To call Models group related APIs using this client.

Source

pub fn completions(&self) -> Completions<'_, C>

Available on crate feature completions only.

To call Completions group related APIs using this client.

Source

pub fn chat(&self) -> Chat<'_, C>

Available on crate feature chat-completion only.

To call Chat group related APIs using this client.

Source

pub fn images(&self) -> Images<'_, C>

Available on crate feature image only.

To call Images group related APIs using this client.

Source

pub fn moderations(&self) -> Moderations<'_, C>

Available on crate feature moderation only.

To call Moderations group related APIs using this client.

Source

pub fn files(&self) -> Files<'_, C>

Available on crate feature file only.

To call Files group related APIs using this client.

Source

pub fn uploads(&self) -> Uploads<'_, C>

Available on crate feature upload only.

To call Uploads group related APIs using this client.

Source

pub fn fine_tuning(&self) -> FineTuning<'_, C>

Available on crate feature finetuning only.

To call FineTuning group related APIs using this client.

Source

pub fn embeddings(&self) -> Embeddings<'_, C>

Available on crate feature embedding only.

To call Embeddings group related APIs using this client.

Source

pub fn audio(&self) -> Audio<'_, C>

Available on crate feature audio only.

To call Audio group related APIs using this client.

Source

pub fn videos(&self) -> Videos<'_, C>

Available on crate feature video only.

To call Videos group related APIs using this client.

Source

pub fn assistants(&self) -> Assistants<'_, C>

Available on crate feature assistant only.

To call Assistants group related APIs using this client.

Source

pub fn threads(&self) -> Threads<'_, C>

Available on crate feature assistant only.

To call Threads group related APIs using this client.

Source

pub fn vector_stores(&self) -> VectorStores<'_, C>

Available on crate feature vectorstore only.

To call VectorStores group related APIs using this client.

Source

pub fn batches(&self) -> Batches<'_, C>

Available on crate feature batch only.

To call Batches group related APIs using this client.

Source

pub fn admin(&self) -> Admin<'_, C>

Available on crate feature administration only.

To call Admin group related APIs using this client. This groups together admin API keys, invites, users, projects, audit logs, and certificates.

Source

pub fn responses(&self) -> Responses<'_, C>

Available on crate feature responses only.

To call Responses group related APIs using this client.

Source

pub fn conversations(&self) -> Conversations<'_, C>

Available on crate feature responses only.

To call Conversations group related APIs using this client.

Source

pub fn containers(&self) -> Containers<'_, C>

Available on crate feature container only.

To call Containers group related APIs using this client.

Source

pub fn evals(&self) -> Evals<'_, C>

Available on crate feature evals only.

To call Evals group related APIs using this client.

Source

pub fn chatkit(&self) -> Chatkit<'_, C>

Available on crate feature chatkit only.
Source

pub fn realtime(&self) -> Realtime<'_, C>

Available on crate feature realtime only.

To call Realtime group related APIs using this client.

Source

pub fn config(&self) -> &C

Trait Implementations§

Source§

impl<C: Clone + Config> Clone for Client<C>

Source§

fn clone(&self) -> Client<C>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C: Debug + Config> Debug for Client<C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C: Default + Config> Default for Client<C>

Source§

fn default() -> Client<C>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<C> Freeze for Client<C>
where C: Freeze,

§

impl<C> !RefUnwindSafe for Client<C>

§

impl<C> Send for Client<C>

§

impl<C> Sync for Client<C>

§

impl<C> Unpin for Client<C>
where C: Unpin,

§

impl<C> !UnwindSafe for Client<C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more