AzureAIEmbeddingsModel#

class langchain_azure_ai.embeddings.inference.AzureAIEmbeddingsModel[source]#

Bases: BaseModel, Embeddings

Azure AI model inference for embeddings.

Examples

If your endpoint supports multiple models, indicate the parameter model_name:

Troubleshooting:

To diagnostic issues with the model, you can enable debug logging:

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

param api_version: str | None = None#

The API version to use for the Azure AI model inference API. If None, the default version is used.

param client_kwargs: Dict[str, Any] = {}#

Additional kwargs for the Azure AI client used.

param credential: str | AzureKeyCredential | TokenCredential [Required]#

The API key or credential to use for the Azure AI model inference.

param dimensions: int | None = None#

The number of dimensions in the embeddings to generate. If None, the model’s default is used.

param embed_batch_size: int = 1024#

The batch size for embedding requests. The default is 1024.

param endpoint: str | None = None#

The endpoint URI where the model is deployed. Either this or the project_connection_string parameter must be specified.

param model_kwargs: Dict[str, Any] = {}#

Additional kwargs model parameters.

param model_name: str | None = None#

The name of the model to use for inference, if the endpoint is running more than one model. If not, this parameter is ignored.

param project_connection_string: str | None = None#

The connection string to use for the Azure AI project. If this is specified, then the endpoint parameter becomes optional and credential has to be of type TokenCredential.

classmethod validate_environment(values: Dict) β†’ Any[source]#

Validate that api key exists in environment.

Parameters:

values (Dict)

Return type:

Any

async aembed_documents(texts: list[str]) β†’ list[list[float]][source]#

Asynchronous Embed search docs.

Parameters:

texts (list[str]) – List of text to embed.

Returns:

List of embeddings.

Return type:

list[list[float]]

async aembed_query(text: str) β†’ list[float][source]#

Asynchronous Embed query text.

Parameters:

text (str) – Text to embed.

Returns:

Embedding.

Return type:

list[float]

embed_documents(texts: list[str]) β†’ list[list[float]][source]#

Embed search docs.

Parameters:

texts (list[str]) – List of text to embed.

Returns:

List of embeddings.

Return type:

list[list[float]]

embed_query(text: str) β†’ list[float][source]#

Embed query text.

Parameters:

text (str) – Text to embed.

Returns:

Embedding.

Return type:

list[float]