Class GenerateContentResponse.UsageMetadata.Builder (3.56.0)

public static final class GenerateContentResponse.UsageMetadata.Builder extends GeneratedMessageV3.Builder<GenerateContentResponse.UsageMetadata.Builder> implements GenerateContentResponse.UsageMetadataOrBuilder

Usage metadata about response(s).

Protobuf type google.cloud.aiplatform.v1beta1.GenerateContentResponse.UsageMetadata

Static Methods

getDescriptor()

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

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public GenerateContentResponse.UsageMetadata.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

build()

public GenerateContentResponse.UsageMetadata build()
Returns
Type Description
GenerateContentResponse.UsageMetadata

buildPartial()

public GenerateContentResponse.UsageMetadata buildPartial()
Returns
Type Description
GenerateContentResponse.UsageMetadata

clear()

public GenerateContentResponse.UsageMetadata.Builder clear()
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

clearCachedContentTokenCount()

public GenerateContentResponse.UsageMetadata.Builder clearCachedContentTokenCount()

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()

public GenerateContentResponse.UsageMetadata.Builder clearCandidatesTokenCount()

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)

public GenerateContentResponse.UsageMetadata.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

clearOneof(Descriptors.OneofDescriptor oneof)

public GenerateContentResponse.UsageMetadata.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

clearPromptTokenCount()

public GenerateContentResponse.UsageMetadata.Builder clearPromptTokenCount()

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.

clearTotalTokenCount()

public GenerateContentResponse.UsageMetadata.Builder clearTotalTokenCount()

Total token count for prompt and response candidates.

int32 total_token_count = 3;

Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

This builder for chaining.

clone()

public GenerateContentResponse.UsageMetadata.Builder clone()
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

getCachedContentTokenCount()

public int getCachedContentTokenCount()

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()

public int getCandidatesTokenCount()

Number of tokens in the response(s).

int32 candidates_token_count = 2;

Returns
Type Description
int

The candidatesTokenCount.

getDefaultInstanceForType()

public GenerateContentResponse.UsageMetadata getDefaultInstanceForType()
Returns
Type Description
GenerateContentResponse.UsageMetadata

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getPromptTokenCount()

public int getPromptTokenCount()

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.

getTotalTokenCount()

public int getTotalTokenCount()

Total token count for prompt and response candidates.

int32 total_token_count = 3;

Returns
Type Description
int

The totalTokenCount.

internalGetFieldAccessorTable()

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

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(GenerateContentResponse.UsageMetadata other)

public GenerateContentResponse.UsageMetadata.Builder mergeFrom(GenerateContentResponse.UsageMetadata other)
Parameter
Name Description
other GenerateContentResponse.UsageMetadata
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public GenerateContentResponse.UsageMetadata.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public GenerateContentResponse.UsageMetadata.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final GenerateContentResponse.UsageMetadata.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

setCachedContentTokenCount(int value)

public GenerateContentResponse.UsageMetadata.Builder setCachedContentTokenCount(int value)

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)

public GenerateContentResponse.UsageMetadata.Builder setCandidatesTokenCount(int value)

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)

public GenerateContentResponse.UsageMetadata.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

setPromptTokenCount(int value)

public GenerateContentResponse.UsageMetadata.Builder setPromptTokenCount(int value)

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.

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

public GenerateContentResponse.UsageMetadata.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides

setTotalTokenCount(int value)

public GenerateContentResponse.UsageMetadata.Builder setTotalTokenCount(int value)

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)

public final GenerateContentResponse.UsageMetadata.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder
Overrides