pythonlangchainpalm

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.


Solution

  • 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.