SearchApiWebSearch
Uses SearchApi to search the web for relevant documents.
Basic Information
- Type:
haystack_integrations.websearch.searchapi.SearchApiWebSearch
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. |
Overview
Work in Progress
Bear with us while we're working on adding pipeline examples and most common components connections.
Uses SearchApi to search the web for relevant documents.
Usage example:
from haystack.components.websearch import SearchApiWebSearch
from haystack.utils import Secret
websearch = SearchApiWebSearch(top_k=10, api_key=Secret.from_token("test-api-key"))
results = websearch.run(query="Who is the boyfriend of Olivia Wilde?")
assert results["documents"]
assert results["links"]
Usage Example
components:
SearchApiWebSearch:
type: components.websearch.searchapi.SearchApiWebSearch
init_parameters:
Parameters
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|---|---|---|
| api_key | Secret | Secret.from_env_var('SEARCHAPI_API_KEY') | API key for the SearchApi 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 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.
| Parameter | Type | Default | Description |
|---|---|---|---|
| query | str | Search query. |
Was this page helpful?