customsearch/GoogleCustomWebSearchEngine.java

langchain4j · web-search-engines/langchain4j-web-search-engine-google-custom/src/main/java/dev/langchain4j/web/search/google/customsearch/GoogleCustomWebSearchEngine.java · java · Apache-2.0
ai, tag:knn-classified

Implements WebSearchEngine using Google Custom Search API with configurable options.

// Source: https://github.com/langchain4j/langchain4j | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package dev.langchain4j.web.search.google.customsearch;

import static com.google.api.services.customsearch.v1.model.Search.Queries;
import static dev.langchain4j.internal.UriUtils.createUriSafely;
import static dev.langchain4j.internal.Utils.getOrDefault;
import static dev.langchain4j.internal.Utils.isNotNullOrBlank;
import static dev.langchain4j.internal.Utils.isNullOrEmpty;
import static dev.langchain4j.internal.ValidationUtils.ensureNotNull;
import static java.util.stream.Collectors.toList;

import com.google.api.client.json.GenericJson;
import com.google.api.services.customse

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key