Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

SearchApiWebSearch

Searches the web using the SearchApi service and returns relevant documents and links.

Key Features

  • Supports Google and other search engines through SearchApi's unified API.
  • Configurable number of results with top_k.
  • Domain filtering to restrict search to specific websites.
  • Customizable search parameters for advanced query control.
  • Returns both documents and links from search results.

Configuration

Authentication

You need a SearchApi API key to use this component. Create a secret called SEARCHAPI_API_KEY in your workspace. For more information, see Add Secrets.

  1. Drag the SearchApiWebSearch component onto the canvas from the Component Library.
  2. Click the component to open the configuration panel.
  3. Configure the parameters as needed.

Connections

SearchApiWebSearch accepts a search query string as input. It outputs a list of documents and a list of links from the search results.

Connect the pipeline's query input to its query input. Connect its documents output to a PromptBuilder or other components that process retrieved content.

Usage Example

components:
SearchApiWebSearch:
type: components.websearch.searchapi.SearchApiWebSearch
init_parameters:

Parameters

Inputs

ParameterTypeDefaultDescription
querystrSearch query.

Outputs

ParameterTypeDefaultDescription
documentsList[Document]A dictionary with the following keys: - "documents": List of documents returned by the search engine. - "links": List of links returned by the search engine.
linksList[str]A dictionary with the following keys: - "documents": List of documents returned by the search engine. - "links": List of links returned by the search engine.

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
api_keySecretSecret.from_env_var('SEARCHAPI_API_KEY')API key for the SearchApi API
top_kOptional[int]10Number of documents to return.
allowed_domainsOptional[List[str]]NoneList of domains to limit the search to.
search_paramsOptional[Dict[str, Any]]NoneAdditional parameters passed to the SearchApi API. For example, you can set 'num' to 100 to increase the number of search results. See the SearchApi website for more details. The default search engine is Google, however, users can change it by setting the engine parameter in the search_params.

Run Method Parameters

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription
querystrSearch query.