yogeshhk / Sarvadnya

This repo is a collection of various PoCs (Proof-of-Concepts) to interface custom data using LLMs.
MIT License
51 stars 22 forks source link

Warnings in ask_wikipedia #59

Open mrajsingh opened 9 months ago

mrajsingh commented 9 months ago

Hi,

I got warnings for importing few classes from langchain. Seems that some classes were deprecated from langchain and moved to langchain_community. (Reference)

Example Warning:

LangChainDeprecationWarning: Importing document loaders from langchain is deprecated. Importing from langchain will no longer be supported as of langchain==0.2.0. Please import from langchain-community instead:

from langchain_community.document_loaders import WikipediaLoader.

To install langchain-community run pip install -U langchain-community.

I got rid of such warnings by importing few clasess from langchain_community instead of langchain in main_driver.py. from langchain_community.document_loaders import WikipediaLoader from langchain_community.vectorstores import Chroma

And for importing VertexAIEmbeedings, the warning was:

LangChainDeprecationWarning: The class langchain_community.embeddings.vertexai.VertexAIEmbeddings was deprecated in langchain-community 0.0.12 and will be removed in 0.2.0. An updated version of the class exists in the langchain-google-vertexai package and should be used instead. To use it run pip install -U langchain-google-vertexai and import as from langchain_google_vertexai import VertexAIEmbeddings. warn_deprecated(

So, installing langchain-google-vertexai and using below import resolved the above warning. from langchain_google_vertexai import VertexAIEmbeddings

Perhaps needs an update in the master branch code of ask_wikipedia to use the langchain_community for imports of relevant classes?

yogeshhk commented 9 months ago

Sure @mrajsingh, many of these folders are based on a bit older Langchain version. They definitely need upgrade. Is it possible for you to submit these changes and corresponding requirements.txt once this bot starts working locally?

mrajsingh commented 9 months ago

@yogeshhk Sure. I can do that.