AzureAIEmbeddingsModel()The project endpoint associated with the AI project. If this is specified,
Azure AI model inference for embeddings.
This class has been deprecated in favor of AzureAIOpenAIApiEmbeddingsModel.
Examples:
from langchain_azure_ai.embeddings import AzureAIEmbeddingsModel
embed_model = AzureAIEmbeddingsModel(
endpoint="https://[your-endpoint].inference.ai.azure.com",
credential="your-api-key",
)
If your endpoint supports multiple models, indicate the parameter model_name:
from langchain_azure_ai.embeddings import AzureAIEmbeddingsModel
embed_model = AzureAIEmbeddingsModel(
endpoint="https://[your-service].services.ai.azure.com/models",
credential="your-api-key",
model="cohere-embed-v3-multilingual"
)
Troubleshooting:
To diagnostic issues with the model, you can enable debug logging:
import sys
import logging
from langchain_azure_ai.embeddings import AzureAIEmbeddingsModel
logger = logging.getLogger("azure")
# Set the desired logging level.
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler(stream=sys.stdout)
logger.addHandler(handler)
model = AzureAIEmbeddingsModel(
endpoint="https://[your-service].services.ai.azure.com/models",
credential="your-api-key",
model="cohere-embed-v3-multilingual",
client_kwargs={ "logging_enable": True }
)The name of the model to use for inference, if the endpoint is running more than one model. If not, this parameter is ignored.
The batch size for embedding requests. The default is 1024.
The number of dimensions in the embeddings to generate. If None, the model's default is used.
Additional kwargs model parameters.
Initialize the Azure AI model inference client.
Embed search docs.
Embed query text.
Asynchronous Embed search docs.
Asynchronous Embed query text.