Serp API tool for flows in Azure AI Studio

Important

Items marked (preview) in this article are currently in public preview. This preview is provided without a service-level agreement, and we don't recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.

The prompt flow Serp API tool provides a wrapper to the Serp API Google Search Engine Results API and Serp API Bing Search Engine Results API.

You can use the tool to retrieve search results from many different search engines, including Google and Bing. You can specify a range of search parameters, such as the search query, location, and device type.

Prerequisites

Sign up on the Serp API home page.

To create a Serp connection:

  1. Sign in to Azure AI Studio.

  2. Go to Project settings > Connections.

  3. Select + New connection.

  4. Add the following custom keys to the connection:

    • azureml.flow.connection_type: Custom
    • azureml.flow.module: promptflow.connections
    • api_key: Your Serp API key. You must select the is secret checkbox to keep the API key secure.

    Screenshot that shows adding extra information to a custom connection in AI Studio.

The connection is the model used to establish connections with the Serp API. Get your API key from the Serp API account dashboard.

Type Name API key
Serp Required Required

Build with the Serp API tool

  1. Create or open a flow in Azure AI Studio. For more information, see Create a flow.

  2. Select + More tools > Serp API to add the Serp API tool to your flow.

    Screenshot that shows the Serp API tool added to a flow in Azure AI Studio.

  3. Select the connection to one of your provisioned resources. For example, select SerpConnection if you created a connection with that name. For more information, see Prerequisites.

  4. Enter values for the Serp API tool input parameters described in the Inputs table.

  5. Add more tools to your flow, as needed. Or select Run to run the flow.

  6. The outputs are described in the Outputs table.

Inputs

The following input parameters are available.

Name Type Description Required
query string The search query to be executed. Yes
engine string The search engine to use for the search. Default is google. Yes
num integer The number of search results to return. Default is 10. No
location string The geographic location from which to execute the search. No
safe string The safe search mode to use for the search. Default is off. No

Outputs

The JSON representation from a serpapi query:

Engine Return type Output
Google json Sample
Bing json Sample

Next steps