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>(
&self,
model: impl Into<String>,
input_type: &str,
) -> EmbeddingsBuilder<EmbeddingModel<T>, D>where
D: Embed,
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) -> Client<OpenAICompletionsExt, H>
pub fn completions_api(self) -> Client<OpenAICompletionsExt, 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<OpenAIResponsesExt, H>
pub fn responses_api(self) -> Client<OpenAIResponsesExt, 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> 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>,
) -> <Client<Ext, H> as CompletionClient>::CompletionModel
fn completion_model( &self, model: impl Into<String>, ) -> <Client<Ext, H> as CompletionClient>::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>,
) -> <Client<Ext, H> as EmbeddingsClient>::EmbeddingModel
fn embedding_model( &self, model: impl Into<String>, ) -> <Client<Ext, H> as EmbeddingsClient>::EmbeddingModel
Source§fn embedding_model_with_ndims(
&self,
model: impl Into<String>,
ndims: usize,
) -> <Client<Ext, H> as EmbeddingsClient>::EmbeddingModel
fn embedding_model_with_ndims( &self, model: impl Into<String>, ndims: usize, ) -> <Client<Ext, H> as EmbeddingsClient>::EmbeddingModel
Self::EmbeddingModel::Models Read moreSource§fn embeddings<D>(
&self,
model: impl Into<String>,
) -> EmbeddingsBuilder<Self::EmbeddingModel, D>where
D: Embed,
fn embeddings<D>(
&self,
model: impl Into<String>,
) -> EmbeddingsBuilder<Self::EmbeddingModel, D>where
D: Embed,
Source§fn embeddings_with_ndims<D>(
&self,
model: &str,
ndims: usize,
) -> EmbeddingsBuilder<Self::EmbeddingModel, D>where
D: Embed,
fn embeddings_with_ndims<D>(
&self,
model: &str,
ndims: usize,
) -> EmbeddingsBuilder<Self::EmbeddingModel, D>where
D: Embed,
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<Pin<Box<dyn Future<Output = Result<U, Error>> + Send>>>, Error>> + WasmCompatSend + 'static
fn send<T, U>( &self, req: Request<T>, ) -> impl Future<Output = Result<Response<Pin<Box<dyn Future<Output = Result<U, Error>> + Send>>>, Error>> + WasmCompatSend + 'static
Source§fn send_multipart<U>(
&self,
req: Request<Form>,
) -> impl Future<Output = Result<Response<Pin<Box<dyn Future<Output = Result<U, Error>> + Send>>>, Error>> + WasmCompatSend + 'static
fn send_multipart<U>( &self, req: Request<Form>, ) -> impl Future<Output = Result<Response<Pin<Box<dyn Future<Output = Result<U, Error>> + Send>>>, Error>> + WasmCompatSend + 'static
Source§fn send_streaming<T>(
&self,
req: Request<T>,
) -> impl Future<Output = Result<Response<Pin<Box<dyn WasmCompatSendStream<InnerItem = Result<Bytes, Error>, Item = Result<Bytes, Error>>>>>, Error>> + WasmCompatSend
fn send_streaming<T>( &self, req: Request<T>, ) -> impl Future<Output = Result<Response<Pin<Box<dyn WasmCompatSendStream<InnerItem = Result<Bytes, Error>, Item = Result<Bytes, Error>>>>>, Error>> + WasmCompatSend
bytes::Bytes.)Source§impl ProviderClient for Client<AnthropicExt>
impl ProviderClient for Client<AnthropicExt>
type Input = String
Source§fn from_env() -> Client<AnthropicExt>
fn from_env() -> Client<AnthropicExt>
fn from_val( input: <Client<AnthropicExt> as ProviderClient>::Input, ) -> Client<AnthropicExt>
Source§impl ProviderClient for Client<AzureExt>
impl ProviderClient for Client<AzureExt>
Source§fn from_env() -> Client<AzureExt>
fn from_env() -> Client<AzureExt>
Create a new Azure OpenAI client from the AZURE_API_KEY or AZURE_TOKEN, AZURE_API_VERSION, and AZURE_ENDPOINT environment variables.
type Input = AzureOpenAIClientParams
fn from_val(_: <Client<AzureExt> as ProviderClient>::Input) -> Client<AzureExt>
Source§impl ProviderClient for Client<CohereExt>
impl ProviderClient for Client<CohereExt>
Source§impl ProviderClient for Client<DeepSeekExt>
impl ProviderClient for Client<DeepSeekExt>
type Input = BearerAuth
Source§fn from_env() -> Client<DeepSeekExt>
fn from_env() -> Client<DeepSeekExt>
fn from_val( input: <Client<DeepSeekExt> as ProviderClient>::Input, ) -> Client<DeepSeekExt>
Source§impl ProviderClient for Client<GaladrielExt>
impl ProviderClient for Client<GaladrielExt>
Source§fn from_env() -> Client<GaladrielExt>
fn from_env() -> Client<GaladrielExt>
Create a new Galadriel client from the GALADRIEL_API_KEY environment variable,
and optionally from the GALADRIEL_FINE_TUNE_API_KEY environment variable.
Panics if the GALADRIEL_API_KEY environment variable is not set.
type Input = (String, Option<String>)
fn from_val( _: <Client<GaladrielExt> as ProviderClient>::Input, ) -> Client<GaladrielExt>
Source§impl ProviderClient for Client<GeminiExt>
impl ProviderClient for Client<GeminiExt>
Source§impl ProviderClient for Client<GroqExt>
impl ProviderClient for Client<GroqExt>
Source§impl ProviderClient for Client<HuggingFaceExt>
impl ProviderClient for Client<HuggingFaceExt>
Source§fn from_env() -> Client<HuggingFaceExt>
fn from_env() -> Client<HuggingFaceExt>
Create a new Huggingface client from the HUGGINGFACE_API_KEY environment variable.
Panics if the environment variable is not set.
type Input = String
fn from_val( input: <Client<HuggingFaceExt> as ProviderClient>::Input, ) -> Client<HuggingFaceExt>
Source§impl ProviderClient for Client<HyperbolicExt>
impl ProviderClient for Client<HyperbolicExt>
Source§fn from_env() -> Client<HyperbolicExt>
fn from_env() -> Client<HyperbolicExt>
Create a new Hyperbolic client from the HYPERBOLIC_API_KEY environment variable.
Panics if the environment variable is not set.
type Input = BearerAuth
fn from_val( input: <Client<HyperbolicExt> as ProviderClient>::Input, ) -> Client<HyperbolicExt>
Source§impl ProviderClient for Client<MiraExt>
impl ProviderClient for Client<MiraExt>
Source§impl ProviderClient for Client<MistralExt>
impl ProviderClient for Client<MistralExt>
Source§fn from_env() -> Client<MistralExt>
fn from_env() -> Client<MistralExt>
Create a new Mistral client from the MISTRAL_API_KEY environment variable.
Panics if the environment variable is not set.
type Input = String
fn from_val( input: <Client<MistralExt> as ProviderClient>::Input, ) -> Client<MistralExt>
Source§impl ProviderClient for Client<MoonshotExt>
impl ProviderClient for Client<MoonshotExt>
Source§fn from_env() -> Client<MoonshotExt>
fn from_env() -> Client<MoonshotExt>
Create a new Moonshot client from the MOONSHOT_API_KEY environment variable.
Panics if the environment variable is not set.
type Input = String
fn from_val( input: <Client<MoonshotExt> as ProviderClient>::Input, ) -> Client<MoonshotExt>
Source§impl ProviderClient for Client<OllamaExt>
impl ProviderClient for Client<OllamaExt>
Source§impl ProviderClient for Client<OpenAICompletionsExt>
impl ProviderClient for Client<OpenAICompletionsExt>
Source§fn from_env() -> Client<OpenAICompletionsExt>
fn from_env() -> Client<OpenAICompletionsExt>
Create a new OpenAI Completions API client from the OPENAI_API_KEY environment variable.
Panics if the environment variable is not set.
type Input = BearerAuth
fn from_val( input: <Client<OpenAICompletionsExt> as ProviderClient>::Input, ) -> Client<OpenAICompletionsExt>
Source§impl ProviderClient for Client<OpenAIResponsesExt>
impl ProviderClient for Client<OpenAIResponsesExt>
Source§fn from_env() -> Client<OpenAIResponsesExt>
fn from_env() -> Client<OpenAIResponsesExt>
Create a new OpenAI Responses API client from the OPENAI_API_KEY environment variable.
Panics if the environment variable is not set.
type Input = BearerAuth
fn from_val( input: <Client<OpenAIResponsesExt> as ProviderClient>::Input, ) -> Client<OpenAIResponsesExt>
Source§impl ProviderClient for Client<OpenRouterExt>
impl ProviderClient for Client<OpenRouterExt>
Source§fn from_env() -> Client<OpenRouterExt>
fn from_env() -> Client<OpenRouterExt>
Create a new openrouter client from the OPENROUTER_API_KEY environment variable.
Panics if the environment variable is not set.
type Input = BearerAuth
fn from_val( input: <Client<OpenRouterExt> as ProviderClient>::Input, ) -> Client<OpenRouterExt>
Source§impl ProviderClient for Client<PerplexityExt>
impl ProviderClient for Client<PerplexityExt>
Source§fn from_env() -> Client<PerplexityExt>
fn from_env() -> Client<PerplexityExt>
Create a new Perplexity client from the PERPLEXITY_API_KEY environment variable.
Panics if the environment variable is not set.
type Input = String
fn from_val( input: <Client<PerplexityExt> as ProviderClient>::Input, ) -> Client<PerplexityExt>
Source§impl ProviderClient for Client<TogetherExt>
impl ProviderClient for Client<TogetherExt>
Source§fn from_env() -> Client<TogetherExt>
fn from_env() -> Client<TogetherExt>
Create a new Together AI client from the TOGETHER_API_KEY environment variable.
Panics if the environment variable is not set.
type Input = String
fn from_val( input: <Client<TogetherExt> as ProviderClient>::Input, ) -> Client<TogetherExt>
Source§impl ProviderClient for Client<VoyageExt>
impl ProviderClient for Client<VoyageExt>
Source§impl ProviderClient for Client<XAiExt>
impl ProviderClient for Client<XAiExt>
Source§impl<M, Ext, H> TranscriptionClient for Client<Ext, H>where
Ext: Capabilities<H, Transcription = Capable<M>>,
M: TranscriptionModel<Client = Client<Ext, H>> + WasmCompatSend,
impl<M, Ext, H> TranscriptionClient for Client<Ext, H>where
Ext: Capabilities<H, Transcription = Capable<M>>,
M: TranscriptionModel<Client = Client<Ext, H>> + WasmCompatSend,
Source§type TranscriptionModel = M
type TranscriptionModel = M
Source§fn transcription_model(
&self,
model: impl Into<String>,
) -> <Client<Ext, H> as TranscriptionClient>::TranscriptionModel
fn transcription_model( &self, model: impl Into<String>, ) -> <Client<Ext, H> as TranscriptionClient>::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> 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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> 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.