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 Summary
Modifier and TypeMethodDescriptionsearch(WebSearchRequest webSearchRequest) Performs a search request on the web search engine and returns the search results.default WebSearchResultsPerforms a search query on the web search engine and returns the search results.default CompletableFuture<WebSearchResults> searchAsync(WebSearchRequest webSearchRequest) Non-blocking counterpart ofsearch(WebSearchRequest), used by the asynchronous and reactive RAG flow (seeWebSearchContentRetriever).
-
Method Details
-
search
Performs a search query on the web search engine and returns the search results.- Parameters:
query- the search query- Returns:
- the search results
-
search
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 ofsearch(WebSearchRequest), used by the asynchronous and reactive RAG flow (seeWebSearchContentRetriever).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 blockingsearch(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
CompletableFutureof the web search results - Since:
- 1.20.0
-