Class GenerateContentResponse.UsageMetadata (1.35.0)

publicstaticfinalclass GenerateContentResponse.UsageMetadataextendsGeneratedMessageV3implementsGenerateContentResponse.UsageMetadataOrBuilder

Usage metadata about response(s).

Protobuf type google.cloud.vertexai.v1.GenerateContentResponse.UsageMetadata

Inheritance

Object > AbstractMessageLite<MessageType,BuilderType> > AbstractMessage > GeneratedMessageV3 > GenerateContentResponse.UsageMetadata

Inherited Members

com.google.protobuf.GeneratedMessageV3.<ListT>makeMutableCopy(ListT)
com.google.protobuf.GeneratedMessageV3.<ListT>makeMutableCopy(ListT,int)
com.google.protobuf.GeneratedMessageV3.<T>emptyList(java.lang.Class<T>)
com.google.protobuf.GeneratedMessageV3.internalGetMapFieldReflection(int)

Static Fields

CACHED_CONTENT_TOKEN_COUNT_FIELD_NUMBER

publicstaticfinalintCACHED_CONTENT_TOKEN_COUNT_FIELD_NUMBER
Field Value
Type Description
int

CACHE_TOKENS_DETAILS_FIELD_NUMBER

publicstaticfinalintCACHE_TOKENS_DETAILS_FIELD_NUMBER
Field Value
Type Description
int

CANDIDATES_TOKENS_DETAILS_FIELD_NUMBER

publicstaticfinalintCANDIDATES_TOKENS_DETAILS_FIELD_NUMBER
Field Value
Type Description
int

CANDIDATES_TOKEN_COUNT_FIELD_NUMBER

publicstaticfinalintCANDIDATES_TOKEN_COUNT_FIELD_NUMBER
Field Value
Type Description
int

PROMPT_TOKENS_DETAILS_FIELD_NUMBER

publicstaticfinalintPROMPT_TOKENS_DETAILS_FIELD_NUMBER
Field Value
Type Description
int

PROMPT_TOKEN_COUNT_FIELD_NUMBER

publicstaticfinalintPROMPT_TOKEN_COUNT_FIELD_NUMBER
Field Value
Type Description
int

TOTAL_TOKEN_COUNT_FIELD_NUMBER

publicstaticfinalintTOTAL_TOKEN_COUNT_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

publicstaticGenerateContentResponse.UsageMetadatagetDefaultInstance()
Returns
Type Description
GenerateContentResponse.UsageMetadata

getDescriptor()

publicstaticfinalDescriptors.DescriptorgetDescriptor()
Returns
Type Description
Descriptor

newBuilder()

publicstaticGenerateContentResponse.UsageMetadata.BuildernewBuilder()
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

newBuilder(GenerateContentResponse.UsageMetadata prototype)

publicstaticGenerateContentResponse.UsageMetadata.BuildernewBuilder(GenerateContentResponse.UsageMetadataprototype)
Parameter
Name Description
prototype GenerateContentResponse.UsageMetadata
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

parseDelimitedFrom(InputStream input)

publicstaticGenerateContentResponse.UsageMetadataparseDelimitedFrom(InputStreaminput)
Parameter
Name Description
input InputStream
Returns
Type Description
GenerateContentResponse.UsageMetadata
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

