Class | Package | Local | Serializable | PY support | Package downloads | Package latest |
---|---|---|---|---|---|---|
AzureChatOpenAI | @langchain/openai | ❌ | ✅ | ✅ |
Tool calling | Structured output | JSON mode | Image input | Audio input | Video input | Token-level streaming | Token usage | Logprobs |
---|---|---|---|---|---|---|---|---|
✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ | ✅ |
@langchain/openai
package:
openai.azure.com
, you’ll need to use the alternate AZURE_OPENAI_BASE_PATH
environment variable.
For example, here’s how you would connect to the domain https://westeurope.api.microsoft.com/openai/deployments/{DEPLOYMENT_NAME}
:
configuration
field:
configuration
field also accepts other ClientOptions
parameters accepted by the official SDK.
Note: The specific header api-key
currently cannot be overridden in this manner and will pass through the value from azureOpenAIApiKey
.
@langchain/azure-openai
package, you can update your code to use the new Azure integration following these steps:
@langchain/openai
package and remove the previous @langchain/azure-openai
package:AzureChatOpenAI
class from the @langchain/openai
package:
AzureChatOpenAI
class and pass the required parameters:
azureOpenAIApiInstanceName
parameter instead of the azureOpenAIEndpoint
parameter, and adds the azureOpenAIApiVersion
parameter to specify the API version.
azureADTokenProvider
parameter to the constructor instead of credentials
, see the Azure Managed Identity section for more details.
AZURE_OPENAI_API_INSTANCE_NAME
environment variable instead of AZURE_OPENAI_API_ENDPOINT
, and add the AZURE_OPENAI_API_VERSION
environment variable to specify the API version.