pub struct Client<Ext = Nothing, H = Client> { /* private fields */ }Implementations§
Source§impl<Ext, ExtBuilder, Key, H> Client<Ext, H>where
ExtBuilder: Clone + Default + ProviderBuilder<Output = Ext, ApiKey = Key>,
Ext: Provider<Builder = ExtBuilder>,
H: Default + HttpClientExt,
Key: ApiKey,
impl<Ext, ExtBuilder, Key, H> Client<Ext, H>where
ExtBuilder: Clone + Default + ProviderBuilder<Output = Ext, ApiKey = Key>,
Ext: Provider<Builder = ExtBuilder>,
H: Default + HttpClientExt,
Key: ApiKey,
Source§impl<Ext, Builder, H> Client<Ext, H>where
H: Default + HttpClientExt,
Ext: Provider<Builder = Builder>,
Builder: Default + ProviderBuilder,
impl<Ext, Builder, H> Client<Ext, H>where
H: Default + HttpClientExt,
Ext: Provider<Builder = Builder>,
Builder: Default + ProviderBuilder,
pub fn builder() -> ClientBuilder<Builder, NeedsApiKey, H>
Source§impl<T> Client<CohereExt, T>
impl<T> Client<CohereExt, T>
pub fn embeddings<D: Embed>( &self, model: impl Into<String>, input_type: &str, ) -> EmbeddingsBuilder<EmbeddingModel<T>, D>
Sourcepub fn embedding_model(
&self,
model: impl Into<String>,
input_type: &str,
) -> EmbeddingModel<T>
pub fn embedding_model( &self, model: impl Into<String>, input_type: &str, ) -> EmbeddingModel<T>
Note: default embedding dimension of 0 will be used if model is not known.
If this is the case, it’s better to use function embedding_model_with_ndims
Sourcepub fn embedding_model_with_ndims(
&self,
model: impl Into<String>,
input_type: &str,
ndims: usize,
) -> EmbeddingModel<T>
pub fn embedding_model_with_ndims( &self, model: impl Into<String>, input_type: &str, ndims: usize, ) -> EmbeddingModel<T>
Create an embedding model with the given name and the number of dimensions in the embedding generated by the model.
Source§impl<T> Client<MiraExt, T>where
T: HttpClientExt + 'static,
impl<T> Client<MiraExt, T>where
T: HttpClientExt + 'static,
Source§impl<H> Client<OpenAIResponsesExt, H>
impl<H> Client<OpenAIResponsesExt, H>
Sourcepub fn extractor<U>(
&self,
model: impl Into<String>,
) -> ExtractorBuilder<ResponsesCompletionModel<H>, U>
pub fn extractor<U>( &self, model: impl Into<String>, ) -> ExtractorBuilder<ResponsesCompletionModel<H>, U>
Create an extractor builder with the given completion model. Uses the OpenAI Responses API (default behavior).
Sourcepub fn completions_api(self) -> CompletionsClient<H>
pub fn completions_api(self) -> CompletionsClient<H>
Create a Completions API client from this Responses API client. Useful for switching to the traditional Chat Completions API.
Source§impl<H> Client<OpenAICompletionsExt, H>
impl<H> Client<OpenAICompletionsExt, H>
Sourcepub fn extractor<U>(
&self,
model: impl Into<String>,
) -> ExtractorBuilder<CompletionModel<H>, U>
pub fn extractor<U>( &self, model: impl Into<String>, ) -> ExtractorBuilder<CompletionModel<H>, U>
Create an extractor builder with the given completion model. Uses the OpenAI Chat Completions API.
Sourcepub fn responses_api(self) -> Client<H>
pub fn responses_api(self) -> Client<H>
Create a Responses API client from this Completions API client. Useful for switching to the newer Responses API.
Trait Implementations§
Source§impl<M, Ext, H> AudioGenerationClient for Client<Ext, H>
Available on crate feature audio only.
impl<M, Ext, H> AudioGenerationClient for Client<Ext, H>
Available on crate feature
audio only.Source§type AudioGenerationModel = M
type AudioGenerationModel = M
The AudioGenerationModel used by the Client
Source§fn audio_generation_model(
&self,
model: impl Into<String>,
) -> Self::AudioGenerationModel
fn audio_generation_model( &self, model: impl Into<String>, ) -> Self::AudioGenerationModel
Create an audio generation model with the given name. Read more
Source§impl<M, Ext, H> CompletionClient for Client<Ext, H>
impl<M, Ext, H> CompletionClient for Client<Ext, H>
Source§type CompletionModel = M
type CompletionModel = M
The type of CompletionModel used by the client.
Source§fn completion_model(&self, model: impl Into<String>) -> Self::CompletionModel
fn completion_model(&self, model: impl Into<String>) -> Self::CompletionModel
Create a completion model with the given model. Read more
Source§fn agent(&self, model: impl Into<String>) -> AgentBuilder<Self::CompletionModel>
fn agent(&self, model: impl Into<String>) -> AgentBuilder<Self::CompletionModel>
Create an agent builder with the given completion model. Read more
Source§fn extractor<T>(
&self,
model: impl Into<String>,
) -> ExtractorBuilder<Self::CompletionModel, T>
fn extractor<T>( &self, model: impl Into<String>, ) -> ExtractorBuilder<Self::CompletionModel, T>
Create an extractor builder with the given completion model.
Source§impl<M, Ext, H> EmbeddingsClient for Client<Ext, H>
impl<M, Ext, H> EmbeddingsClient for Client<Ext, H>
Source§type EmbeddingModel = M
type EmbeddingModel = M
The type of EmbeddingModel used by the Client
Source§fn embedding_model(&self, model: impl Into<String>) -> Self::EmbeddingModel
fn embedding_model(&self, model: impl Into<String>) -> Self::EmbeddingModel
Create an embedding model with the given model. Read more
Source§fn embedding_model_with_ndims(
&self,
model: impl Into<String>,
ndims: usize,
) -> Self::EmbeddingModel
fn embedding_model_with_ndims( &self, model: impl Into<String>, ndims: usize, ) -> Self::EmbeddingModel
Create an embedding model with the given model identifier string and the number of dimensions in the embedding generated by the model.
This is the suggested method if you need to use a model not included in
Self::EmbeddingModel::Models Read moreSource§fn embeddings<D: Embed>(
&self,
model: impl Into<String>,
) -> EmbeddingsBuilder<Self::EmbeddingModel, D>
fn embeddings<D: Embed>( &self, model: impl Into<String>, ) -> EmbeddingsBuilder<Self::EmbeddingModel, D>
Create an embedding builder with the given embedding model. Read more
Source§fn embeddings_with_ndims<D: Embed>(
&self,
model: &str,
ndims: usize,
) -> EmbeddingsBuilder<Self::EmbeddingModel, D>
fn embeddings_with_ndims<D: Embed>( &self, model: &str, ndims: usize, ) -> EmbeddingsBuilder<Self::EmbeddingModel, D>
Create an embedding builder with the given name and the number of dimensions in the embedding generated by the model. Read more
Source§impl<Ext, H> HttpClientExt for Client<Ext, H>
impl<Ext, H> HttpClientExt for Client<Ext, H>
Source§fn send<T, U>(
&self,
req: Request<T>,
) -> impl Future<Output = Result<Response<LazyBody<U>>>> + WasmCompatSend + 'static
fn send<T, U>( &self, req: Request<T>, ) -> impl Future<Output = Result<Response<LazyBody<U>>>> + WasmCompatSend + 'static
Send a HTTP request, get a response back (as bytes). Response must be able to be turned back into Bytes.
Source§fn send_multipart<U>(
&self,
req: Request<Form>,
) -> impl Future<Output = Result<Response<LazyBody<U>>>> + WasmCompatSend + 'static
fn send_multipart<U>( &self, req: Request<Form>, ) -> impl Future<Output = Result<Response<LazyBody<U>>>> + WasmCompatSend + 'static
Send a HTTP request with a multipart body, get a response back (as bytes). Response must be able to be turned back into Bytes (although usually for the response, you will probably want to specify Bytes anyway).
Source§fn send_streaming<T>(
&self,
req: Request<T>,
) -> impl Future<Output = Result<StreamingResponse>> + WasmCompatSend
fn send_streaming<T>( &self, req: Request<T>, ) -> impl Future<Output = Result<StreamingResponse>> + WasmCompatSend
Send a HTTP request, get a streamed response back (as a stream of
bytes::Bytes.)Source§impl<M, Ext, H> ImageGenerationClient for Client<Ext, H>
Available on crate feature image only.
impl<M, Ext, H> ImageGenerationClient for Client<Ext, H>
Available on crate feature
image only.Source§type ImageGenerationModel = M
type ImageGenerationModel = M
The ImageGenerationModel used by the Client
Source§fn image_generation_model(
&self,
model: impl Into<String>,
) -> Self::ImageGenerationModel
fn image_generation_model( &self, model: impl Into<String>, ) -> Self::ImageGenerationModel
Create an image generation model with the given name. Read more
Source§fn custom_image_generation_model(
&self,
model: impl Into<String>,
) -> Self::ImageGenerationModel
fn custom_image_generation_model( &self, model: impl Into<String>, ) -> Self::ImageGenerationModel
Create an image generation model with the given name. Read more
Source§impl<M, Ext, H> TranscriptionClient for Client<Ext, H>where
Ext: Capabilities<H, Transcription = Capable<M>>,
M: TranscriptionModel<Client = Self> + WasmCompatSend,
impl<M, Ext, H> TranscriptionClient for Client<Ext, H>where
Ext: Capabilities<H, Transcription = Capable<M>>,
M: TranscriptionModel<Client = Self> + WasmCompatSend,
Source§type TranscriptionModel = M
type TranscriptionModel = M
The type of TranscriptionModel used by the Client
Source§fn transcription_model(
&self,
model: impl Into<String>,
) -> Self::TranscriptionModel
fn transcription_model( &self, model: impl Into<String>, ) -> Self::TranscriptionModel
Create a transcription model with the given name. Read more
Source§impl<Ext, H> VerifyClient for Client<Ext, H>
impl<Ext, H> VerifyClient for Client<Ext, H>
Auto Trait Implementations§
impl<Ext, H> Freeze for Client<Ext, H>
impl<Ext, H> RefUnwindSafe for Client<Ext, H>where
H: RefUnwindSafe,
Ext: RefUnwindSafe,
impl<Ext, H> Send for Client<Ext, H>
impl<Ext, H> Sync for Client<Ext, H>
impl<Ext, H> Unpin for Client<Ext, H>
impl<Ext, H> UnwindSafe for Client<Ext, H>where
H: UnwindSafe,
Ext: UnwindSafe,
Blanket Implementations§
Source§impl<T, M> AudioGenerationClientDyn for Twhere
T: AudioGenerationClient<AudioGenerationModel = M>,
M: AudioGenerationModel + 'static,
impl<T, M> AudioGenerationClientDyn for Twhere
T: AudioGenerationClient<AudioGenerationModel = M>,
M: AudioGenerationModel + 'static,
Source§fn audio_generation_model<'a>(
&self,
model: &str,
) -> Box<dyn AudioGenerationModelDyn + 'a>
fn audio_generation_model<'a>( &self, model: &str, ) -> Box<dyn AudioGenerationModelDyn + 'a>
👎Deprecated since 0.25.0:
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use ImageGenerationModel instead.Available on crate feature
audio only.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
Source§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
Source§impl<T, M, R> CompletionClientDyn for Twhere
T: CompletionClient<CompletionModel = M>,
M: CompletionModel<StreamingResponse = R> + 'static,
R: Clone + Unpin + GetTokenUsage + 'static,
impl<T, M, R> CompletionClientDyn for Twhere
T: CompletionClient<CompletionModel = M>,
M: CompletionModel<StreamingResponse = R> + 'static,
R: Clone + Unpin + GetTokenUsage + 'static,
Source§fn completion_model<'a>(&self, model: &str) -> Box<dyn CompletionModelDyn + 'a>
fn completion_model<'a>(&self, model: &str) -> Box<dyn CompletionModelDyn + 'a>
👎Deprecated since 0.25.0:
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use CompletionClient instead.Create a completion model with the given name.
Source§fn agent<'a>(&self, model: &str) -> AgentBuilder<CompletionModelHandle<'a>>
fn agent<'a>(&self, model: &str) -> AgentBuilder<CompletionModelHandle<'a>>
👎Deprecated since 0.25.0:
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use CompletionClient instead.Create an agent builder with the given completion model.
Source§impl<M, T> EmbeddingsClientDyn for Twhere
T: EmbeddingsClient<EmbeddingModel = M>,
M: EmbeddingModel + 'static,
impl<M, T> EmbeddingsClientDyn for Twhere
T: EmbeddingsClient<EmbeddingModel = M>,
M: EmbeddingModel + 'static,
Source§fn embedding_model<'a>(&self, model: &str) -> Box<dyn EmbeddingModelDyn + 'a>
fn embedding_model<'a>(&self, model: &str) -> Box<dyn EmbeddingModelDyn + 'a>
👎Deprecated since 0.25.0:
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use EmbeddingsClient instead.Create an embedding model with the given name.
Note: default embedding dimension of 0 will be used if model is not known.
If this is the case, it’s better to use function
embedding_model_with_ndimsSource§fn embedding_model_with_ndims<'a>(
&self,
model: &str,
ndims: usize,
) -> Box<dyn EmbeddingModelDyn + 'a>
fn embedding_model_with_ndims<'a>( &self, model: &str, ndims: usize, ) -> Box<dyn EmbeddingModelDyn + 'a>
👎Deprecated since 0.25.0:
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use EmbeddingsClient instead.Create an embedding model with the given name and the number of dimensions in the embedding generated by the model.
Source§impl<T, M> ImageGenerationClientDyn for Twhere
T: ImageGenerationClient<ImageGenerationModel = M>,
M: ImageGenerationModel + 'static,
impl<T, M> ImageGenerationClientDyn for Twhere
T: ImageGenerationClient<ImageGenerationModel = M>,
M: ImageGenerationModel + 'static,
Source§fn image_generation_model<'a>(
&self,
model: &str,
) -> Box<dyn ImageGenerationModelDyn + 'a>
fn image_generation_model<'a>( &self, model: &str, ) -> Box<dyn ImageGenerationModelDyn + 'a>
👎Deprecated since 0.25.0:
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use ImageGenerationClient instead.Available on crate feature
image only.Create an image generation model with the given name.
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<M, T> TranscriptionClientDyn for Twhere
T: TranscriptionClient<TranscriptionModel = M>,
M: TranscriptionModel + 'static,
impl<M, T> TranscriptionClientDyn for Twhere
T: TranscriptionClient<TranscriptionModel = M>,
M: TranscriptionModel + 'static,
Source§fn transcription_model<'a>(
&self,
model: &str,
) -> Box<dyn TranscriptionModelDyn + 'a>
fn transcription_model<'a>( &self, model: &str, ) -> Box<dyn TranscriptionModelDyn + 'a>
👎Deprecated since 0.25.0:
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use TranscriptionClient instead.Create a transcription model with the given name.