mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-04 06:37:58 +00:00
Revert "docs: Refactored AWS Lambda Tool to Use AgentExecutor instead of initialize agent " (#30357)
Reverts langchain-ai/langchain#30267 Code is broken.
This commit is contained in:
parent
f5a0092551
commit
0ba03d8f3a
@ -62,25 +62,23 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from langchain.agents import AgentExecutor, OpenAIFunctionsAgent\n",
|
||||
"from langchain.tools import Tool\n",
|
||||
"from langchain.agents import AgentType, initialize_agent, load_tools\n",
|
||||
"from langchain_openai import OpenAI\n",
|
||||
"\n",
|
||||
"llm = OpenAI(temperature=0)\n",
|
||||
"\n",
|
||||
"tools = Tool(\n",
|
||||
" name=\"email-sender\",\n",
|
||||
" description=\"Sends an email with the specified content to test@testing123.com\",\n",
|
||||
" func=lambda input_text: f\"Email sent to test@testing123.com with content: {input_text}\",\n",
|
||||
"tools = load_tools(\n",
|
||||
" [\"awslambda\"],\n",
|
||||
" awslambda_tool_name=\"email-sender\",\n",
|
||||
" awslambda_tool_description=\"sends an email with the specified content to test@testing123.com\",\n",
|
||||
" function_name=\"testFunction1\",\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"agent = OpenAIFunctionsAgent(llm=llm, tools=[tools])\n",
|
||||
"agent = initialize_agent(\n",
|
||||
" tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"agent_executor = AgentExecutor(agent=agent, tools=[tools], verbose=True)\n",
|
||||
"\n",
|
||||
"agent_executor.invoke(\n",
|
||||
" {\"input\": \" Send an email to test@testing123.com saying hello world.\"}\n",
|
||||
")"
|
||||
"agent.run(\"Send an email to test@testing123.com saying hello world.\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user