Class GenerateContentResponseUsageMetadata

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

public abstract class GenerateContentResponseUsageMetadata extends JsonSerializable
Usage metadata about response(s).
  • Constructor Details

    • GenerateContentResponseUsageMetadata

      public GenerateContentResponseUsageMetadata()
  • Method Details

    • cachedContentTokenCount

      public abstract Optional<Integer> cachedContentTokenCount()
      Output only. Number of tokens in the cached part in the input (the cached content).
    • candidatesTokenCount

      public abstract Optional<Integer> candidatesTokenCount()
      Number of tokens in the response(s).
    • promptTokenCount

      public abstract Optional<Integer> promptTokenCount()
      Number of tokens in the request. When `cached_content` is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content.
    • totalTokenCount

      public abstract Optional<Integer> totalTokenCount()
      Total token count for prompt and response candidates.
    • builder

      Instantiates a builder for GenerateContentResponseUsageMetadata.
    • toBuilder

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

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