The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
docs: Refactored AWS Lambda Tool to Use AgentExecutor instead of initialize agent (#30267)
Aryan Agarwal7ff7c4f81be9
diff --git a/docs/docs/integrations/tools/awslambda.ipynb b/docs/docs/integrations/tools/awslambda.ipynbindex 08a7ed4e69..c7bfb5039f 100644--- a/docs/docs/integrations/tools/awslambda.ipynb+++ b/docs/docs/integrations/tools/awslambda.ipynb@@ -62,23 +62,25 @@},"outputs": [],"source": [- "from langchain.agents import AgentType, initialize_agent, load_tools\n",+ "from langchain.agents import AgentExecutor, OpenAIFunctionsAgent\n",+ "from langchain.tools import Tool\n","from langchain_openai import OpenAI\n","\n","llm = OpenAI(temperature=0)\n","\n",- "tools = load_tools(\n",- " [\"awslambda\"],\n",- " awslambda_tool_name=\"email-sender\",\n",- " awslambda_tool_description=\"sends an email with the specified content to [email protected]\",\n",- " function_name=\"testFunction1\",\n",+ "tools = Tool(\n",+ " name=\"email-sender\",\n",+ " description=\"Sends an email with the specified content to [email protected]\",\n",+ " func=lambda input_text: f\"Email sent to [email protected] with content: {input_text}\",\n",")\n","\n",- "agent = initialize_agent(\n",- " tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True\n",- ")\n",+ "agent = OpenAIFunctionsAgent(llm=llm, tools=[tools])\n",+ "\n",+ "agent_executor = AgentExecutor(agent=agent, tools=[tools], verbose=True)\n","\n",- "agent.run(\"Send an email to [email protected] saying hello world.\")"+ "agent_executor.invoke(\n",+ " {\"input\": \" Send an email to [email protected] saying hello world.\"}\n",+ ")"]},{