langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
89.46k stars 14.12k forks source link

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

Open yashsri0786 opened 6 months ago

yashsri0786 commented 6 months ago

Checked other resources

Example Code

from langchain.llms import OpenAI from langchain.agents import initialize_agent from langchain.agents.agent_toolkits import ZapierToolkit from langchain.utilities.zapier import ZapierNLAWrapper import os from dotenv import load_dotenv

load_dotenv() os.getenv('ZAPIER_NLA_API_KEY') os.getenv('OPENAI_API_KEY') llm = OpenAI(temperature=.3)

zapier = ZapierNLAWrapper() toolkit = ZapierToolkit.from_zapier_nla_wrapper(zapier)

agent = initialize_agent(toolkit.tools, llm, agent="zero-shot-react-description", verbose=True) for tool in toolkit.tools: print(tool.name) print(tool.description) print("\n\n")

agent.run('Send an email to xxx@gmail.com saying hello from Dr. sss')

Description

Gmail: Send Email A wrapper around Zapier NLA actions. The input to this tool is a natural language instruction, for example "get the latest email from my bank" or "send a slack message to the #general channel". Each tool will have params associated with it that are specified as a list. You MUST take into account the params when creating the instruction. For example, if the params are ['Message_Text', 'Channel'], your instruction should be something like 'send a slack message to the #general channel with the text hello world'. Another example: if the params are ['Calendar', 'Search_Term'], your instruction should be something like 'find the meeting in my personal calendar at 3pm'. Do not make up params, they will be explicitly specified in the tool description. If you do not have enough information to fill in the params, just say 'not enough information provided in the instruction, missing '. If you get a none or null response, STOP EXECUTION, do not try to another tool!This tool specifically used for: Gmail: Send Email, and has params: ['Body', 'To', 'Subject', 'Cc']

LinkedIn: Create Share Update A wrapper around Zapier NLA actions. The input to this tool is a natural language instruction, for example "get the latest email from my bank" or "send a slack message to the #general channel". Each tool will have params associated with it that are specified as a list. You MUST take into account the params when creating the instruction. For example, if the params are ['Message_Text', 'Channel'], your instruction should be something like 'send a slack message to the #general channel with the text hello world'. Another example: if the params are ['Calendar', 'Search_Term'], your instruction should be something like 'find the meeting in my personal calendar at 3pm'. Do not make up params, they will be explicitly specified in the tool description. If you do not have enough information to fill in the params, just say 'not enough information provided in the instruction, missing '. If you get a none or null response, STOP EXECUTION, do not try to another tool!This tool specifically used for: LinkedIn: Create Share Update, and has params: ['Comment', 'Visible_To']

Entering new AgentExecutor chain... I need to use the Gmail: Send Email tool to complete this task. Action: Gmail: Send Email Action Input: {'Body': 'Hello from Dr. Khala', 'To': 'birbal.srivastava@gmail.com', 'Subject': 'Hello', 'Cc': ''}Traceback (most recent call last): File "/Users/ss/.pyenv/versions/demo311/lib/python3.11/site-packages/langchain/chains/base.py", line 310, in call raise e File "/Users/ss/.pyenv/versions/demo311/lib/python3.11/site-packages/langchain/chains/base.py", line 304, in call self._call(inputs, run_manager=run_manager) File "/Users/ss/.pyenv/versions/demo311/lib/python3.11/site-packages/langchain/agents/agent.py", line 1245, in _call next_step_output = self._take_next_step( ^^^^^^^^^^^^^^^^^^^^^ File "/Users/ss/.pyenv/versions/demo311/lib/python3.11/site-packages/langchain/agents/agent.py", line 1095, in _take_next_step observation = tool.run( ^^^^^^^^^ File "/Users/ss/.pyenv/versions/demo311/lib/python3.11/site-packages/langchain/tools/base.py", line 365, in run raise e File "/Users/ss/.pyenv/versions/demo311/lib/python3.11/site-packages/langchain/tools/base.py", line 337, in run self._run(*tool_args, run_manager=run_manager, **tool_kwargs) File "/Users/ss/.pyenv/versions/demo311/lib/python3.11/site-packages/langchain/tools/zapier/tool.py", line 143, in _run warn_deprecated( File "/Users/ss/.pyenv/versions/demo311/lib/python3.11/site-packages/langchain/_api/deprecation.py", line 295, in warn_deprecated raise NotImplementedError( NotImplementedError: Need to determine which default deprecation schedule to use. within ?? minor releases

System Info

Macbook pro

File "/Users/ss/.pyenv/versions/demo311/lib/python3.11/site-packages/langchain/tools/base.py", line 365, in run raise e File "/Users/ss/.pyenv/versions/demo311/lib/python3.11/site-packages/langchain/tools/base.py", line 337, in run self._run(*tool_args, run_manager=run_manager, **tool_kwargs) File "/Users/ss/.pyenv/versions/demo311/lib/python3.11/site-packages/langchain/tools/zapier/tool.py", line 143, in _run warn_deprecated( File "/Users/ss/.pyenv/versions/demo311/lib/python3.11/site-packages/langchain/_api/deprecation.py", line 295, in warn_deprecated raise NotImplementedError( NotImplementedError: Need to determine which default deprecation schedule to use. within ?? minor releases

Related Components

dosubot[bot] commented 6 months ago

🤖

The error message you're encountering, "NotImplementedError: Need to determine which default deprecation schedule to use. within ?? minor releases", is likely due to a function or method in the LangChain codebase that has been marked as deprecated but does not have a defined deprecation schedule.

In LangChain, the warn_deprecated() function is used to issue a standardized deprecation warning when a deprecated part of the API is used. This function raises a NotImplementedError when it's called with pending=False and without a defined deprecation schedule. This is likely what's happening in your case.

To resolve this issue, a deprecation schedule needs to be defined for the function or method you're trying to use. This can be done using the @deprecated decorator and providing the since and removal arguments, which specify when the function was deprecated and when it will be removed, respectively. Here's an example:

@deprecated(since="2.0.0", removal="3.0.0", pending=False)
def deprecated_function() -> str:
    """original doc"""
    return "This is a deprecated function."

In your case, the error is being raised in the _run method of the ZapierTool class. You might want to check if this method or any method it calls has been marked as deprecated without a defined deprecation schedule.

You can find more information about the warn_deprecated() function and how LangChain handles deprecation in the deprecation.py file and the test_deprecation.py file in the LangChain repository.

Please let me know if you need further assistance.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

DarshanJoshi981 commented 5 months ago

@yashsri0786 did you found any solution to this? Downgrading langchain versions doesn't seems to work for me.

giuliotosato commented 4 months ago

any news about this?

i-am-jar commented 3 months ago

@yashsri0786 did you find a solution?

ammarmunir4567 commented 2 months ago

Any solutions?

csd12380 commented 2 weeks ago

9f6de3a9b7702c45fc7d1513db46de7 将deprecation.py中的代码注释掉即可,