pub struct AzureOpenAIEmbeddingClient { /* private fields */ }Expand description
An Azure OpenAI embeddings client
(POST {endpoint}/openai/deployments/{deployment}/embeddings).
Implementations§
Source§impl AzureOpenAIEmbeddingClient
impl AzureOpenAIEmbeddingClient
Sourcepub fn new(
endpoint: impl Into<String>,
deployment: impl Into<String>,
api_key: impl Into<String>,
) -> Self
pub fn new( endpoint: impl Into<String>, deployment: impl Into<String>, api_key: impl Into<String>, ) -> Self
Create a client authenticating with a static API key
(api-key header).
Sourcepub fn with_token_credential(
endpoint: impl Into<String>,
deployment: impl Into<String>,
credential: Arc<dyn TokenCredential>,
) -> Self
pub fn with_token_credential( endpoint: impl Into<String>, deployment: impl Into<String>, credential: Arc<dyn TokenCredential>, ) -> Self
Create a client authenticating via a TokenCredential
(Authorization: Bearer <token>, e.g. Microsoft Entra ID).
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Build an API-key-authenticated client from AZURE_OPENAI_ENDPOINT,
AZURE_OPENAI_API_KEY, AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME, and
optional AZURE_OPENAI_API_VERSION.
Sourcepub fn with_api_version(self, api_version: impl Into<String>) -> Self
pub fn with_api_version(self, api_version: impl Into<String>) -> Self
Override the API version (default DEFAULT_API_VERSION).
Sourcepub fn deployment(&self) -> &str
pub fn deployment(&self) -> &str
The deployment name this client targets.
Trait Implementations§
Source§impl Clone for AzureOpenAIEmbeddingClient
impl Clone for AzureOpenAIEmbeddingClient
Source§fn clone(&self) -> AzureOpenAIEmbeddingClient
fn clone(&self) -> AzureOpenAIEmbeddingClient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl EmbeddingClient for AzureOpenAIEmbeddingClient
impl EmbeddingClient for AzureOpenAIEmbeddingClient
Source§fn get_embeddings<'life0, 'async_trait>(
&'life0 self,
values: Vec<String>,
options: Option<EmbeddingGenerationOptions>,
) -> Pin<Box<dyn Future<Output = Result<GeneratedEmbeddings>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_embeddings<'life0, 'async_trait>(
&'life0 self,
values: Vec<String>,
options: Option<EmbeddingGenerationOptions>,
) -> Pin<Box<dyn Future<Output = Result<GeneratedEmbeddings>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate embeddings for the given values (one per value, in order).
Auto Trait Implementations§
impl !RefUnwindSafe for AzureOpenAIEmbeddingClient
impl !UnwindSafe for AzureOpenAIEmbeddingClient
impl Freeze for AzureOpenAIEmbeddingClient
impl Send for AzureOpenAIEmbeddingClient
impl Sync for AzureOpenAIEmbeddingClient
impl Unpin for AzureOpenAIEmbeddingClient
impl UnsafeUnpin for AzureOpenAIEmbeddingClient
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