import langchain
llm = langchain.chat_models.ChatOpenAI() # Deprecated path
Error:
AttributeError: module 'langchain' has no attribute 'chat_models'

import langchain
llm = langchain.chat_models.ChatOpenAI() # Deprecated path
Error:
AttributeError: module 'langchain' has no attribute 'chat_models'
Fix:
from langchain_openai import ChatOpenAI
llm = ChatOpenAI()
Tell us about your project and get help tailored to your problem.
Contact usEveryone can read. Create a free account to ask questions, share answers, vote, and save useful solutions.