Class GenerateContentResponse.UsageMetadata.Builder (1.30.0)

publicstaticfinalclass GenerateContentResponse.UsageMetadata.BuilderextendsGeneratedMessageV3.Builder<GenerateContentResponse.UsageMetadata.Builder>implementsGenerateContentResponse.UsageMetadataOrBuilder

Usage metadata about response(s).

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

Inherited Members

com.google.protobuf.GeneratedMessageV3.Builder.getUnknownFieldSetBuilder()
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMapFieldReflection(int)
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMutableMapFieldReflection(int)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownLengthDelimitedField(int,com.google.protobuf.ByteString)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownVarintField(int,int)
com.google.protobuf.GeneratedMessageV3.Builder.parseUnknownField(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite,int)
com.google.protobuf.GeneratedMessageV3.Builder.setUnknownFieldSetBuilder(com.google.protobuf.UnknownFieldSet.Builder)

Static Methods

getDescriptor()

publicstaticfinalDescriptors.DescriptorgetDescriptor()
Returns
Type Description
Descriptor

Methods

addAllCacheTokensDetails(Iterable<? extends ModalityTokenCount> values)

publicGenerateContentResponse.UsageMetadata.BuilderaddAllCacheTokensDetails(Iterable<?extendsModalityTokenCount>values)

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
values Iterable<? extends com.google.cloud.vertexai.api.ModalityTokenCount>
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

addAllCandidatesTokensDetails(Iterable<? extends ModalityTokenCount> values)

publicGenerateContentResponse.UsageMetadata.BuilderaddAllCandidatesTokensDetails(Iterable<?extendsModalityTokenCount>values)

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
values Iterable<? extends com.google.cloud.vertexai.api.ModalityTokenCount>
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

addAllPromptTokensDetails(Iterable<? extends ModalityTokenCount> values)

publicGenerateContentResponse.UsageMetadata.BuilderaddAllPromptTokensDetails(Iterable<?extendsModalityTokenCount>values)

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
values Iterable<? extends com.google.cloud.vertexai.api.ModalityTokenCount>
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

addCacheTokensDetails(ModalityTokenCount value)

publicGenerateContentResponse.UsageMetadata.BuilderaddCacheTokensDetails(ModalityTokenCountvalue)

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
value ModalityTokenCount
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

addCacheTokensDetails(ModalityTokenCount.Builder builderForValue)

publicGenerateContentResponse.UsageMetadata.BuilderaddCacheTokensDetails(ModalityTokenCount.BuilderbuilderForValue)

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
builderForValue ModalityTokenCount.Builder
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

addCacheTokensDetails(int index, ModalityTokenCount value)

publicGenerateContentResponse.UsageMetadata.BuilderaddCacheTokensDetails(intindex,ModalityTokenCountvalue)

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

Parameters
Name Description
index int
value ModalityTokenCount
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

addCacheTokensDetails(int index, ModalityTokenCount.Builder builderForValue)

publicGenerateContentResponse.UsageMetadata.BuilderaddCacheTokensDetails(intindex,ModalityTokenCount.BuilderbuilderForValue)

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

Parameters
Name Description
index int
builderForValue ModalityTokenCount.Builder
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

addCacheTokensDetailsBuilder()

publicModalityTokenCount.BuilderaddCacheTokensDetailsBuilder()

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
ModalityTokenCount.Builder

addCacheTokensDetailsBuilder(int index)

