langchain-azure-ai is an integration package that provides first-class support for Azure AI Foundry capabilities within the LangChain and LangGraph ecosystems. It currently ships at version 1.2.2 and maintains an active release cadence with frequent updates and patches.
pip install -U langchain-azure-aiVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize and use the `AzureAIOpenAIApiChatModel` for chat completions. It showcases both API key and Azure Entra ID (via `DefaultAzureCredential`) authentication methods, preferring environment variables for configuration.
Migrate to `AzureAIOpenAIApiChatModel` and `AzureAIOpenAIApiEmbeddingsModel` for new development. If using deprecated classes, install `langchain-azure-ai[v1]` and update imports to `from langchain_azure_ai.chat_models.inference import AzureAIChatCompletionsModel`.
Replace `project_connection_string` with `project_endpoint` when initializing models.
Update tracing implementations to use `AzureAIOpenTelemetryTracer`. Ensure `langchain-azure-ai[opentelemetry]` is installed.
Update agent creation logic to use the V2 implementation. The `AgentServiceFactory` for V1 now requires the `langchain-azure-ai[v1]` extra.
Ensure your `langchain` package is updated to at least version `1.2.13` to leverage `init_chat_model` effectively. Otherwise, configure clients directly.
Ensure your environment is configured for Azure CLI login (`az login`) or use `DefaultAzureCredential`. Verify that the assigned identity has the 'Azure AI User' role on the Foundry project.