From 44d7763580e720700d0fc7ab2451c45172097631 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Thu, 19 Oct 2023 15:27:56 -0400 Subject: [PATCH] Add zapier deprecation warning (#12045) Add zapier deprecation --- docs/docs/integrations/tools/zapier.ipynb | 2 ++ .../agents/agent_toolkits/zapier/toolkit.py | 10 +++++- libs/langchain/langchain/tools/zapier/tool.py | 33 ++++++++++++++++++- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/docs/docs/integrations/tools/zapier.ipynb b/docs/docs/integrations/tools/zapier.ipynb index e11d9e91385..9327df83bbc 100644 --- a/docs/docs/integrations/tools/zapier.ipynb +++ b/docs/docs/integrations/tools/zapier.ipynb @@ -7,6 +7,8 @@ "source": [ "# Zapier Natural Language Actions\n", "\n", + "**Deprecated** This API will be sunset on 2023-11-17: https://nla.zapier.com/start/\n", + " \n", ">[Zapier Natural Language Actions](https://nla.zapier.com/start/) gives you access to the 5k+ apps, 20k+ actions on Zapier's platform through a natural language API interface.\n", ">\n", ">NLA supports apps like `Gmail`, `Salesforce`, `Trello`, `Slack`, `Asana`, `HubSpot`, `Google Sheets`, `Microsoft Teams`, and thousands more apps: https://zapier.com/apps\n", diff --git a/libs/langchain/langchain/agents/agent_toolkits/zapier/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/zapier/toolkit.py index fa0a2272226..5c5ae5ad5f5 100644 --- a/libs/langchain/langchain/agents/agent_toolkits/zapier/toolkit.py +++ b/libs/langchain/langchain/agents/agent_toolkits/zapier/toolkit.py @@ -1,6 +1,7 @@ -"""Zapier Toolkit.""" +"""[DEPRECATED] Zapier Toolkit.""" from typing import List +from langchain._api import warn_deprecated from langchain.agents.agent_toolkits.base import BaseToolkit from langchain.tools import BaseTool from langchain.tools.zapier.tool import ZapierNLARunAction @@ -48,4 +49,11 @@ class ZapierToolkit(BaseToolkit): def get_tools(self) -> List[BaseTool]: """Get the tools in the toolkit.""" + warn_deprecated( + since="0.0.319", + message=( + "This tool will be deprecated on 2023-11-17. See " + "https://nla.zapier.com/sunset/ for details" + ), + ) return self.tools diff --git a/libs/langchain/langchain/tools/zapier/tool.py b/libs/langchain/langchain/tools/zapier/tool.py index 636ea3c6366..9f9011756d0 100644 --- a/libs/langchain/langchain/tools/zapier/tool.py +++ b/libs/langchain/langchain/tools/zapier/tool.py @@ -1,4 +1,6 @@ -"""## Zapier Natural Language Actions API +"""[DEPRECATED] + +## Zapier Natural Language Actions API \ Full docs here: https://nla.zapier.com/start/ @@ -79,6 +81,7 @@ agent.run(("Summarize the last email I received regarding Silicon Valley Bank. " """ from typing import Any, Dict, Optional +from langchain._api import warn_deprecated from langchain.callbacks.manager import ( AsyncCallbackManagerForToolRun, CallbackManagerForToolRun, @@ -137,6 +140,13 @@ class ZapierNLARunAction(BaseTool): self, instructions: str, run_manager: Optional[CallbackManagerForToolRun] = None ) -> str: """Use the Zapier NLA tool to return a list of all exposed user actions.""" + warn_deprecated( + since="0.0.319", + message=( + "This tool will be deprecated on 2023-11-17. See " + "https://nla.zapier.com/sunset/ for details" + ), + ) return self.api_wrapper.run_as_str(self.action_id, instructions, self.params) async def _arun( @@ -145,6 +155,13 @@ class ZapierNLARunAction(BaseTool): run_manager: Optional[AsyncCallbackManagerForToolRun] = None, ) -> str: """Use the Zapier NLA tool to return a list of all exposed user actions.""" + warn_deprecated( + since="0.0.319", + message=( + "This tool will be deprecated on 2023-11-17. See " + "https://nla.zapier.com/sunset/ for details" + ), + ) return await self.api_wrapper.arun_as_str( self.action_id, instructions, @@ -179,6 +196,13 @@ class ZapierNLAListActions(BaseTool): run_manager: Optional[CallbackManagerForToolRun] = None, ) -> str: """Use the Zapier NLA tool to return a list of all exposed user actions.""" + warn_deprecated( + since="0.0.319", + message=( + "This tool will be deprecated on 2023-11-17. See " + "https://nla.zapier.com/sunset/ for details" + ), + ) return self.api_wrapper.list_as_str() async def _arun( @@ -187,6 +211,13 @@ class ZapierNLAListActions(BaseTool): run_manager: Optional[AsyncCallbackManagerForToolRun] = None, ) -> str: """Use the Zapier NLA tool to return a list of all exposed user actions.""" + warn_deprecated( + since="0.0.319", + message=( + "This tool will be deprecated on 2023-11-17. See " + "https://nla.zapier.com/sunset/ for details" + ), + ) return await self.api_wrapper.alist_as_str()