publicModalityTokenCount.BuilderaddCacheTokensDetailsBuilder(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.Builder

addCandidatesTokensDetails(ModalityTokenCount value)

publicGenerateContentResponse.UsageMetadata.BuilderaddCandidatesTokensDetails(ModalityTokenCountvalue)

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
value ModalityTokenCount
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

addCandidatesTokensDetails(ModalityTokenCount.Builder builderForValue)

publicGenerateContentResponse.UsageMetadata.BuilderaddCandidatesTokensDetails(ModalityTokenCount.BuilderbuilderForValue)

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
builderForValue ModalityTokenCount.Builder
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

addCandidatesTokensDetails(int index, ModalityTokenCount value)

publicGenerateContentResponse.UsageMetadata.BuilderaddCandidatesTokensDetails(intindex,ModalityTokenCountvalue)

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

Parameters
Name Description
index int
value ModalityTokenCount
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

addCandidatesTokensDetails(int index, ModalityTokenCount.Builder builderForValue)

publicGenerateContentResponse.UsageMetadata.BuilderaddCandidatesTokensDetails(intindex,ModalityTokenCount.BuilderbuilderForValue)

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

Parameters
Name Description
index int
builderForValue ModalityTokenCount.Builder
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

addCandidatesTokensDetailsBuilder()

publicModalityTokenCount.BuilderaddCandidatesTokensDetailsBuilder()

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
ModalityTokenCount.Builder

addCandidatesTokensDetailsBuilder(int index)

publicModalityTokenCount.BuilderaddCandidatesTokensDetailsBuilder(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.Builder

addPromptTokensDetails(ModalityTokenCount value)

publicGenerateContentResponse.UsageMetadata.BuilderaddPromptTokensDetails(ModalityTokenCountvalue)

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
value ModalityTokenCount
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

addPromptTokensDetails(ModalityTokenCount.Builder builderForValue)

publicGenerateContentResponse.UsageMetadata.BuilderaddPromptTokensDetails(ModalityTokenCount.BuilderbuilderForValue)

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
builderForValue ModalityTokenCount.Builder
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

addPromptTokensDetails(int index, ModalityTokenCount value)

publicGenerateContentResponse.UsageMetadata.BuilderaddPromptTokensDetails(intindex,ModalityTokenCountvalue)

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

Parameters
Name Description
index int
value ModalityTokenCount
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

addPromptTokensDetails(int index, ModalityTokenCount.Builder builderForValue)

publicGenerateContentResponse.UsageMetadata.BuilderaddPromptTokensDetails(intindex,ModalityTokenCount.BuilderbuilderForValue)

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

Parameters
Name Description
index int
builderForValue ModalityTokenCount.Builder
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

addPromptTokensDetailsBuilder()

publicModalityTokenCount.BuilderaddPromptTokensDetailsBuilder()

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
ModalityTokenCount.Builder

addPromptTokensDetailsBuilder(int index)

publicModalityTokenCount.BuilderaddPromptTokensDetailsBuilder(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.Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

publicGenerateContentResponse.UsageMetadata.BuilderaddRepeatedField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

build()

publicGenerateContentResponse.UsageMetadatabuild()
Returns
Type Description
GenerateContentResponse.UsageMetadata

buildPartial()

publicGenerateContentResponse.UsageMetadatabuildPartial()
Returns
Type Description
GenerateContentResponse.UsageMetadata

clear()

publicGenerateContentResponse.UsageMetadata.Builderclear()
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

clearCacheTokensDetails()

publicGenerateContentResponse.UsageMetadata.BuilderclearCacheTokensDetails()

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
GenerateContentResponse.UsageMetadata.Builder

clearCachedContentTokenCount()

publicGenerateContentResponse.UsageMetadata.BuilderclearCachedContentTokenCount()

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
GenerateContentResponse.UsageMetadata.Builder

This builder for chaining.

clearCandidatesTokenCount()

publicGenerateContentResponse.UsageMetadata.BuilderclearCandidatesTokenCount()

Number of tokens in the response(s).

int32 candidates_token_count = 2;

Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

This builder for chaining.

clearCandidatesTokensDetails()

publicGenerateContentResponse.UsageMetadata.BuilderclearCandidatesTokensDetails()

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
GenerateContentResponse.UsageMetadata.Builder

clearField(Descriptors.FieldDescriptor field)

publicGenerateContentResponse.UsageMetadata.BuilderclearField(Descriptors.FieldDescriptorfield)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

clearOneof(Descriptors.OneofDescriptor oneof)

publicGenerateContentResponse.UsageMetadata.BuilderclearOneof(Descriptors.OneofDescriptoroneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

clearPromptTokenCount()

publicGenerateContentResponse.UsageMetadata.BuilderclearPromptTokenCount()

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
GenerateContentResponse.UsageMetadata.Builder

This builder for chaining.

clearPromptTokensDetails()

publicGenerateContentResponse.UsageMetadata.BuilderclearPromptTokensDetails()

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
GenerateContentResponse.UsageMetadata.Builder

clearTotalTokenCount()

publicGenerateContentResponse.UsageMetadata.BuilderclearTotalTokenCount()

Total token count for prompt and response candidates.

int32 total_token_count = 3;

Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

This builder for chaining.

clone()

publicGenerateContentResponse.UsageMetadata.Builderclone()
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
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

getCacheTokensDetailsBuilder(int index)

publicModalityTokenCount.BuildergetCacheTokensDetailsBuilder(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.Builder

getCacheTokensDetailsBuilderList()

publicList<ModalityTokenCount.Builder>getCacheTokensDetailsBuilderList()

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<Builder>

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

getCandidatesTokensDetailsBuilder(int index)

publicModalityTokenCount.BuildergetCandidatesTokensDetailsBuilder(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.Builder

getCandidatesTokensDetailsBuilderList()

publicList<ModalityTokenCount.Builder>getCandidatesTokensDetailsBuilderList()

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<Builder>

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

getDescriptorForType()

publicDescriptors.DescriptorgetDescriptorForType()
Returns
Type Description
Descriptor
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

getPromptTokensDetailsBuilder(int index)

publicModalityTokenCount.BuildergetPromptTokensDetailsBuilder(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.Builder

getPromptTokensDetailsBuilderList()

publicList<ModalityTokenCount.Builder>getPromptTokensDetailsBuilderList()

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<Builder>

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>

getTotalTokenCount()

publicintgetTotalTokenCount()

Total token count for prompt and response candidates.

int32 total_token_count = 3;

Returns
Type Description
int

The totalTokenCount.

internalGetFieldAccessorTable()

protectedGeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

publicfinalbooleanisInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(GenerateContentResponse.UsageMetadata other)

publicGenerateContentResponse.UsageMetadata.BuildermergeFrom(GenerateContentResponse.UsageMetadataother)
Parameter
Name Description
other GenerateContentResponse.UsageMetadata
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

publicGenerateContentResponse.UsageMetadata.BuildermergeFrom(CodedInputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

publicGenerateContentResponse.UsageMetadata.BuildermergeFrom(Messageother)
Parameter
Name Description
other Message
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

publicfinalGenerateContentResponse.UsageMetadata.BuildermergeUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

removeCacheTokensDetails(int index)

publicGenerateContentResponse.UsageMetadata.BuilderremoveCacheTokensDetails(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
GenerateContentResponse.UsageMetadata.Builder

removeCandidatesTokensDetails(int index)

publicGenerateContentResponse.UsageMetadata.BuilderremoveCandidatesTokensDetails(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
GenerateContentResponse.UsageMetadata.Builder

removePromptTokensDetails(int index)

publicGenerateContentResponse.UsageMetadata.BuilderremovePromptTokensDetails(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
GenerateContentResponse.UsageMetadata.Builder

setCacheTokensDetails(int index, ModalityTokenCount value)

publicGenerateContentResponse.UsageMetadata.BuildersetCacheTokensDetails(intindex,ModalityTokenCountvalue)

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

Parameters
Name Description
index int
value ModalityTokenCount
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

setCacheTokensDetails(int index, ModalityTokenCount.Builder builderForValue)

publicGenerateContentResponse.UsageMetadata.BuildersetCacheTokensDetails(intindex,ModalityTokenCount.BuilderbuilderForValue)

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

Parameters
Name Description
index int
builderForValue ModalityTokenCount.Builder
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

setCachedContentTokenCount(int value)

publicGenerateContentResponse.UsageMetadata.BuildersetCachedContentTokenCount(intvalue)

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

Parameter
Name Description
value int

The cachedContentTokenCount to set.

Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

This builder for chaining.

setCandidatesTokenCount(int value)

publicGenerateContentResponse.UsageMetadata.BuildersetCandidatesTokenCount(intvalue)

Number of tokens in the response(s).

int32 candidates_token_count = 2;

Parameter
Name Description
value int

The candidatesTokenCount to set.

Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

This builder for chaining.

setCandidatesTokensDetails(int index, ModalityTokenCount value)

publicGenerateContentResponse.UsageMetadata.BuildersetCandidatesTokensDetails(intindex,ModalityTokenCountvalue)

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

Parameters
Name Description
index int
value ModalityTokenCount
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

setCandidatesTokensDetails(int index, ModalityTokenCount.Builder builderForValue)

publicGenerateContentResponse.UsageMetadata.BuildersetCandidatesTokensDetails(intindex,ModalityTokenCount.BuilderbuilderForValue)

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

Parameters
Name Description
index int
builderForValue ModalityTokenCount.Builder
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

setField(Descriptors.FieldDescriptor field, Object value)

publicGenerateContentResponse.UsageMetadata.BuildersetField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

setPromptTokenCount(int value)

publicGenerateContentResponse.UsageMetadata.BuildersetPromptTokenCount(intvalue)

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;

Parameter
Name Description
value int

The promptTokenCount to set.

Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

This builder for chaining.

setPromptTokensDetails(int index, ModalityTokenCount value)

publicGenerateContentResponse.UsageMetadata.BuildersetPromptTokensDetails(intindex,ModalityTokenCountvalue)

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

Parameters
Name Description
index int
value ModalityTokenCount
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

setPromptTokensDetails(int index, ModalityTokenCount.Builder builderForValue)

publicGenerateContentResponse.UsageMetadata.BuildersetPromptTokensDetails(intindex,ModalityTokenCount.BuilderbuilderForValue)

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

Parameters
Name Description
index int
builderForValue ModalityTokenCount.Builder
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

publicGenerateContentResponse.UsageMetadata.BuildersetRepeatedField(Descriptors.FieldDescriptorfield,intindex,Objectvalue)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

setTotalTokenCount(int value)

publicGenerateContentResponse.UsageMetadata.BuildersetTotalTokenCount(intvalue)

Total token count for prompt and response candidates.

int32 total_token_count = 3;

Parameter
Name Description
value int

The totalTokenCount to set.

Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

publicfinalGenerateContentResponse.UsageMetadata.BuildersetUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

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.