Class UsageMetadata (3.82.0)

public final class UsageMetadata extends GeneratedMessageV3 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.v1beta1.UsageMetadata

Static Fields

CACHED_CONTENT_TOKEN_COUNT_FIELD_NUMBER

public static final int CACHED_CONTENT_TOKEN_COUNT_FIELD_NUMBER
Field Value
Type Description
int

CACHE_TOKENS_DETAILS_FIELD_NUMBER

public static final int CACHE_TOKENS_DETAILS_FIELD_NUMBER
Field Value
Type Description
int

CANDIDATES_TOKENS_DETAILS_FIELD_NUMBER

public static final int CANDIDATES_TOKENS_DETAILS_FIELD_NUMBER
Field Value
Type Description
int

CANDIDATES_TOKEN_COUNT_FIELD_NUMBER

public static final int CANDIDATES_TOKEN_COUNT_FIELD_NUMBER
Field Value
Type Description
int

PROMPT_TOKENS_DETAILS_FIELD_NUMBER

public static final int PROMPT_TOKENS_DETAILS_FIELD_NUMBER
Field Value
Type Description
int

PROMPT_TOKEN_COUNT_FIELD_NUMBER

public static final int PROMPT_TOKEN_COUNT_FIELD_NUMBER
Field Value
Type Description
int

THOUGHTS_TOKEN_COUNT_FIELD_NUMBER

public static final int THOUGHTS_TOKEN_COUNT_FIELD_NUMBER
Field Value
Type Description
int

TOOL_USE_PROMPT_TOKENS_DETAILS_FIELD_NUMBER

public static final int TOOL_USE_PROMPT_TOKENS_DETAILS_FIELD_NUMBER
Field Value
Type Description
int

TOOL_USE_PROMPT_TOKEN_COUNT_FIELD_NUMBER

public static final int TOOL_USE_PROMPT_TOKEN_COUNT_FIELD_NUMBER
Field Value
Type Description
int

TOTAL_TOKEN_COUNT_FIELD_NUMBER

public static final int TOTAL_TOKEN_COUNT_FIELD_NUMBER
Field Value
Type Description
int

TRAFFIC_TYPE_FIELD_NUMBER

public static final int TRAFFIC_TYPE_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static UsageMetadata getDefaultInstance()
Returns
Type Description
UsageMetadata

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

newBuilder()

public static UsageMetadata.Builder newBuilder()
Returns
Type Description
UsageMetadata.Builder

newBuilder(UsageMetadata prototype)

public static UsageMetadata.Builder newBuilder(UsageMetadata prototype)
Parameter
Name Description
prototype UsageMetadata
Returns
Type Description
UsageMetadata.Builder

parseDelimitedFrom(InputStream input)

public static UsageMetadata parseDelimitedFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
UsageMetadata
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static UsageMetadata parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
UsageMetadata
Exceptions
Type Description
IOException

parseFrom(byte[] data)

public static UsageMetadata parseFrom(byte[] data)
Parameter
Name Description
data byte[]
Returns
Type Description
UsageMetadata
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static UsageMetadata parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
UsageMetadata
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

public static UsageMetadata parseFrom(ByteString data)
Parameter
Name Description
data ByteString
Returns
Type Description
UsageMetadata
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static UsageMetadata parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
UsageMetadata
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static UsageMetadata parseFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
UsageMetadata
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static UsageMetadata parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
UsageMetadata
Exceptions
Type Description
IOException

parseFrom(InputStream input)

public static UsageMetadata parseFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
UsageMetadata
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static UsageMetadata parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
UsageMetadata
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

public static UsageMetadata parseFrom(ByteBuffer data)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
UsageMetadata
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static UsageMetadata parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
UsageMetadata
Exceptions
Type Description
InvalidProtocolBufferException

parser()

public static Parser<UsageMetadata> parser()
Returns
Type Description
Parser<UsageMetadata>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getCacheTokensDetails(int index)

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.v1beta1.ModalityTokenCount cache_tokens_details = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
index int
Returns
Type Description
ModalityTokenCount

getCacheTokensDetailsCount()

public int getCacheTokensDetailsCount()

Output only. A detailed breakdown of the token count for each modality in the cached content.

repeated .google.cloud.aiplatform.v1beta1.ModalityTokenCount cache_tokens_details = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
int

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.v1beta1.ModalityTokenCount cache_tokens_details = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
List<ModalityTokenCount>

getCacheTokensDetailsOrBuilder(int index)

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.v1beta1.ModalityTokenCount cache_tokens_details = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
index int
Returns
Type Description
ModalityTokenCountOrBuilder

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.v1beta1.ModalityTokenCount cache_tokens_details = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
List<? extends com.google.cloud.aiplatform.v1beta1.ModalityTokenCountOrBuilder>

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];

