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, H> Client<Ext, H>
impl<Ext, H> Client<Ext, H>
pub fn base_url(&self) -> &str
pub fn headers(&self) -> &HeaderMap
pub fn http_client(&self) -> &H
pub fn ext(&self) -> &Ext
Sourcepub fn from_parts(
base_url: String,
headers: HeaderMap,
http_client: H,
ext: Ext,
) -> Self
pub fn from_parts( base_url: String, headers: HeaderMap, http_client: H, ext: Ext, ) -> Self
Create a new client from individual parts. This is useful for converting between different provider extensions.
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<Ext, H> Client<Ext, H>where
H: HttpClientExt,
impl<Ext, H> Client<Ext, H>where
H: HttpClientExt,
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,
impl<T> Client<MiraExt, T>where
T: HttpClientExt,
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>
audio only.Source§type AudioGenerationModel = M
type AudioGenerationModel = M
Source§fn audio_generation_model(
&self,
model: impl Into<String>,
) -> Self::AudioGenerationModel
fn audio_generation_model( &self, model: impl Into<String>, ) -> Self::AudioGenerationModel
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
Source§fn completion_model(&self, model: impl Into<String>) -> Self::CompletionModel
fn completion_model(&self, model: impl Into<String>) -> Self::CompletionModel
Source§fn agent(&self, model: impl Into<String>) -> AgentBuilder<Self::CompletionModel>
fn agent(&self, model: impl Into<String>) -> AgentBuilder<Self::CompletionModel>
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>
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
Source§fn embedding_model(&self, model: impl Into<String>) -> Self::EmbeddingModel
fn embedding_model(&self, model: impl Into<String>) -> Self::EmbeddingModel
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
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>
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>
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>
image only.Source§type ImageGenerationModel = M
type ImageGenerationModel = M
Source§fn image_generation_model(
&self,
model: impl Into<String>,
) -> Self::ImageGenerationModel
fn image_generation_model( &self, model: impl Into<String>, ) -> Self::ImageGenerationModel
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
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
Source§fn transcription_model(
&self,
model: impl Into<String>,
) -> Self::TranscriptionModel
fn transcription_model( &self, model: impl Into<String>, ) -> Self::TranscriptionModel
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>
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use ImageGenerationModel instead.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
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>
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use CompletionClient instead.Source§fn agent<'a>(&self, model: &str) -> AgentBuilder<CompletionModelHandle<'a>>
fn agent<'a>(&self, model: &str) -> AgentBuilder<CompletionModelHandle<'a>>
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use CompletionClient instead.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>
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use EmbeddingsClient instead.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>
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use EmbeddingsClient instead.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>
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use ImageGenerationClient instead.image only.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>
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>
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>
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use TranscriptionClient instead.