Skip to main content
本 notebook 介绍如何使用 Google Serper component to search the web. First you need 注册免费账户 at serper.dev and get your api key.

As part of a self ask with search Agent

In order to create an agent that uses the Google Serper tool install LangGraph
and use the create_agent functionality to initialize a ReAct agent. You will also need to set up your OPENAI_API_KEY (visit platform.openai.com) in order to access OpenAI’s chat models.

Obtaining results with metadata

If you would also like to obtain the results in a structured way including metadata. For this we will be using the results method of the wrapper.

搜索ing for Google images

We can also query Google Images using this wrapper. 例如:

搜索ing for Google news

We can also query Google News using this wrapper. 例如:
If you want to only receive news articles published in the last hour, you can do the following:
Some examples of the tbs parameter: qdr:h (past hour) qdr:d (past day) qdr:w (past week) qdr:m (past month) qdr:y (past year) You can specify intermediate time periods by adding a number: qdr:h12 (past 12 hours) qdr:d3 (past 3 days) qdr:w2 (past 2 weeks) qdr:m6 (past 6 months) qdr:y2 (past 2 years) For all supported filters simply go to Google Search, search for something, click on “Tools”, add your date filter and check the URL for “tbs=”.

搜索ing for Google places

We can also query Google Places using this wrapper. 例如: