Skip to main content

ProviderBuilder

Trait ProviderBuilder 

Source
pub trait ProviderBuilder:
    Sized
    + Default
    + Clone {
    type Extension<H>: Provider
       where H: HttpClientExt;
    type ApiKey: ApiKey;

    const BASE_URL: &'static str;

    // Required method
    fn build<H>(
        builder: &ClientBuilder<Self, Self::ApiKey, H>,
    ) -> Result<Self::Extension<H>>
       where H: HttpClientExt;

    // Provided method
    fn finish<H>(
        &self,
        builder: ClientBuilder<Self, Self::ApiKey, H>,
    ) -> Result<ClientBuilder<Self, Self::ApiKey, H>> { ... }
}
Expand description

An API provider extension builder, this abstracts over provider-specific builders which are able to configure and produce a given provider’s extension type

See Provider

Required Associated Constants§

Source

const BASE_URL: &'static str

Required Associated Types§

Required Methods§

Source

fn build<H>( builder: &ClientBuilder<Self, Self::ApiKey, H>, ) -> Result<Self::Extension<H>>
where H: HttpClientExt,

Build the provider extension from the client builder configuration.

Provided Methods§

Source

fn finish<H>( &self, builder: ClientBuilder<Self, Self::ApiKey, H>, ) -> Result<ClientBuilder<Self, Self::ApiKey, H>>

This method can be used to customize the fields of builder before it is used to create a client. For example, adding default headers

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl ProviderBuilder for AnthropicBuilder

Source§

const BASE_URL: &'static str = "https://api.anthropic.com"

Source§

type Extension<H> = AnthropicExt where H: HttpClientExt

Source§

type ApiKey = AnthropicKey

Source§

impl ProviderBuilder for AzureExtBuilder

Source§

impl ProviderBuilder for CohereBuilder

Source§

const BASE_URL: &'static str = "https://api.cohere.ai"

Source§

type Extension<H> = CohereExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth

Source§

impl ProviderBuilder for DeepSeekExtBuilder

Source§

const BASE_URL: &'static str = DEEPSEEK_API_BASE_URL

Source§

type Extension<H> = DeepSeekExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth

Source§

impl ProviderBuilder for GaladrielBuilder

Source§

const BASE_URL: &'static str = GALADRIEL_API_BASE_URL

Source§

type Extension<H> = GaladrielExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth

Source§

impl ProviderBuilder for GeminiBuilder

Source§

const BASE_URL: &'static str = GEMINI_API_BASE_URL

Source§

type Extension<H> = GeminiExt where H: HttpClientExt

Source§

type ApiKey = GeminiApiKey

Source§

impl ProviderBuilder for GroqBuilder

Source§

const BASE_URL: &'static str = GROQ_API_BASE_URL

Source§

type Extension<H> = GroqExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth

Source§

impl ProviderBuilder for HuggingFaceBuilder

Source§

const BASE_URL: &'static str = HUGGINGFACE_API_BASE_URL

Source§

type Extension<H> = HuggingFaceExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth

Source§

impl ProviderBuilder for HyperbolicBuilder

Source§

const BASE_URL: &'static str = HYPERBOLIC_API_BASE_URL

Source§

type Extension<H> = HyperbolicExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth

Source§

impl ProviderBuilder for MiraBuilder

Source§

const BASE_URL: &'static str = MIRA_API_BASE_URL

Source§

type Extension<H> = MiraExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth

Source§

impl ProviderBuilder for MistralBuilder

Source§

const BASE_URL: &'static str = MISTRAL_API_BASE_URL

Source§

type Extension<H> = MistralExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth

Source§

impl ProviderBuilder for MoonshotBuilder

Source§

const BASE_URL: &'static str = MOONSHOT_API_BASE_URL

Source§

type Extension<H> = MoonshotExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth

Source§

impl ProviderBuilder for OllamaBuilder

Source§

const BASE_URL: &'static str = OLLAMA_API_BASE_URL

Source§

type Extension<H> = OllamaExt where H: HttpClientExt

Source§

type ApiKey = Nothing

Source§

impl ProviderBuilder for OpenAICompletionsExtBuilder

Source§

const BASE_URL: &'static str = OPENAI_API_BASE_URL

Source§

type Extension<H> = OpenAICompletionsExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth

Source§

impl ProviderBuilder for OpenAIResponsesExtBuilder

Source§

const BASE_URL: &'static str = OPENAI_API_BASE_URL

Source§

type Extension<H> = OpenAIResponsesExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth

Source§

impl ProviderBuilder for OpenRouterExtBuilder

Source§

const BASE_URL: &'static str = OPENROUTER_API_BASE_URL

Source§

type Extension<H> = OpenRouterExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth

Source§

impl ProviderBuilder for PerplexityBuilder

Source§

const BASE_URL: &'static str = PERPLEXITY_API_BASE_URL

Source§

type Extension<H> = PerplexityExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth

Source§

impl ProviderBuilder for TogetherExtBuilder

Source§

const BASE_URL: &'static str = TOGETHER_AI_BASE_URL

Source§

type Extension<H> = TogetherExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth

Source§

impl ProviderBuilder for VoyageBuilder

Source§

const BASE_URL: &'static str = VOYAGEAI_API_BASE_URL

Source§

type Extension<H> = VoyageExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth

Source§

impl ProviderBuilder for XAiExtBuilder

Source§

const BASE_URL: &'static str = XAI_BASE_URL

Source§

type Extension<H> = XAiExt where H: HttpClientExt

Source§

type ApiKey = BearerAuth