-
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
d6b31c3
commit 45679e4
Showing
1 changed file
with
27 additions
and
1 deletion.
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 |
---|---|---|
@@ -1 +1,27 @@ | ||
chapter4.md | ||
## Chapter 8: Integration with external APIs | ||
By using LangChain to integrate with external APIs, you can build AI applications that leverage richer sources of information. | ||
|
||
``` | ||
from langchain.utilities import OpenWeatherMapAPIWrapper | ||
from langchain.agents import initialize_agent, Tool | ||
from langchain.llms import OpenAI | ||
# OpenWeatherMap API | ||
weather = OpenWeatherMapAPIWrapper() | ||
tools = [ | ||
Tool( | ||
name="Weather", | ||
func=weather.run, | ||
description="useful for when you need to answer questions about the weather" | ||
) | ||
] | ||
agent = initialize_agent(tools, OpenAI(temperature=0), agent="zero-shot-react-description", verbose=True) | ||
agent.run("What's the weather like in Munich right now?") | ||
``` |