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

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

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.

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.

int32 prompt_token_count = 1;

Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

This builder for chaining.

clearTotalTokenCount()

publicGenerateContentResponse.UsageMetadata.BuilderclearTotalTokenCount()

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

getCandidatesTokenCount()

publicintgetCandidatesTokenCount()

Number of tokens in the response(s).

int32 candidates_token_count = 2;

Returns
Type Description
int

The candidatesTokenCount.

getDefaultInstanceForType()

publicGenerateContentResponse.UsageMetadatagetDefaultInstanceForType()
Returns
Type Description
GenerateContentResponse.UsageMetadata

getDescriptorForType()

publicDescriptors.DescriptorgetDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getPromptTokenCount()

publicintgetPromptTokenCount()

Number of tokens in the request.

int32 prompt_token_count = 1;

Returns
Type Description
int

The promptTokenCount.

getTotalTokenCount()

publicintgetTotalTokenCount()

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

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.

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.

int32 prompt_token_count = 1;

Parameter
Name Description
value int

The promptTokenCount to set.

Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

This builder for chaining.

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)

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.