The `llama-index-embeddings-azure-openai` library provides an integration for LlamaIndex to leverage Azure OpenAI's embedding models. It allows users to generate sophisticated numerical representations of text for use within LlamaIndex applications, particularly for Retrieval-Augmented Generation (RAG) workflows. This library is an actively developed component of the broader LlamaIndex ecosystem, with updates typically aligning with the main LlamaIndex project's release cycle.
pip install llama-index-embeddings-azure-openaiVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize `AzureOpenAIEmbedding` and set it as the global embedding model for LlamaIndex. It fetches necessary Azure OpenAI credentials from environment variables, which is the recommended secure practice. Replace placeholder values with your actual Azure OpenAI details.
Ensure `AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_API_KEY`, `AZURE_OPENAI_API_VERSION`, and `AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME` environment variables are set, or pass these parameters directly to the `AzureOpenAIEmbedding` constructor.
Consult Azure OpenAI documentation for model availability by region. Configure `AzureOpenAIEmbedding` and `AzureOpenAI` (for LLMs) with distinct `azure_endpoint` values if their respective deployments are in different regions.
Always check the `pyproject.toml` or `setup.py` of `llama-index-embeddings-azure-openai` for its exact `llama-index-core` dependency range. When encountering conflicts, try upgrading or downgrading `llama-index-core` or the `azure-openai` integration package to a compatible version. Using `pip install --upgrade llama-index llama-index-embeddings-azure-openai` may help resolve to compatible versions, but manual intervention might be needed for specific scenarios.
For versions 0.5.0+, utilize the `azure_ad_token_provider` and `use_azure_ad=True` parameters in `AzureOpenAIEmbedding`. Verify that `AZURE_OPENAI_API_KEY` is not set if relying solely on Azure AD for authentication, unless explicitly required by your specific Azure setup.
Ensure that `api_key`, `azure_endpoint`, `api_version`, and `deployment_name` are correctly set when initializing `AzureOpenAIEmbedding`. Verify that the API key is valid and the endpoint URL is correct and includes the resource name.
Explicitly pass the `api_key` parameter to the `AzureOpenAIEmbedding` constructor, or ensure the `AZURE_OPENAI_API_KEY` environment variable is correctly set before importing the library and that its value is not empty.
Pass the `api_version` parameter with a valid Azure OpenAI API version string (e.g., '2023-07-01-preview', '2024-02-15-preview') when creating the `AzureOpenAIEmbedding` instance, or set the `OPENAI_API_VERSION` environment variable.
Ensure `llama-index-embeddings-azure-openai` is installed, and import `AzureOpenAIEmbedding` from the correct and specific path: `from llama_index.embeddings.azure_openai import AzureOpenAIEmbedding`.
Verify that the `deployment_name` passed to `AzureOpenAIEmbedding` exactly matches the deployment name you configured in your Azure OpenAI Studio for the embedding model, and ensure the model is successfully deployed.