Class WebSearchInformationResult

java.lang.Object
dev.langchain4j.web.search.WebSearchInformationResult

public class WebSearchInformationResult extends Object
Represents general information about the web search performed. This includes the total number of results, the page number, and metadata.

The total number of results is the total number of web pages that are found by the search engine in response to a search query. The page number is the current page number of the search results. The metadata is a map of key-value pairs that provide additional information about the search. For example, it could include the search query, the search engine used, the time it took to perform the search, etc.

  • Constructor Details

    • WebSearchInformationResult

      public WebSearchInformationResult(Long totalResults)
      Constructs a new WebSearchInformationResult with the specified total results.
      Parameters:
      totalResults - The total number of results.
    • WebSearchInformationResult

      public WebSearchInformationResult(Long totalResults, Integer pageNumber, Map<String,Object> metadata)
      Constructs a new WebSearchInformationResult with the specified total results, page number, and metadata.
      Parameters:
      totalResults - The total number of results.
      pageNumber - The page number.
      metadata - The metadata.
  • Method Details

    • totalResults

      public Long totalResults()
      Gets the total number of results.
      Returns:
      The total number of results.
    • pageNumber

      public Integer pageNumber()
      Gets the page number.
      Returns:
      The page number.
    • metadata

      public Map<String,Object> metadata()
      Gets the metadata.
      Returns:
      The metadata.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • from

      public static WebSearchInformationResult from(Long totalResults)
      Creates a new WebSearchInformationResult with the specified total results.
      Parameters:
      totalResults - The total number of results.
      Returns:
      The new WebSearchInformationResult.
    • from

      public static WebSearchInformationResult from(Long totalResults, Integer pageNumber, Map<String,Object> metadata)
      Creates a new WebSearchInformationResult with the specified total results, page number, and metadata.
      Parameters:
      totalResults - The total number of results.
      pageNumber - The page number.
      metadata - The metadata.
      Returns:
      The new WebSearchInformationResult.