Class UsageMetadata

java.lang.Object
com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessage
com.google.protobuf.GeneratedMessage
com.google.cloud.aiplatform.v1.UsageMetadata
All Implemented Interfaces:
UsageMetadataOrBuilder, com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Serializable

@Generated public final class UsageMetadata extends com.google.protobuf.GeneratedMessage implements UsageMetadataOrBuilder
 Usage metadata about the content generation request and response.
 This message provides a detailed breakdown of token usage and other
 relevant metrics.
 
Protobuf type google.cloud.aiplatform.v1.UsageMetadata
See Also:
  • Field Details

    • PROMPT_TOKEN_COUNT_FIELD_NUMBER

      public static final int PROMPT_TOKEN_COUNT_FIELD_NUMBER
      See Also:
    • CANDIDATES_TOKEN_COUNT_FIELD_NUMBER

      public static final int CANDIDATES_TOKEN_COUNT_FIELD_NUMBER
      See Also:
    • TOTAL_TOKEN_COUNT_FIELD_NUMBER

      public static final int TOTAL_TOKEN_COUNT_FIELD_NUMBER
      See Also:
    • TOOL_USE_PROMPT_TOKEN_COUNT_FIELD_NUMBER

      public static final int TOOL_USE_PROMPT_TOKEN_COUNT_FIELD_NUMBER
      See Also:
    • THOUGHTS_TOKEN_COUNT_FIELD_NUMBER

      public static final int THOUGHTS_TOKEN_COUNT_FIELD_NUMBER
      See Also:
    • CACHED_CONTENT_TOKEN_COUNT_FIELD_NUMBER

      public static final int CACHED_CONTENT_TOKEN_COUNT_FIELD_NUMBER
      See Also:
    • PROMPT_TOKENS_DETAILS_FIELD_NUMBER

      public static final int PROMPT_TOKENS_DETAILS_FIELD_NUMBER
      See Also:
    • CACHE_TOKENS_DETAILS_FIELD_NUMBER

      public static final int CACHE_TOKENS_DETAILS_FIELD_NUMBER
      See Also:
    • CANDIDATES_TOKENS_DETAILS_FIELD_NUMBER

      public static final int CANDIDATES_TOKENS_DETAILS_FIELD_NUMBER
      See Also:
    • TOOL_USE_PROMPT_TOKENS_DETAILS_FIELD_NUMBER

      public static final int TOOL_USE_PROMPT_TOKENS_DETAILS_FIELD_NUMBER
      See Also:
    • TRAFFIC_TYPE_FIELD_NUMBER

      public static final int TRAFFIC_TYPE_FIELD_NUMBER
      See Also:
  • Method Details

    • getDescriptor

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
    • internalGetFieldAccessorTable

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessage
    • getPromptTokenCount

      public int getPromptTokenCount()
       The total number of tokens in the prompt. This includes any text, images,
       or other media provided in the request. When `cached_content` is set,
       this also includes the number of tokens in the cached content.
       
      int32 prompt_token_count = 1;
      Specified by:
      getPromptTokenCount in interface UsageMetadataOrBuilder
      Returns:
      The promptTokenCount.
    • getCandidatesTokenCount

      public int getCandidatesTokenCount()
       The total number of tokens in the generated candidates.
       
      int32 candidates_token_count = 2;
      Specified by:
      getCandidatesTokenCount in interface UsageMetadataOrBuilder
      Returns:
      The candidatesTokenCount.
    • getTotalTokenCount

      public int getTotalTokenCount()
       The total number of tokens for the entire request. This is the sum of
       `prompt_token_count`, `candidates_token_count`,
       `tool_use_prompt_token_count`, and `thoughts_token_count`.
       
      int32 total_token_count = 3;
      Specified by:
      getTotalTokenCount in interface UsageMetadataOrBuilder
      Returns:
      The totalTokenCount.
    • getToolUsePromptTokenCount

      public int getToolUsePromptTokenCount()
       Output only. The number of tokens in the results from tool executions,
       which are provided back to the model as input, if applicable.
       
      int32 tool_use_prompt_token_count = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getToolUsePromptTokenCount in interface UsageMetadataOrBuilder
      Returns:
      The toolUsePromptTokenCount.
    • getThoughtsTokenCount

      public int getThoughtsTokenCount()
       Output only. The number of tokens that were part of the model's generated
       "thoughts" output, if applicable.
       
      int32 thoughts_token_count = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getThoughtsTokenCount in interface UsageMetadataOrBuilder
      Returns:
      The thoughtsTokenCount.
    • getCachedContentTokenCount

      public int getCachedContentTokenCount()
       Output only. The number of tokens in the cached content that was used for
       this request.
       
      int32 cached_content_token_count = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getCachedContentTokenCount in interface UsageMetadataOrBuilder
      Returns:
      The cachedContentTokenCount.
    • getPromptTokensDetailsList

      public List<ModalityTokenCount> getPromptTokensDetailsList()
       Output only. A detailed breakdown of the token count for each modality in
       the prompt.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount prompt_tokens_details = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getPromptTokensDetailsList in interface UsageMetadataOrBuilder
    • getPromptTokensDetailsOrBuilderList

      public List<? extends ModalityTokenCountOrBuilder> getPromptTokensDetailsOrBuilderList()
       Output only. A detailed breakdown of the token count for each modality in
       the prompt.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount prompt_tokens_details = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getPromptTokensDetailsOrBuilderList in interface UsageMetadataOrBuilder
    • getPromptTokensDetailsCount

      public int getPromptTokensDetailsCount()
       Output only. A detailed breakdown of the token count for each modality in
       the prompt.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount prompt_tokens_details = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getPromptTokensDetailsCount in interface UsageMetadataOrBuilder
    • getPromptTokensDetails

      public ModalityTokenCount getPromptTokensDetails(int index)
       Output only. A detailed breakdown of the token count for each modality in
       the prompt.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount prompt_tokens_details = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getPromptTokensDetails in interface UsageMetadataOrBuilder
    • getPromptTokensDetailsOrBuilder

      public ModalityTokenCountOrBuilder getPromptTokensDetailsOrBuilder(int index)
       Output only. A detailed breakdown of the token count for each modality in
       the prompt.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount prompt_tokens_details = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getPromptTokensDetailsOrBuilder in interface UsageMetadataOrBuilder
    • getCacheTokensDetailsList

      public List<ModalityTokenCount> getCacheTokensDetailsList()
       Output only. A detailed breakdown of the token count for each modality in
       the cached content.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount cache_tokens_details = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getCacheTokensDetailsList in interface UsageMetadataOrBuilder
    • getCacheTokensDetailsOrBuilderList

      public List<? extends ModalityTokenCountOrBuilder> getCacheTokensDetailsOrBuilderList()
       Output only. A detailed breakdown of the token count for each modality in
       the cached content.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount cache_tokens_details = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getCacheTokensDetailsOrBuilderList in interface UsageMetadataOrBuilder
    • getCacheTokensDetailsCount

      public int getCacheTokensDetailsCount()
       Output only. A detailed breakdown of the token count for each modality in
       the cached content.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount cache_tokens_details = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getCacheTokensDetailsCount in interface UsageMetadataOrBuilder
    • getCacheTokensDetails

      public ModalityTokenCount getCacheTokensDetails(int index)
       Output only. A detailed breakdown of the token count for each modality in
       the cached content.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount cache_tokens_details = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getCacheTokensDetails in interface UsageMetadataOrBuilder
    • getCacheTokensDetailsOrBuilder

      public ModalityTokenCountOrBuilder getCacheTokensDetailsOrBuilder(int index)
       Output only. A detailed breakdown of the token count for each modality in
       the cached content.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount cache_tokens_details = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getCacheTokensDetailsOrBuilder in interface UsageMetadataOrBuilder
    • getCandidatesTokensDetailsList

      public List<ModalityTokenCount> getCandidatesTokensDetailsList()
       Output only. A detailed breakdown of the token count for each modality in
       the generated candidates.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount candidates_tokens_details = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getCandidatesTokensDetailsList in interface UsageMetadataOrBuilder
    • getCandidatesTokensDetailsOrBuilderList

      public List<? extends ModalityTokenCountOrBuilder> getCandidatesTokensDetailsOrBuilderList()
       Output only. A detailed breakdown of the token count for each modality in
       the generated candidates.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount candidates_tokens_details = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getCandidatesTokensDetailsOrBuilderList in interface UsageMetadataOrBuilder
    • getCandidatesTokensDetailsCount

      public int getCandidatesTokensDetailsCount()
       Output only. A detailed breakdown of the token count for each modality in
       the generated candidates.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount candidates_tokens_details = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getCandidatesTokensDetailsCount in interface UsageMetadataOrBuilder
    • getCandidatesTokensDetails

      public ModalityTokenCount getCandidatesTokensDetails(int index)
       Output only. A detailed breakdown of the token count for each modality in
       the generated candidates.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount candidates_tokens_details = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getCandidatesTokensDetails in interface UsageMetadataOrBuilder
    • getCandidatesTokensDetailsOrBuilder

      public ModalityTokenCountOrBuilder getCandidatesTokensDetailsOrBuilder(int index)
       Output only. A detailed breakdown of the token count for each modality in
       the generated candidates.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount candidates_tokens_details = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getCandidatesTokensDetailsOrBuilder in interface UsageMetadataOrBuilder
    • getToolUsePromptTokensDetailsList

      public List<ModalityTokenCount> getToolUsePromptTokensDetailsList()
       Output only. A detailed breakdown by modality of the token counts from the
       results of tool executions, which are provided back to the model as input.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount tool_use_prompt_tokens_details = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getToolUsePromptTokensDetailsList in interface UsageMetadataOrBuilder
    • getToolUsePromptTokensDetailsOrBuilderList

      public List<? extends ModalityTokenCountOrBuilder> getToolUsePromptTokensDetailsOrBuilderList()
       Output only. A detailed breakdown by modality of the token counts from the
       results of tool executions, which are provided back to the model as input.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount tool_use_prompt_tokens_details = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getToolUsePromptTokensDetailsOrBuilderList in interface UsageMetadataOrBuilder
    • getToolUsePromptTokensDetailsCount

      public int getToolUsePromptTokensDetailsCount()
       Output only. A detailed breakdown by modality of the token counts from the
       results of tool executions, which are provided back to the model as input.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount tool_use_prompt_tokens_details = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getToolUsePromptTokensDetailsCount in interface UsageMetadataOrBuilder
    • getToolUsePromptTokensDetails

      public ModalityTokenCount getToolUsePromptTokensDetails(int index)
       Output only. A detailed breakdown by modality of the token counts from the
       results of tool executions, which are provided back to the model as input.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount tool_use_prompt_tokens_details = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getToolUsePromptTokensDetails in interface UsageMetadataOrBuilder
    • getToolUsePromptTokensDetailsOrBuilder

      public ModalityTokenCountOrBuilder getToolUsePromptTokensDetailsOrBuilder(int index)
       Output only. A detailed breakdown by modality of the token counts from the
       results of tool executions, which are provided back to the model as input.
       
      repeated .google.cloud.aiplatform.v1.ModalityTokenCount tool_use_prompt_tokens_details = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getToolUsePromptTokensDetailsOrBuilder in interface UsageMetadataOrBuilder
    • getTrafficTypeValue

      public int getTrafficTypeValue()
       Output only. The traffic type for this request.
       
      .google.cloud.aiplatform.v1.UsageMetadata.TrafficType traffic_type = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getTrafficTypeValue in interface UsageMetadataOrBuilder
      Returns:
      The enum numeric value on the wire for trafficType.
    • getTrafficType

      public UsageMetadata.TrafficType getTrafficType()
       Output only. The traffic type for this request.
       
      .google.cloud.aiplatform.v1.UsageMetadata.TrafficType traffic_type = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];
      Specified by:
      getTrafficType in interface UsageMetadataOrBuilder
      Returns:
      The trafficType.
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessage
    • writeTo

      public void writeTo(com.google.protobuf.CodedOutputStream output) throws IOException
      Specified by:
      writeTo in interface com.google.protobuf.MessageLite
      Overrides:
      writeTo in class com.google.protobuf.GeneratedMessage
      Throws:
      IOException
    • getSerializedSize

      public int getSerializedSize()
      Specified by:
      getSerializedSize in interface com.google.protobuf.MessageLite
      Overrides:
      getSerializedSize in class com.google.protobuf.GeneratedMessage
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface com.google.protobuf.Message
      Overrides:
      equals in class com.google.protobuf.AbstractMessage
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface com.google.protobuf.Message
      Overrides:
      hashCode in class com.google.protobuf.AbstractMessage
    • parseFrom

      public static UsageMetadata parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static UsageMetadata parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static UsageMetadata parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static UsageMetadata parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static UsageMetadata parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static UsageMetadata parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static UsageMetadata parseFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static UsageMetadata parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static UsageMetadata parseDelimitedFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static UsageMetadata parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseFrom

      public static UsageMetadata parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static UsageMetadata parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • newBuilderForType

      public UsageMetadata.Builder newBuilderForType()
      Specified by:
      newBuilderForType in interface com.google.protobuf.Message
      Specified by:
      newBuilderForType in interface com.google.protobuf.MessageLite
    • newBuilder

      public static UsageMetadata.Builder newBuilder()
    • newBuilder

      public static UsageMetadata.Builder newBuilder(UsageMetadata prototype)
    • toBuilder

      public UsageMetadata.Builder toBuilder()
      Specified by:
      toBuilder in interface com.google.protobuf.Message
      Specified by:
      toBuilder in interface com.google.protobuf.MessageLite
    • newBuilderForType

      protected UsageMetadata.Builder newBuilderForType(com.google.protobuf.AbstractMessage.BuilderParent parent)
      Overrides:
      newBuilderForType in class com.google.protobuf.AbstractMessage
    • getDefaultInstance

      public static UsageMetadata getDefaultInstance()
    • parser

      public static com.google.protobuf.Parser<UsageMetadata> parser()
    • getParserForType

      public com.google.protobuf.Parser<UsageMetadata> getParserForType()
      Specified by:
      getParserForType in interface com.google.protobuf.Message
      Specified by:
      getParserForType in interface com.google.protobuf.MessageLite
      Overrides:
      getParserForType in class com.google.protobuf.GeneratedMessage
    • getDefaultInstanceForType

      public UsageMetadata getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder