.ipynb
.pdf
Google Search
 Contents 
Number of Results
Metadata Results
Google Search#
This notebook goes over how to use the google search component.
First, you need to set up the proper API keys and environment variables. To set it up, create the GOOGLE_API_KEY in the Google Cloud credential console (https://console.cloud.google.com/apis/credentials) and a GOOGLE_CSE_ID using the Programmable Search Enginge (https://programmablesearchengine.google.com/controlpanel/create). Next, it is good to follow the instructions found here.
Then we will need to set some environment variables.
import os
os.environ["GOOGLE_CSE_ID"] = ""
os.environ["GOOGLE_API_KEY"] = ""
from langchain.tools import Tool
from langchain.utilities import GoogleSearchAPIWrapper
search = GoogleSearchAPIWrapper()
tool = Tool(
    name = "Google Search",
    description="Search Google for recent results.",
    func=search.run
)
tool.run("Obama's first name?")
rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_search.html