Class DocumentMetadata

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

public abstract class DocumentMetadata extends JsonSerializable
Metadata describes the input document content.

Set this in `Part.document_metadata` or `FunctionResponsePart.document_metadata` when `inline_data` or `file_data` contains a document to configure static document preprocessing.

  • Constructor Details

    • DocumentMetadata

      public DocumentMetadata()
  • Method Details

    • startPage

      public abstract Optional<Integer> startPage()
      Optional. 1-indexed inclusive start page.
    • endPage

      public abstract Optional<Integer> endPage()
      Optional. 1-indexed inclusive end page.
    • contentLayers

      public abstract Optional<List<DocumentMetadataContentLayer>> contentLayers()
      Content layers to return. If empty, defaults to [PAGE_IMAGE] when DocumentMetadata is set. When DocumentMetadata is not set, default document processing is used (for example, page images for PDFs).
    • builder

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

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

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