-
Notifications
You must be signed in to change notification settings - Fork 15.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot import name 'AzureOpenAI' from 'langchain.llms' #9453
Comments
🤖 Hello, Based on the context provided, it seems like there might be a misunderstanding about the location of the 'AzureOpenAI' class. In the current version of LangChain, 'AzureOpenAI' is not a part of the 'langchain.llms' module. Instead, there is a class named 'AzureChatOpenAI' which is located in 'langchain.chat_models.azure_openai'. So, the correct import statement should be: from langchain.chat_models.azure_openai import AzureChatOpenAI Please replace 'AzureOpenAI' with 'AzureChatOpenAI' in your code and try again. If you're still facing issues, it might be due to a problem with your Python environment or a bug in the LangChain framework. Also, ensure that the 'openai' Python package is installed and the environment variables 'OPENAI_API_TYPE', 'OPENAI_API_KEY', 'OPENAI_API_BASE', 'OPENAI_API_VERSION', and 'OPENAI_PROXY' are set with your API key. I hope this helps! If you have any other questions or need further clarification, feel free to ask. Best, Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
from langchain.chat_models.azure_openai import AzureChatOpenAI ModuleNotFoundError: No module named 'langchain.chat_models' It is same. |
do you selvo this prpblem? |
Try this, it should work: |
Hi, @ozkank! I'm Dosu and I'm helping the LangChain team manage their backlog. I'm marking this issue as stale. It seems like you're encountering an error when trying to import 'AzureOpenAI' from 'langchain.llms'. There have been suggestions from "dosubot" and "nikhil7601" regarding the correct import statement, but it appears that the issue remains unresolved. Could you please confirm if this issue is still relevant to the latest version of the LangChain repository? If it is, please let the LangChain team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you! |
System Info
I got this error from on my office laptop
OS: Win 10
I checked AzureAI key, url, deployment and model names. No problem about that.
This guy having same issue with me : https://stackoverflow.com/questions/76750207/azureopenai-not-available-in-langchain
I deleted "import openai" part but no change.
Could somebody pls help me?
Who can help?
No response
Information
Related Components
Reproduction
from dotenv import load_dotenv
from langchain.llms import AzureOpenAI
from langchain.embeddings import OpenAIEmbeddings
import openai
import os
Load environment variables
load_dotenv()
Configure Azure OpenAI Service API
openai.api_type = "azure"
openai.api_version = "2022-12-01"
openai.api_base = os.getenv('OPENAI_API_BASE')
openai.api_key = os.getenv("OPENAI_API_KEY")
Expected behavior
from dotenv import load_dotenv
from langchain.llms import AzureOpenAI
from langchain.embeddings import OpenAIEmbeddings
import openai
import os
The text was updated successfully, but these errors were encountered: