langchain Root module no longer supported?
Asked Answered
S

1

11

How could I fix this: UserWarning: Importing OpenAI from langchain root module is no longer supported. UserWarning: Importing LLMChain from langchain root module is no longer supported. UserWarning: Importing PromptTemplate from langchain root module is no longer supported.

from langchain import OpenAI, LLMChain, PromptTemplate
from langchain.memory import ConversationBufferWindowMemory

tried to directly install OpenAI but didn't recognize it as a package

Saker answered 28/9, 2023 at 0:17 Comment(0)
D
20

you can try as below

from langchain.llms import OpenAI
from langchain.chains import LLMChain
from langchain.prompts import PromptTemplate 
from langchain.memory import ConversationBufferWindowMemory
Delanty answered 28/9, 2023 at 6:27 Comment(5)
that worked however I'm now getting an error when I import telebot. I've tried uninstalling and reinstalling but it doesn't work.: import telebot ModuleNotFoundError: No module named 'telebot'Saker
this is the code: import telebotSaker
make sure you are properly installing telebot and adding required API keys pypi.org/project/pyTelegramBotAPIDelanty
With langchain 0.1.0 I get the warning that "from langchain.llms import OpenAI" is deprecated with 0.2.0 and the solution is to import it via "from langchain_community.llms import OpenAI"Muckraker
this not working any moreCabob

© 2022 - 2024 — McMap. All rights reserved.