Returns
Type Description
int

The cachedContentTokenCount.

getCandidatesTokenCount()

public int getCandidatesTokenCount()

The total number of tokens in the generated candidates.

int32 candidates_token_count = 2;

Returns
Type Description
int

The candidatesTokenCount.

getCandidatesTokensDetails(int index)

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.v1beta1.ModalityTokenCount candidates_tokens_details = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
index int
Returns
Type Description
ModalityTokenCount

getCandidatesTokensDetailsCount()

public int getCandidatesTokensDetailsCount()

Output only. A detailed breakdown of the token count for each modality in the generated candidates.

repeated .google.cloud.aiplatform.v1beta1.ModalityTokenCount candidates_tokens_details = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
int

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.v1beta1.ModalityTokenCount candidates_tokens_details = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
List<ModalityTokenCount>

getCandidatesTokensDetailsOrBuilder(int index)

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.v1beta1.ModalityTokenCount candidates_tokens_details = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
index int
Returns
Type Description
ModalityTokenCountOrBuilder

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.v1beta1.ModalityTokenCount candidates_tokens_details = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
List<? extends com.google.cloud.aiplatform.v1beta1.ModalityTokenCountOrBuilder>

getDefaultInstanceForType()

public UsageMetadata getDefaultInstanceForType()
Returns
Type Description
UsageMetadata

getParserForType()

public Parser<UsageMetadata> getParserForType()
Returns
Type Description
Parser<UsageMetadata>
Overrides

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;

Returns
Type Description
int

The promptTokenCount.

getPromptTokensDetails(int index)

public ModalityTokenCount getPromptTokensDetails(int index)

Output only. A detailed breakdown of the token count for each modality in the prompt.

repeated .google.cloud.aiplatform.v1beta1.ModalityTokenCount prompt_tokens_details = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
index int
Returns
Type Description
ModalityTokenCount

getPromptTokensDetailsCount()

public int getPromptTokensDetailsCount()

Output only. A detailed breakdown of the token count for each modality in the prompt.

repeated .google.cloud.aiplatform.v1beta1.ModalityTokenCount prompt_tokens_details = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
int

getPromptTokensDetailsList()

public List<ModalityTokenCount> getPromptTokensDetailsList()

Output only. A detailed breakdown of the token count for each modality in the prompt.

repeated .google.cloud.aiplatform.v1beta1.ModalityTokenCount prompt_tokens_details = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
List<ModalityTokenCount>

getPromptTokensDetailsOrBuilder(int index)

public ModalityTokenCountOrBuilder getPromptTokensDetailsOrBuilder(int index)

Output only. A detailed breakdown of the token count for each modality in the prompt.

repeated .google.cloud.aiplatform.v1beta1.ModalityTokenCount prompt_tokens_details = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
index int
Returns
Type Description
ModalityTokenCountOrBuilder

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.v1beta1.ModalityTokenCount prompt_tokens_details = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
List<? extends com.google.cloud.aiplatform.v1beta1.ModalityTokenCountOrBuilder>

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

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];

Returns
Type Description
int

The thoughtsTokenCount.

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];

Returns
Type Description
int

The toolUsePromptTokenCount.

getToolUsePromptTokensDetails(int index)

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.v1beta1.ModalityTokenCount tool_use_prompt_tokens_details = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
index int
Returns
Type Description
ModalityTokenCount

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.v1beta1.ModalityTokenCount tool_use_prompt_tokens_details = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
int

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.v1beta1.ModalityTokenCount tool_use_prompt_tokens_details = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
List<ModalityTokenCount>

getToolUsePromptTokensDetailsOrBuilder(int index)

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.v1beta1.ModalityTokenCount tool_use_prompt_tokens_details = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
index int
Returns
Type Description
ModalityTokenCountOrBuilder

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.v1beta1.ModalityTokenCount tool_use_prompt_tokens_details = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
List<? extends com.google.cloud.aiplatform.v1beta1.ModalityTokenCountOrBuilder>

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;

Returns
Type Description
int

The totalTokenCount.

getTrafficType()

public UsageMetadata.TrafficType getTrafficType()

Output only. The traffic type for this request.

.google.cloud.aiplatform.v1beta1.UsageMetadata.TrafficType traffic_type = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
UsageMetadata.TrafficType

The trafficType.

getTrafficTypeValue()

public int getTrafficTypeValue()

Output only. The traffic type for this request.

.google.cloud.aiplatform.v1beta1.UsageMetadata.TrafficType traffic_type = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
int

The enum numeric value on the wire for trafficType.

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

public UsageMetadata.Builder newBuilderForType()
Returns
Type Description
UsageMetadata.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected UsageMetadata.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
UsageMetadata.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

public UsageMetadata.Builder toBuilder()
Returns
Type Description
UsageMetadata.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException