Class GroundingChunkRetrievedContext

java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.GroundingChunkRetrievedContext

public abstract class GroundingChunkRetrievedContext extends JsonSerializable
Context retrieved from a data source to ground the model's response. This is used when a retrieval tool fetches information from a user-provided corpus or a public dataset.
  • Constructor Details

    • GroundingChunkRetrievedContext

      public GroundingChunkRetrievedContext()
  • Method Details

    • documentName

      public abstract Optional<String> documentName()
      Output only. The full resource name of the referenced Vertex AI Search document. This is used to identify the specific document that was retrieved. The format is `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`. This field is not supported in Gemini API.
    • ragChunk

      public abstract Optional<RagChunk> ragChunk()
      Additional context for a Retrieval-Augmented Generation (RAG) retrieval result. This is populated only when the RAG retrieval tool is used. This field is not supported in Gemini API.
    • text

      public abstract Optional<String> text()
      The content of the retrieved data source.
    • title

      public abstract Optional<String> title()
      The title of the retrieved data source.
    • uri

      public abstract Optional<String> uri()
      The URI of the retrieved data source.
    • customMetadata

      public abstract Optional<List<GroundingChunkCustomMetadata>> customMetadata()
      Optional. User-provided metadata about the retrieved context. This field is not supported in Vertex AI.
    • fileSearchStore

      public abstract Optional<String> fileSearchStore()
      Optional. Name of the `FileSearchStore` containing the document. Example: `fileSearchStores/123`. This field is not supported in Vertex AI.
    • builder

      public static GroundingChunkRetrievedContext.Builder builder()
      Instantiates a builder for GroundingChunkRetrievedContext.
    • toBuilder

      public abstract GroundingChunkRetrievedContext.Builder toBuilder()
      Creates a builder with the same values as this instance.
    • fromJson

      public static GroundingChunkRetrievedContext fromJson(String jsonString)
      Deserializes a JSON string to a GroundingChunkRetrievedContext object.