SerperDevWebSearch
Searches the web using the Serper API and returns relevant documents and links.
Key Features
- Fast and cost-effective web search powered by Serper.dev.
- 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
You need a Serper API key to use this component. Create a secret called SERPERDEV_API_KEY in your workspace. For more information, see Add Secrets.
- Drag the
SerperDevWebSearchcomponent onto the canvas from the Component Library. - Click the component to open the configuration panel.
- Configure the parameters as needed.
Connections
SerperDevWebSearch 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:
SerperDevWebSearch:
type: components.websearch.serper_dev.SerperDevWebSearch
init_parameters:
Parameters
Inputs
| Parameter | Type | Default | Description |
|---|---|---|---|
| query | str | Search query. |
Outputs
| Parameter | Type | Default | Description |
|---|---|---|---|
| documents | List[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. | |
| links | List[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:
| Parameter | Type | Default | Description |
|---|---|---|---|
| api_key | Secret | Secret.from_env_var('SERPERDEV_API_KEY') | API key for the Serper API. |
| top_k | Optional[int] | 10 | Number of documents to return. |
| allowed_domains | Optional[List[str]] | None | List of domains to limit the search to. |
| search_params | Optional[Dict[str, Any]] | None | Additional parameters passed to the Serper API. For example, you can set 'num' to 20 to increase the number of search results. See the Serper website for more details. |
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.
| Parameter | Type | Default | Description |
|---|---|---|---|
| query | str | Search query. |
Was this page helpful?