langchain.prompts import PromptTemplatefrom langchain.tools.zapier.tool import ZapierNLARunActionfrom langchain.utilities.zapier import ZapierNLAWrapper## step 0. expose gmail 'find email' and slack 'send direct message' actions# first go here, log in, expose (enable) the two actions: https://nla.zapier.com/demo/start -- for this example, can leave all fields "Have AI guess"# in an oauth scenario, you'd get your own <provider> id (instead of 'demo') which you route your users through firstactions = ZapierNLAWrapper().list()## step 1. gmail find emailGMAIL_SEARCH_INSTRUCTIONS = "Grab the latest email from Silicon Valley Bank"def nla_gmail(inputs):    action = next(        (a for a in actions if a["description"].startswith("Gmail: Find Email")), None    )    return {        "email_data": ZapierNLARunAction(            action_id=action["id"],            zapier_description=action["description"],            params_schema=action["params"],        ).run(inputs["instructions"])    }gmail_chain = TransformChain(    input_variables=["instructions"],    output_variables=["email_data"],    transform=nla_gmail,)## step 2. generate draft replytemplate = """You are an assisstant who drafts replies to an incoming email. Output draft reply in plain text (not JSON).Incoming email:{email_data}Draft email reply:"""prompt_template = PromptTemplate(input_variables=["email_data"], template=template)reply_chain = LLMChain(llm=OpenAI(temperature=0.7), prompt=prompt_template)## step 3. send draft reply via a slack direct messageSLACK_HANDLE = "@Ankush Gola"def nla_slack(inputs):    action = next(        (            a            for a in actions            if a["description"].startswith("Slack: Send Direct Message")        ),        None,    )    instructions = f'Send this to {SLACK_HANDLE} in Slack: {inputs["draft_reply"]}'    return {        "slack_data": ZapierNLARunAction(            action_id=action["id"],            zapier_description=action["description"],
Zapier Natural Language Actions gives you access to the 5k+ apps, 20k+ actions on Zapier's platform through a natural language API interface.
Zapier Natural Language Actions gives you access to the 5k+ apps, 20k+ actions on Zapier's platform through a natural language API interface. ->: langchain.prompts import PromptTemplatefrom langchain.tools.zapier.tool import ZapierNLARunActionfrom langchain.utilities.zapier import ZapierNLAWrapper## step 0. expose gmail 'find email' and slack 'send direct message' actions# first go here, log in, expose (enable) the two actions: https://nla.zapier.com/demo/start -- for this example, can leave all fields "Have AI guess"# in an oauth scenario, you'd get your own <provider> id (instead of 'demo') which you route your users through firstactions = ZapierNLAWrapper().list()## step 1. gmail find emailGMAIL_SEARCH_INSTRUCTIONS = "Grab the latest email from Silicon Valley Bank"def nla_gmail(inputs):    action = next(        (a for a in actions if a["description"].startswith("Gmail: Find Email")), None    )    return {        "email_data": ZapierNLARunAction(            action_id=action["id"],            zapier_description=action["description"],            params_schema=action["params"],        ).run(inputs["instructions"])    }gmail_chain = TransformChain(    input_variables=["instructions"],    output_variables=["email_data"],    transform=nla_gmail,)## step 2. generate draft replytemplate = """You are an assisstant who drafts replies to an incoming email. Output draft reply in plain text (not JSON).Incoming email:{email_data}Draft email reply:"""prompt_template = PromptTemplate(input_variables=["email_data"], template=template)reply_chain = LLMChain(llm=OpenAI(temperature=0.7), prompt=prompt_template)## step 3. send draft reply via a slack direct messageSLACK_HANDLE = "@Ankush Gola"def nla_slack(inputs):    action = next(        (            a            for a in actions            if a["description"].startswith("Slack: Send Direct Message")        ),        None,    )    instructions = f'Send this to {SLACK_HANDLE} in Slack: {inputs["draft_reply"]}'    return {        "slack_data": ZapierNLARunAction(            action_id=action["id"],            zapier_description=action["description"],