-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5138f82
commit d6b31c3
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## Chapter 7: Using agents | ||
Agents are one of the most powerful features of LangChain, allowing them to combine multiple tools to autonomously perform more complex tasks. | ||
|
||
``` | ||
from langchain.agents import load_tools | ||
from langchain.agents import initialize_agent | ||
from langchain.agents import AgentType | ||
from langchain.llms import OpenAI | ||
llm = OpenAI(temperature=0) | ||
tools = load_tools(["serpapi", "llm-math"], llm=llm) | ||
agent = initialize_agent(tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True) | ||
agent.run("What was the high temperature in SF yesterday in Fahrenheit? What is that number raised to the .023 power?") | ||
``` |