AzureChatOpenAI not working with cognitive regional endpoints? #27010
Replies: 2 comments 6 replies
-
Hey @sorin-costea, 👋 I'm here to help you with your technical issues and questions! I'm a bot and I can assist with bug fixes, answering questions, and getting you set up as a contributor. I found some similar discussions and issues that might help you resolve the problem with
Here's a corrected example based on the information from these discussions: from langchain_openai import AzureChatOpenAI
azure_llm = AzureChatOpenAI(
azure_deployment='my_deployment',
azure_endpoint='https://my_region.api.cognitive.microsoft.com/',
api_version='some_version',
api_key='my_key'
) Ensure that:
If the issue persists, consider checking if the endpoint style is supported by the current version of LangChain you are using. Upgrading to the latest version might also help. |
Beta Was this translation helpful? Give feedback.
-
@dosu If I initialize the LLM like this, everything works fine. So LiteLLM is definitely fine, my endpoint also fine, the only issue is I cannot use AzureChatOpenAI for it.
For reference, the problem code is:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
I tried also with the whole endpoint as Azure shows it: https://my_region.api.cognitive.microsoft.com/openai/deployments/my_deployment/chat/completions?api-version=some_version also with the shortened https://my_region.api.cognitive.microsoft.com/openai/ or even https://my_region.api.cognitive.microsoft.com/ yet the error is always the same:
As there's no mention of the new endpoint style in the documentation or in the chatbot, could it be it's not supported yet by some component in the stack? Or I just don't get it...
System Info
langchain==0.2.16
langchain-cohere==0.1.9
langchain-community==0.2.17
langchain-core==0.3.7
langchain-experimental==0.0.65
langchain-openai==0.2.1
langchain-text-splitters==0.2.4
python 3.12.5
windows 11
Beta Was this translation helpful? Give feedback.
All reactions