publicstaticGenerateContentResponse.UsageMetadataparseDelimitedFrom(InputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentResponse.UsageMetadata
Exceptions
Type Description
IOException

parseFrom(byte[] data)

publicstaticGenerateContentResponse.UsageMetadataparseFrom(byte[]data)
Parameter
Name Description
data byte[]
Returns
Type Description
GenerateContentResponse.UsageMetadata
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

publicstaticGenerateContentResponse.UsageMetadataparseFrom(byte[]data,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentResponse.UsageMetadata
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

publicstaticGenerateContentResponse.UsageMetadataparseFrom(ByteStringdata)
Parameter
Name Description
data ByteString
Returns
Type Description
GenerateContentResponse.UsageMetadata
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

publicstaticGenerateContentResponse.UsageMetadataparseFrom(ByteStringdata,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentResponse.UsageMetadata
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

publicstaticGenerateContentResponse.UsageMetadataparseFrom(CodedInputStreaminput)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
GenerateContentResponse.UsageMetadata
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

publicstaticGenerateContentResponse.UsageMetadataparseFrom(CodedInputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentResponse.UsageMetadata
Exceptions
Type Description
IOException

parseFrom(InputStream input)

publicstaticGenerateContentResponse.UsageMetadataparseFrom(InputStreaminput)
Parameter
Name Description
input InputStream
Returns
Type Description
GenerateContentResponse.UsageMetadata
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

publicstaticGenerateContentResponse.UsageMetadataparseFrom(InputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentResponse.UsageMetadata
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

publicstaticGenerateContentResponse.UsageMetadataparseFrom(ByteBufferdata)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
GenerateContentResponse.UsageMetadata
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

publicstaticGenerateContentResponse.UsageMetadataparseFrom(ByteBufferdata,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentResponse.UsageMetadata
Exceptions
Type Description
InvalidProtocolBufferException

parser()

publicstaticParser<GenerateContentResponse.UsageMetadata>parser()
Returns
Type Description
Parser<UsageMetadata>

Methods

equals(Object obj)

publicbooleanequals(Objectobj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getCacheTokensDetails(int index)

publicModalityTokenCountgetCacheTokensDetails(intindex)

Output only. List of modalities of the cached content in the request input.

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

Parameter
Name Description
index int
Returns
Type Description
ModalityTokenCount

getCacheTokensDetailsCount()

publicintgetCacheTokensDetailsCount()

Output only. List of modalities of the cached content in the request input.

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

Returns
Type Description
int

getCacheTokensDetailsList()

publicList<ModalityTokenCount>getCacheTokensDetailsList()

Output only. List of modalities of the cached content in the request input.

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

Returns
Type Description
List<ModalityTokenCount>

getCacheTokensDetailsOrBuilder(int index)

publicModalityTokenCountOrBuildergetCacheTokensDetailsOrBuilder(intindex)

Output only. List of modalities of the cached content in the request input.

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

Parameter
Name Description
index int
Returns
Type Description
ModalityTokenCountOrBuilder

getCacheTokensDetailsOrBuilderList()

publicList<?extendsModalityTokenCountOrBuilder>getCacheTokensDetailsOrBuilderList()

Output only. List of modalities of the cached content in the request input.

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

Returns
Type Description
List<? extends com.google.cloud.vertexai.api.ModalityTokenCountOrBuilder>

getCachedContentTokenCount()

publicintgetCachedContentTokenCount()

Output only. Number of tokens in the cached part in the input (the cached content).

int32 cached_content_token_count = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
int

The cachedContentTokenCount.

getCandidatesTokenCount()

publicintgetCandidatesTokenCount()

Number of tokens in the response(s).

int32 candidates_token_count = 2;

Returns
Type Description
int

The candidatesTokenCount.

getCandidatesTokensDetails(int index)

publicModalityTokenCountgetCandidatesTokensDetails(intindex)

Output only. List of modalities that were returned in the response.

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

Parameter
Name Description
index int
Returns
Type Description
ModalityTokenCount

getCandidatesTokensDetailsCount()

publicintgetCandidatesTokensDetailsCount()

Output only. List of modalities that were returned in the response.

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

Returns
Type Description
int

getCandidatesTokensDetailsList()

publicList<ModalityTokenCount>getCandidatesTokensDetailsList()

Output only. List of modalities that were returned in the response.

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

Returns
Type Description
List<ModalityTokenCount>

getCandidatesTokensDetailsOrBuilder(int index)

publicModalityTokenCountOrBuildergetCandidatesTokensDetailsOrBuilder(intindex)

Output only. List of modalities that were returned in the response.

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

Parameter
Name Description
index int
Returns
Type Description
ModalityTokenCountOrBuilder

getCandidatesTokensDetailsOrBuilderList()

publicList<?extendsModalityTokenCountOrBuilder>getCandidatesTokensDetailsOrBuilderList()

Output only. List of modalities that were returned in the response.

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

Returns
Type Description
List<? extends com.google.cloud.vertexai.api.ModalityTokenCountOrBuilder>

getDefaultInstanceForType()

publicGenerateContentResponse.UsageMetadatagetDefaultInstanceForType()
Returns
Type Description
GenerateContentResponse.UsageMetadata

getParserForType()

publicParser<GenerateContentResponse.UsageMetadata>getParserForType()
Returns
Type Description
Parser<UsageMetadata>
Overrides

getPromptTokenCount()

publicintgetPromptTokenCount()

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.

int32 prompt_token_count = 1;

Returns
Type Description
int

The promptTokenCount.

getPromptTokensDetails(int index)

publicModalityTokenCountgetPromptTokensDetails(intindex)

Output only. List of modalities that were processed in the request input.

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

Parameter
Name Description
index int
Returns
Type Description
ModalityTokenCount

getPromptTokensDetailsCount()

publicintgetPromptTokensDetailsCount()

Output only. List of modalities that were processed in the request input.

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

Returns
Type Description
int

getPromptTokensDetailsList()

publicList<ModalityTokenCount>getPromptTokensDetailsList()

Output only. List of modalities that were processed in the request input.

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

Returns
Type Description
List<ModalityTokenCount>

getPromptTokensDetailsOrBuilder(int index)

publicModalityTokenCountOrBuildergetPromptTokensDetailsOrBuilder(intindex)

Output only. List of modalities that were processed in the request input.

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

Parameter
Name Description
index int
Returns
Type Description
ModalityTokenCountOrBuilder

getPromptTokensDetailsOrBuilderList()

publicList<?extendsModalityTokenCountOrBuilder>getPromptTokensDetailsOrBuilderList()

Output only. List of modalities that were processed in the request input.

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

Returns
Type Description
List<? extends com.google.cloud.vertexai.api.ModalityTokenCountOrBuilder>

getSerializedSize()

publicintgetSerializedSize()
Returns
Type Description
int
Overrides

getTotalTokenCount()

publicintgetTotalTokenCount()

Total token count for prompt and response candidates.

int32 total_token_count = 3;

Returns
Type Description
int

The totalTokenCount.

hashCode()

publicinthashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protectedGeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

publicfinalbooleanisInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

publicGenerateContentResponse.UsageMetadata.BuildernewBuilderForType()
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protectedGenerateContentResponse.UsageMetadata.BuildernewBuilderForType(GeneratedMessageV3.BuilderParentparent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protectedObjectnewInstance(GeneratedMessageV3.UnusedPrivateParameterunused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

publicGenerateContentResponse.UsageMetadata.BuildertoBuilder()
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

writeTo(CodedOutputStream output)

publicvoidwriteTo(CodedOutputStreamoutput)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年11月19日 UTC.