pub struct ClientBuilder<Ext, ApiKey = NeedsApiKey, H = Client> { /* private fields */ }Implementations§
Source§impl<Ext, H> ClientBuilder<Ext, NeedsApiKey, H>
impl<Ext, H> ClientBuilder<Ext, NeedsApiKey, H>
Sourcepub fn api_key<ApiKey>(
self,
api_key: impl Into<ApiKey>,
) -> ClientBuilder<Ext, ApiKey, H>
pub fn api_key<ApiKey>( self, api_key: impl Into<ApiKey>, ) -> ClientBuilder<Ext, ApiKey, H>
Set the API key for this client. This must be done before the build method can be
called
Source§impl<Ext, ApiKey, H> ClientBuilder<Ext, ApiKey, H>where
Ext: Clone,
impl<Ext, ApiKey, H> ClientBuilder<Ext, ApiKey, H>where
Ext: Clone,
Sourcepub fn http_client<U>(self, http_client: U) -> ClientBuilder<Ext, ApiKey, U>
pub fn http_client<U>(self, http_client: U) -> ClientBuilder<Ext, ApiKey, U>
Set the HTTP backend used in this client
Source§impl<Ext, ExtBuilder, Key, H> ClientBuilder<ExtBuilder, Key, H>
impl<Ext, ExtBuilder, Key, H> ClientBuilder<ExtBuilder, Key, H>
Source§impl<H> ClientBuilder<AnthropicBuilder, AnthropicKey, H>
Create a new anthropic client using the builder
impl<H> ClientBuilder<AnthropicBuilder, AnthropicKey, H>
Create a new anthropic client using the builder
§Example
use rig::providers::anthropic::{ClientBuilder, self};
// Initialize the Anthropic client
let anthropic_client = ClientBuilder::new("your-claude-api-key")
.anthropic_version(ANTHROPIC_VERSION_LATEST)
.anthropic_beta("prompt-caching-2024-07-31")
.build()pub fn anthropic_version(self, anthropic_version: &str) -> Self
pub fn anthropic_betas(self, anthropic_betas: &[&str]) -> Self
pub fn anthropic_beta(self, anthropic_beta: &str) -> Self
Source§impl<H> ClientBuilder<AzureExtBuilder, AzureOpenAIAuth, H>
impl<H> ClientBuilder<AzureExtBuilder, AzureOpenAIAuth, H>
Sourcepub fn api_version(self, api_version: &str) -> Self
pub fn api_version(self, api_version: &str) -> Self
API version to use (e.g., “2024-10-21” for GA, “2024-10-01-preview” for preview)
Source§impl<H> ClientBuilder<AzureExtBuilder, AzureOpenAIAuth, H>
impl<H> ClientBuilder<AzureExtBuilder, AzureOpenAIAuth, H>
Sourcepub fn azure_endpoint(self, endpoint: String) -> ClientBuilder<H>
pub fn azure_endpoint(self, endpoint: String) -> ClientBuilder<H>
Azure OpenAI endpoint URL, for example: https://{your-resource-name}.openai.azure.com
Source§impl<T> ClientBuilder<GaladrielBuilder, BearerAuth, T>
impl<T> ClientBuilder<GaladrielBuilder, BearerAuth, T>
pub fn fine_tune_api_key<S>(self, fine_tune_api_key: S) -> Self
Source§impl<H> ClientBuilder<HuggingFaceBuilder, BearerAuth, H>
impl<H> ClientBuilder<HuggingFaceBuilder, BearerAuth, H>
pub fn subprovider(self, subprovider: SubProvider) -> Self
Trait Implementations§
Source§impl<Ext: Clone, ApiKey: Clone, H: Clone> Clone for ClientBuilder<Ext, ApiKey, H>
impl<Ext: Clone, ApiKey: Clone, H: Clone> Clone for ClientBuilder<Ext, ApiKey, H>
Source§fn clone(&self) -> ClientBuilder<Ext, ApiKey, H>
fn clone(&self) -> ClientBuilder<Ext, ApiKey, H>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<ExtBuilder, H> Default for ClientBuilder<ExtBuilder, NeedsApiKey, H>
impl<ExtBuilder, H> Default for ClientBuilder<ExtBuilder, NeedsApiKey, H>
Auto Trait Implementations§
impl<Ext, ApiKey, H> Freeze for ClientBuilder<Ext, ApiKey, H>
impl<Ext, ApiKey, H> RefUnwindSafe for ClientBuilder<Ext, ApiKey, H>
impl<Ext, ApiKey, H> Send for ClientBuilder<Ext, ApiKey, H>
impl<Ext, ApiKey, H> Sync for ClientBuilder<Ext, ApiKey, H>
impl<Ext, ApiKey, H> Unpin for ClientBuilder<Ext, ApiKey, H>
impl<Ext, ApiKey, H> UnwindSafe for ClientBuilder<Ext, ApiKey, H>
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
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> 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 more