Thuthi Dilni
Thuthi Dilni

Reputation: 15

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

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.

Upvotes: 0

Views: 7101

Answers (6)

Sangeetha G
Sangeetha G

Reputation: 1

I also got the same error and also the pydantic lib error. I followed the below steps by referring to StackOverflow and other sites.

%pip uninstall langchain -y
pip show langchain
!pip install langchain==0.0.339
pip install google-generativeai

then the GooglePalm worked for me without error.

Upvotes: 0

Divy Solanki
Divy Solanki

Reputation: 36

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.

Upvotes: 2

Kesavan Ramalingam
Kesavan Ramalingam

Reputation: 65

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)

Upvotes: 0

Triloki Gupta
Triloki Gupta

Reputation: 11

I faced the same issue please check with the lower version

langchain==0.0.284
langchain==0.0.339

Upvotes: 0

Eyad Aiman
Eyad Aiman

Reputation: 1

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.

Upvotes: 0

razimbres
razimbres

Reputation: 5015

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

Upvotes: 0

Related Questions