Skip to main content
This guide shows how to use SearchApi with LangChain to load web search results.

Overview

SearchApi is a real-time API that grants developers access to results from a variety of search engines, including engines like Google Search, Google News, Google Scholar, YouTube Transcripts or any other engine that could be found in documentation. This API enables developers and businesses to scrape and extract meaningful data directly from the result pages of all these search engines, providing valuable insights for different use-cases. This guide shows how to load web search results using the SearchApiLoader in LangChain. The SearchApiLoader simplifies the process of loading and processing web search results from SearchApi.

Setup

You’ll need to sign up and retrieve your SearchApi API key.

Usage

Here’s an example of how to use the SearchApiLoader:
In this example, the SearchApiLoader is used to load web search results, which are then stored in memory using MemoryVectorStore. A retrieval chain is then used to retrieve the most relevant documents from the memory and answer the question based on these documents. This demonstrates how the SearchApiLoader can streamline the process of loading and processing web search results.