Web Search
The Web Search component performs a basic web search using DuckDuckGo’s HTML scraping interface.
Important: The Web Search component uses web scraping, which can be subject to rate limits. For production use, consider using a component with more robust API support.
Web Search Parameters
| Parameter | Description |
|---|---|
| Search Mode | Choose what kind of results you want to find: standard Web pages, News articles, or RSS feeds. |
| Search Query* | The keywords or phrases you want to look up on the web. (Required) |
| Language (hl) |
Restricts search results to a specific language (for example, en for English).
|
| Country (gl) |
Restricts search results to a specific country (for example, us for the United States).
|
| Topic | Focuses your search on a specific subject or category. |
| Location (Geo) | Customizes results based on a specific geographic location or city. |
| Timeout | How long (in seconds) the component will try to fetch search results before stopping. |
| Results | The output list containing the titles, links, and text snippets found by the search. |
Output Behavior
By default, the Web Search component outputs data as a DataFrame.
Because components like the Prompt Template only accept Message data, you must convert the output using a Type Convert component before passing search results to downstream language model prompts.
Usage Example: Web Search in a Flow
Follow these steps to pass dynamic web search results into a Language Model prompt:
1.Initialize Flow: Create a new flow based on the Basic Prompting template.
2.Add Search Query: Add a Web Search component and enter a search query (e.g., environmental news).
3.Convert Output Type: Add a Type Convert component and set its Output Type to Message. Connect the output of the Web Search component to the input of the Type Convert component.
4.Define Prompt Variables: In the Prompt Template component’s Template field, add a context variable such as {searchresults} or {context} to expose a new input socket.
5.Pass Context to Prompt: Connect the output of the Type Convert component to the newly created variable socket on the Prompt Template component.
6.Configure Model & Test: Enter your API key in the Language Model component (or select your preferred provider/model). Click Playground and enter a prompt like latest news to run the flow.
Web Search Output
The Web Search component produces a DataFrame with three main columns:
title: The heading or name of the web page.
links: The web address (URL) of the result.
snippets: A short description or text preview from the page.
How to Connect the Output
How you handle the output depends on how you use the component in your flow:
In Standard Flows: You must connect the output directly to a component that accepts a DataFrame. If you want to send the results to components that require text or data objects (like a Prompt Template), you must first route the output through a Type Convert component to change it into Message or Data format.
In Agent Tool Mode: You can connect the output directly to an Agent component’s Tools port with no conversion required. The agent can read the DataFrame directly and will automatically decide when to run the search based on the user’s prompt.