from langchain_openai import ChatOpenAI
llm = ChatOpenAI("gpt-4o") # Passing model as positional arg
Error:
TypeError: ChatOpenAI.__init__() takes 1 positional argument but
2 were given

from langchain_openai import ChatOpenAI
llm = ChatOpenAI("gpt-4o") # Passing model as positional arg
Error:
TypeError: ChatOpenAI.__init__() takes 1 positional argument but
2 were given
Fix:
llm = ChatOpenAI(model="gpt-4o") # ✅ Pass model as keyword argument
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.