AzureOpenAIProvider

Struct AzureOpenAIProvider 

Source
pub struct AzureOpenAIProvider { /* private fields */ }
Expand description

Azure OpenAI provider implementation.

This provider creates language models, embedding models, and image models that use Azure OpenAI endpoints. It handles Azure-specific authentication (api-key header) and URL formatting (deployment-based or v1 API).

§Examples

use llm_kit_azure::AzureClient;

let provider = AzureClient::new()
    .resource_name("my-azure-resource")
    .api_key("your-api-key")
    .build();

let model = provider.chat_model("gpt-4-deployment");

§Direct Instantiation (Alternative)

use llm_kit_azure::{AzureOpenAIProvider, AzureOpenAIProviderSettings};

let provider = AzureOpenAIProvider::new(
    AzureOpenAIProviderSettings::new()
        .with_resource_name("my-azure-resource")
        .with_api_key("your-api-key")
);

let model = provider.chat_model("gpt-4-deployment");

Implementations§

Source§

impl AzureOpenAIProvider

Source

pub fn new(settings: AzureOpenAIProviderSettings) -> Self

Creates a new Azure OpenAI provider.

§Panics

Panics if the settings are invalid (missing both base_url and resource_name).

Source

pub fn model(&self, deployment_id: impl Into<String>) -> Arc<dyn LanguageModel>

Creates a language model with the given deployment ID.

This is an alias for chat_model().

Source

pub fn chat_model( &self, deployment_id: impl Into<String>, ) -> Arc<dyn LanguageModel>

Creates a chat language model with the given deployment ID.

§Arguments
  • deployment_id - The deployment name/ID in Azure OpenAI
Source

pub fn completion_model( &self, deployment_id: impl Into<String>, ) -> Arc<dyn LanguageModel>

Creates a completion language model with the given deployment ID.

§Arguments
  • deployment_id - The deployment name/ID in Azure OpenAI
Source

pub fn text_embedding_model( &self, deployment_id: impl Into<String>, ) -> Arc<dyn EmbeddingModel<String>>

Creates a text embedding model with the given deployment ID.

§Arguments
  • deployment_id - The deployment name/ID in Azure OpenAI
Source

pub fn image_model( &self, deployment_id: impl Into<String>, ) -> Arc<dyn ImageModel>

Creates an image model with the given deployment ID.

§Arguments
  • deployment_id - The deployment name/ID in Azure OpenAI (e.g., dall-e-3 deployment)
Source

pub fn name(&self) -> &str

Gets the provider name.

Trait Implementations§

Source§

impl Provider for AzureOpenAIProvider

Source§

fn language_model( &self, deployment_id: &str, ) -> Result<Arc<dyn LanguageModel>, ProviderError>

Returns the language model with the given id. Read more
Source§

fn text_embedding_model( &self, deployment_id: &str, ) -> Result<Arc<dyn EmbeddingModel<String>>, ProviderError>

Returns the text embedding model with the given id. Read more
Source§

fn image_model( &self, deployment_id: &str, ) -> Result<Arc<dyn ImageModel>, ProviderError>

Returns the image model with the given id. Read more
Source§

fn transcription_model( &self, deployment_id: &str, ) -> Result<Arc<dyn TranscriptionModel>, ProviderError>

Returns the transcription model with the given id. Read more
Source§

fn speech_model( &self, deployment_id: &str, ) -> Result<Arc<dyn SpeechModel>, ProviderError>

Returns the speech model with the given id. Read more
Source§

fn reranking_model( &self, deployment_id: &str, ) -> Result<Arc<dyn RerankingModel>, ProviderError>

Returns the reranking model with the given id. Read more
Source§

fn specification_version(&self) -> &str

The provider must specify which provider interface version it implements. This will allow us to evolve the provider interface and retain backwards compatibility.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,