Langchain error - NotImplementedError: Need to determine which default deprecation schedule to use. within ?? minor releases

2.2k Views Asked by At

I ran the bellow code. However, currently, it shows an error massage.

from langchain.llms import GooglePalm

api_key = 'my_API'


llm = GooglePalm(google_api_key=api_key,
                 temperature=0.1)

This is the error I got.

NotImplementedError                       Traceback (most recent call last)
<ipython-input-2-a3e32679669c> in <cell line: 7>()
      5 
      6 # Create llm variable here
----> 7 llm = GooglePalm(google_api_key=api_key,
      8                  temperature=0.1)

2 frames
/usr/local/lib/python3.10/dist-packages/langchain_core/_api/deprecation.py in warn_deprecated(since, message, name, alternative, pending, obj_type, addendum, removal)
    293         if not removal:
    294             removal = f"in {removal}" if removal else "within ?? minor releases"
--> 295             raise NotImplementedError(
    296                 f"Need to determine which default deprecation schedule to use. "
    297                 f"{removal}"

NotImplementedError: Need to determine which default deprecation schedule to use. within ?? minor releases

Can someone please help me to solve this?

I need to create the large language model variable.

5

There are 5 best solutions below

0
Divy Solanki On BEST ANSWER

I also had a similar error, I'm using langchain==0.1.4 in which its google_palm file suggests deprecation of GooglePalm and it is replaced with langchain_google_genai.GoogleGenerativeAI

Make use of GoogleGenerativeAI instead; for its installation follow these steps:

  1. pip install --upgrade --quiet langchain-google-genai
  2. pip install -q -U google-generativeai

Then use this code:

from langchain_google_genai import GoogleGenerativeAI

llm = GoogleGenerativeAI(model="models/text-bison-001", google_api_key=SECRET_KEY, temperature=0.1)

Use Google Palm API key.

Article Links:

  1. Langchain GoogleGenerativeAI
  2. GoogleGenerativeAI Quick Start guide

I hope you find this useful.

2
razimbres On

Please install Langchain version 0.0.350 and it will work.

If not, run also:

pip install --upgrade vertexai google-cloud-aiplatform

As in the comment, Vertex is a paid version, you must have a Google Cloud project. However, you can use text generation for free in AI Studio: you only have to get the API key:

https://ai.google.dev/?utm_source=google&utm_medium=cpc&utm_campaign=BRAND_Core_Brand&gad_source=1

In this case:

pip install google-generativeai
0
Eyad Aiman On

I encountered a similar issue after updating langchain from version 0.0.339 to 0.0.351. Before Updating langchain, my package version was 0.0.339 and it was working perfectly fine while using GooglePalm, but after updating it to 0.0.351 I faced the exact same error as yours The Implementation Error. However, I managed to resolve the problem by reverting to langchain version 0.0.339.

pip uninstall langchain
pip install langchain==0.0.339

I don't know why it is not working in langchain 0.0.351 but you can downgrade langchain untill we figure out.

0
Triloki Gupta On

I faced the same issue please check with the lower version

langchain==0.0.284
langchain==0.0.339
0
Kesavan Ramalingam On

latest langchain 0.1.1 also has this issue, as work around I have switched to text-bison model

llm = GoogleGenerativeAI(model="models/text-bison-001", google_api_key=api_key)