Share via


AzureTextEmbedding Class

Azure Text Embedding class.

Note: This class is marked as 'experimental' and may change in the future.

Initialize an AzureTextEmbedding service.

service_id: The service ID. (Optional) api_key: The optional api key. If provided, will override the value in the

env vars or .env file.

deployment_name: The optional deployment. If provided, will override the value (text_deployment_name) in the env vars or .env file.

endpoint: The optional deployment endpoint. If provided will override the value in the env vars or .env file.

base_url: The optional deployment base_url. If provided will override the value in the env vars or .env file.

api_version: The optional deployment api version. If provided will override the value in the env vars or .env file.

ad_token: The Azure AD token for authentication. (Optional) ad_token_provider: Whether to use Azure Active Directory authentication.

(Optional) The default value is False.

token_endpoint: The Azure AD token endpoint. (Optional) default_headers: The default headers mapping of string keys to

string values for HTTP requests. (Optional)

async_client (Optional[AsyncAzureOpenAI]): An existing client to use. (Optional) env_file_path (str | None): Use the environment settings file as a fallback to

environment variables. (Optional)

Constructor

AzureTextEmbedding(service_id: str | None = None, api_key: str | None = None, deployment_name: str | None = None, endpoint: str | None = None, base_url: str | None = None, api_version: str | None = None, ad_token: str | None = None, ad_token_provider: Callable[[], str | Awaitable[str]] | None = None, token_endpoint: str | None = None, default_headers: Mapping[str, str] | None = None, async_client: AsyncAzureOpenAI | None = None, env_file_path: str | None = None)

Parameters

Name Description
service_id
Default value: None
api_key
Default value: None
deployment_name
Default value: None
endpoint
Default value: None
base_url
Default value: None
api_version
Default value: None
ad_token
Default value: None
ad_token_provider
Default value: None
token_endpoint
Default value: None
default_headers
Default value: None
async_client
Default value: None
env_file_path
Default value: None

Methods

from_dict

Initialize an Azure OpenAI service from a dictionary of settings.

from_dict

Initialize an Azure OpenAI service from a dictionary of settings.

from_dict(settings: dict[str, Any]) -> AzureTextEmbedding

Parameters

Name Description
settings
Required

A dictionary of settings for the service. should contain keys: deployment_name, endpoint, api_key and optionally: api_version, ad_auth

Attributes

ai_model_id

ai_model_id: Annotated[str, StringConstraints(strip_whitespace=True, min_length=1)]

ai_model_type

ai_model_type: OpenAIModelTypes

client

client: AsyncOpenAI

completion_tokens

completion_tokens: int

is_experimental

is_experimental = True

prompt_tokens

prompt_tokens: int

service_id

service_id: str

stage_status

stage_status = 'experimental'

total_tokens

total_tokens: int