Langchain_openai import OpenAI vs openai import OpenAI

Is there any difference between importing OpenAI from “langchain_openai” or from “openai”. I wasnt able to use chat.Completetion when my code had both imports. it was giving me error that OpenAI has no “chat” module.

but when i remove the “langchain_openai” import. my code worked fine.

Hey there and welcome!

yeah, I think you should stick to one or the other, but not both. Sounds like conflicting dependencies. The regular openai import is when you’re building the client request yourself; the langchain version is catered to the langchain ecosystem.