GroundingMetadata

public final class GroundingMetadata


Metadata returned to the client when grounding is enabled.

If using Grounding with Google Search, you are required to comply with the "Grounding with Google Search" usage requirements for your chosen API provider: Gemini Developer API or Vertex AI Gemini API (see Service Terms section within the Service Specific Terms).

Summary

Public fields

final @NonNull List<@NonNull GroundingAttribution>

This field is deprecated. Use groundingChunks instead

final @NonNull List<@NonNull GroundingChunk>

The list of GroundingChunk classes.

final @NonNull List<@NonNull GroundingSupport>

The list of GroundingSupport objects.

final @NonNull List<@NonNull String>
final SearchEntryPoint

Google Search entry point for web searches.

final @NonNull List<@NonNull String>

The list of web search queries that the model performed to gather the grounding information.

Public constructors

GroundingMetadata(
    @NonNull List<@NonNull String> webSearchQueries,
    SearchEntryPoint searchEntryPoint,
    @NonNull List<@NonNull String> retrievalQueries,
    @NonNull List<@NonNull GroundingAttribution> groundingAttribution,
    @NonNull List<@NonNull GroundingChunk> groundingChunks,
    @NonNull List<@NonNull GroundingSupport> groundingSupports
)

Public fields

groundingAttribution

public final @NonNull List<@NonNull GroundingAttributiongroundingAttribution

groundingChunks

public final @NonNull List<@NonNull GroundingChunkgroundingChunks

The list of GroundingChunk classes. Each chunk represents a piece of retrieved content that the model used to ground its response.

groundingSupports

public final @NonNull List<@NonNull GroundingSupportgroundingSupports

The list of GroundingSupport objects. Each object details how specific segments of the model's response are supported by the groundingChunks.

retrievalQueries

public final @NonNull List<@NonNull StringretrievalQueries

searchEntryPoint

public final SearchEntryPoint searchEntryPoint

Google Search entry point for web searches. This contains an HTML/CSS snippet that must be embedded in an app to display a Google Search Entry point for follow-up web searches related to the model's "Grounded Response".

webSearchQueries

public final @NonNull List<@NonNull StringwebSearchQueries

The list of web search queries that the model performed to gather the grounding information. These can be used to allow users to explore the search results themselves.

Public constructors

GroundingMetadata

public GroundingMetadata(
    @NonNull List<@NonNull String> webSearchQueries,
    SearchEntryPoint searchEntryPoint,
    @NonNull List<@NonNull String> retrievalQueries,
    @NonNull List<@NonNull GroundingAttribution> groundingAttribution,
    @NonNull List<@NonNull GroundingChunk> groundingChunks,
    @NonNull List<@NonNull GroundingSupport> groundingSupports
)