AzureChatOpenAI
shares the same underlying base implementation as ChatOpenAI
,
which interfaces with OpenAI services directly.This page serves as a quickstart for authenticating and connecting your Azure OpenAI service to a LangChain chat model.Visit the ChatOpenAI docs for details on available
features, or head to the API reference.Class | Package | Local | Serializable | JS support | Package downloads | Package latest |
---|---|---|---|---|---|---|
AzureChatOpenAI | langchain-openai | ❌ | beta | ✅ |
Tool calling | Structured output | JSON mode | Image input | Audio input | Video input | Token-level streaming | Native async | Token usage | Logprobs |
---|---|---|---|---|---|---|---|---|---|
✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ |
langchain-openai
integration package.
langchain-openai
package:
azure_deployment
with the name of your deployment,api_version
here: https://learn.microsoft.com/en-us/azure/ai-services/openai/reference.model_name
response metadata property, which is name of the model used to generate the response. However unlike native OpenAI responses, it does not contain the specific version of the model, which is set on the deployment in Azure. E.g. it does not distinguish between gpt-35-turbo-0125
and gpt-35-turbo-0301
. This makes it tricky to know which version of the model was used to generate the response, which as result can lead to e.g. wrong total cost calculation with OpenAICallbackHandler
.
To solve this problem, you can pass model_version
parameter to AzureChatOpenAI
class, which will be added to the model name in the llm output. This way you can easily distinguish between different versions of the model.