Azure AI
All functionality related toAzure AI Foundry and its related projects.
Integration packages for Azure AI, Dynamic Sessions, SQL Server are maintained inthelangchain-azure repository.
Chat models
We recommend developers start with the (langchain-azure-ai
) to access all the models available inAzure AI Foundry.
Azure AI Chat Completions Model
Access models like Azure OpenAI, DeepSeek R1, Cohere, Phi and Mistral using theAzureAIChatCompletionsModel
class.
pip install -U langchain-azure-ai
Configure your API key and Endpoint.
export AZURE_INFERENCE_CREDENTIAL=your-api-key
export AZURE_INFERENCE_ENDPOINT=your-endpoint
from langchain_azure_ai.chat_modelsimport AzureAIChatCompletionsModel
llm= AzureAIChatCompletionsModel(
model_name="gpt-4o",
api_version="2024-05-01-preview",
)
llm.invoke('Tell me a joke and include some emojis')
API Reference:AzureAIChatCompletionsModel
Embedding models
Azure AI model inference for embeddings
pip install -U langchain-azure-ai
Configure your API key and Endpoint.
export AZURE_INFERENCE_CREDENTIAL=your-api-key
export AZURE_INFERENCE_ENDPOINT=your-endpoint
from langchain_azure_ai.embeddingsimport AzureAIEmbeddingsModel
embed_model= AzureAIEmbeddingsModel(
model_name="text-embedding-ada-002"
)
API Reference:AzureAIEmbeddingsModel