Interface WebSearchEngine

All Known Implementing Classes:
GoogleCustomWebSearchEngine, SearchApiWebSearchEngine, TavilyWebSearchEngine

public interface WebSearchEngine
Represents a web search engine that can be used to perform searches on the Web in response to a user query.
  • Method Details

    • search

      default WebSearchResults search(String query)
      Performs a search query on the web search engine and returns the search results.
      Parameters:
      query - the search query
      Returns:
      the search results
    • search

      WebSearchResults search(WebSearchRequest webSearchRequest)
      Performs a search request on the web search engine and returns the search results.
      Parameters:
      webSearchRequest - the search request
      Returns:
      the web search results
    • searchAsync

      @Experimental default CompletableFuture<WebSearchResults> searchAsync(WebSearchRequest webSearchRequest)
      Non-blocking counterpart of search(WebSearchRequest), used by the asynchronous and reactive RAG flow (see WebSearchContentRetriever).

      The default returns a failed future carrying AsyncNotSupportedException: a web search engine that is not genuinely asynchronous does not pretend to be. An engine backed by remote HTTP I/O opts in by overriding this with a genuinely async call (no thread parked). An engine that has not opted in is still usable from the non-blocking RAG path, which offloads its blocking search(WebSearchRequest).

      An implementation that honors cancellation should abort its in-flight call when the returned future is cancelled (best-effort).

      Parameters:
      webSearchRequest - the search request
      Returns:
      a CompletableFuture of the web search results
      Since:
      1.20.0