Class ModalityTokenCount

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

public abstract class ModalityTokenCount extends JsonSerializable
Represents token counting info for a single modality.
  • Constructor Details

    • ModalityTokenCount

      public ModalityTokenCount()
  • Method Details

    • modality

      public abstract Optional<MediaModality> modality()
      The modality associated with this token count.
    • tokenCount

      public abstract Optional<Integer> tokenCount()
      The number of tokens counted for this modality.
    • builder

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

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

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