Skip to main content

Web Search

The Web Search component consolidates the Web Search, News Search, and RSS Reader components into a single component with tabs for different search modes. You can search the web using DuckDuckGo, search Google News, or read RSS feeds, all from one component.

For other search APIs, see Bundles.

info

The Web Search component uses web scraping that can be subject to rate limits.

For production use, consider using another search component with more robust API support, such as provider-specific bundles.

Use the Web Search component in a flow

The following steps demonstrate one way that you can use a Web Search component in a flow:

  1. Create a flow based on the Basic Prompting template.

  2. Add a Web Search component, select your desired Search Mode (Web, News, or RSS), and then enter a search query or RSS feed URL.

  3. Add a Type Convert component, set the Output Type to Message, and then connect the Web Search component's output to the Type Convert component's input.

    By default, the Web Search component outputs a DataFrame. Because the Prompt Template component only accepts Message data, this conversion is required so that the flow can pass the search results to the Prompt Template component. For more information, see Web Search output.

  4. In the Prompt Template component's Template field, add a variable like {searchresults} or {context}.

    This adds a field to the Prompt Template component that you can use to pass the converted search results to the prompt. For more information, see Define variables in prompts.

  5. Connect the Type Convert component's output to the new variable field on the Prompt Template component.

    Type convert web search output to chat

  6. In the Language Model component, add your OpenAI API key, or select a different provider and model.

  7. Click Playground, and then enter your query.

    The LLM processes the request, including the context passed through the Prompt Template component, and then prints the response in the Playground chat interface.

    Result

    The following is an example of a possible response. Your response may vary based on the current state of the web, your specific query, the model, and other factors.


    _10
    Here are some of the latest news articles related to the environment:
    _10
    Ozone Pollution and Global Warming: A recent study highlights that ozone pollution is a significant global environmental concern, threatening human health and crop production while exacerbating global warming. Read more
    _10
    ...

Parameters

Some parameters are hidden by default in the visual editor. You can modify all parameters through the Controls in the component's header menu.

NameDisplay NameInfo
search_modeSearch ModeInput parameter. Choose search mode: Web (DuckDuckGo), News (Google News), or RSS (Feed Reader). Default: Web.
querySearch QueryInput parameter. Keywords to search for.
timeoutTimeoutInput parameter. Timeout for the web search request in seconds. Default: 5.
resultsResultsOutput parameter. Returns a DataFrame containing title, link, snippet, and content. For more information, see Web Search output.

Web Search output

The Web Search component outputs a DataFrame with different columns depending on the search mode.

When using Web search mode, the component returns a DataFrame containing:

  • title: The title of the search result
  • link: The URL of the search result
  • snippet: A brief snippet from the search result
  • content: The full content of the page (when successfully fetched)
Search