Class CountTokensRequest.Builder (3.55.0)

public static final class CountTokensRequest.Builder extends GeneratedMessageV3.Builder<CountTokensRequest.Builder> implements CountTokensRequestOrBuilder

Request message for [PredictionService.CountTokens][].

Protobuf type google.cloud.aiplatform.v1.CountTokensRequest

Static Methods

getDescriptor()

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

Methods

addAllContents(Iterable<? extends Content> values)

public CountTokensRequest.Builder addAllContents(Iterable<? extends Content> values)

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
values Iterable<? extends com.google.cloud.aiplatform.v1.Content>
Returns
Type Description
CountTokensRequest.Builder

addAllInstances(Iterable<? extends Value> values)

public CountTokensRequest.Builder addAllInstances(Iterable<? extends Value> values)

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
values Iterable<? extends com.google.protobuf.Value>
Returns
Type Description
CountTokensRequest.Builder

addAllTools(Iterable<? extends Tool> values)

public CountTokensRequest.Builder addAllTools(Iterable<? extends Tool> values)

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
values Iterable<? extends com.google.cloud.aiplatform.v1.Tool>
Returns
Type Description
CountTokensRequest.Builder

addContents(Content value)

public CountTokensRequest.Builder addContents(Content value)

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value Content
Returns
Type Description
CountTokensRequest.Builder

addContents(Content.Builder builderForValue)

public CountTokensRequest.Builder addContents(Content.Builder builderForValue)

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
builderForValue Content.Builder
Returns
Type Description
CountTokensRequest.Builder

addContents(int index, Content value)

public CountTokensRequest.Builder addContents(int index, Content value)

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
value Content
Returns
Type Description
CountTokensRequest.Builder

addContents(int index, Content.Builder builderForValue)

public CountTokensRequest.Builder addContents(int index, Content.Builder builderForValue)

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
builderForValue Content.Builder
Returns
Type Description
CountTokensRequest.Builder

addContentsBuilder()

public Content.Builder addContentsBuilder()

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Content.Builder

addContentsBuilder(int index)

public Content.Builder addContentsBuilder(int index)

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
Content.Builder

addInstances(Value value)

public CountTokensRequest.Builder addInstances(Value value)

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value Value
Returns
Type Description
CountTokensRequest.Builder

addInstances(Value.Builder builderForValue)

public CountTokensRequest.Builder addInstances(Value.Builder builderForValue)

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
builderForValue Builder
Returns
Type Description
CountTokensRequest.Builder

addInstances(int index, Value value)

public CountTokensRequest.Builder addInstances(int index, Value value)

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
value Value
Returns
Type Description
CountTokensRequest.Builder

addInstances(int index, Value.Builder builderForValue)

public CountTokensRequest.Builder addInstances(int index, Value.Builder builderForValue)

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
builderForValue Builder
Returns
Type Description
CountTokensRequest.Builder

addInstancesBuilder()

public Value.Builder addInstancesBuilder()

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Builder

addInstancesBuilder(int index)

public Value.Builder addInstancesBuilder(int index)

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

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

addTools(Tool value)

public CountTokensRequest.Builder addTools(Tool value)

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value Tool
Returns
Type Description
CountTokensRequest.Builder

addTools(Tool.Builder builderForValue)

public CountTokensRequest.Builder addTools(Tool.Builder builderForValue)

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
builderForValue Tool.Builder
Returns
Type Description
CountTokensRequest.Builder

addTools(int index, Tool value)

public CountTokensRequest.Builder addTools(int index, Tool value)

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
value Tool
Returns
Type Description
CountTokensRequest.Builder

addTools(int index, Tool.Builder builderForValue)

public CountTokensRequest.Builder addTools(int index, Tool.Builder builderForValue)

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
builderForValue Tool.Builder
Returns
Type Description
CountTokensRequest.Builder

addToolsBuilder()

public Tool.Builder addToolsBuilder()

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Tool.Builder

addToolsBuilder(int index)

public Tool.Builder addToolsBuilder(int index)

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
Tool.Builder

build()

public CountTokensRequest build()
Returns
Type Description
CountTokensRequest

buildPartial()

public CountTokensRequest buildPartial()
Returns
Type Description
CountTokensRequest

clear()

public CountTokensRequest.Builder clear()
Returns
Type Description
CountTokensRequest.Builder
Overrides

clearContents()

public CountTokensRequest.Builder clearContents()

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
CountTokensRequest.Builder

clearEndpoint()

public CountTokensRequest.Builder clearEndpoint()

Required. The name of the Endpoint requested to perform token counting. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }

Returns
Type Description
CountTokensRequest.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

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

clearGenerationConfig()

public CountTokensRequest.Builder clearGenerationConfig()

Optional. Generation config that the model will use to generate the response.

optional .google.cloud.aiplatform.v1.GenerationConfig generation_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
CountTokensRequest.Builder

clearInstances()

public CountTokensRequest.Builder clearInstances()

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
CountTokensRequest.Builder

clearModel()

public CountTokensRequest.Builder clearModel()

Optional. The name of the publisher model requested to serve the prediction. Format: projects/{project}/locations/{location}/publishers/*/models/*

string model = 3 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
CountTokensRequest.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

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

clearSystemInstruction()

public CountTokensRequest.Builder clearSystemInstruction()

Optional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.

optional .google.cloud.aiplatform.v1.Content system_instruction = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
CountTokensRequest.Builder

clearTools()

public CountTokensRequest.Builder clearTools()

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
CountTokensRequest.Builder

clone()

public CountTokensRequest.Builder clone()
Returns
Type Description
CountTokensRequest.Builder
Overrides

getContents(int index)

public Content getContents(int index)

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
Content

getContentsBuilder(int index)

public Content.Builder getContentsBuilder(int index)

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
Content.Builder

getContentsBuilderList()

public List<Content.Builder> getContentsBuilderList()

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<Builder>

getContentsCount()

public int getContentsCount()

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

getContentsList()

public List<Content> getContentsList()

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<Content>

getContentsOrBuilder(int index)

public ContentOrBuilder getContentsOrBuilder(int index)

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
ContentOrBuilder

getContentsOrBuilderList()

public List<? extends ContentOrBuilder> getContentsOrBuilderList()

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<? extends com.google.cloud.aiplatform.v1.ContentOrBuilder>

getDefaultInstanceForType()

public CountTokensRequest getDefaultInstanceForType()
Returns
Type Description
CountTokensRequest

getDescriptorForType()

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

getEndpoint()

public String getEndpoint()

Required. The name of the Endpoint requested to perform token counting. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }

Returns
Type Description
String

The endpoint.

getEndpointBytes()

public ByteString getEndpointBytes()

Required. The name of the Endpoint requested to perform token counting. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }

Returns
Type Description
ByteString

The bytes for endpoint.

getGenerationConfig()

public GenerationConfig getGenerationConfig()

Optional. Generation config that the model will use to generate the response.

optional .google.cloud.aiplatform.v1.GenerationConfig generation_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
GenerationConfig

The generationConfig.

getGenerationConfigBuilder()

public GenerationConfig.Builder getGenerationConfigBuilder()

Optional. Generation config that the model will use to generate the response.

optional .google.cloud.aiplatform.v1.GenerationConfig generation_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
GenerationConfig.Builder

getGenerationConfigOrBuilder()

public GenerationConfigOrBuilder getGenerationConfigOrBuilder()

Optional. Generation config that the model will use to generate the response.

optional .google.cloud.aiplatform.v1.GenerationConfig generation_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
GenerationConfigOrBuilder

getInstances(int index)

public Value getInstances(int index)

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
Value

getInstancesBuilder(int index)

public Value.Builder getInstancesBuilder(int index)

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
Builder

getInstancesBuilderList()

public List<Value.Builder> getInstancesBuilderList()

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<Builder>

getInstancesCount()

public int getInstancesCount()

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

getInstancesList()

public List<Value> getInstancesList()

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<Value>

getInstancesOrBuilder(int index)

public ValueOrBuilder getInstancesOrBuilder(int index)

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
ValueOrBuilder

getInstancesOrBuilderList()

public List<? extends ValueOrBuilder> getInstancesOrBuilderList()

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<? extends com.google.protobuf.ValueOrBuilder>

getModel()

public String getModel()

Optional. The name of the publisher model requested to serve the prediction. Format: projects/{project}/locations/{location}/publishers/*/models/*

string model = 3 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
String

The model.

getModelBytes()

public ByteString getModelBytes()

Optional. The name of the publisher model requested to serve the prediction. Format: projects/{project}/locations/{location}/publishers/*/models/*

string model = 3 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ByteString

The bytes for model.

getSystemInstruction()

public Content getSystemInstruction()

Optional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.

optional .google.cloud.aiplatform.v1.Content system_instruction = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Content

The systemInstruction.

getSystemInstructionBuilder()

public Content.Builder getSystemInstructionBuilder()

Optional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.

optional .google.cloud.aiplatform.v1.Content system_instruction = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Content.Builder

getSystemInstructionOrBuilder()

public ContentOrBuilder getSystemInstructionOrBuilder()

Optional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.

optional .google.cloud.aiplatform.v1.Content system_instruction = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ContentOrBuilder

getTools(int index)

public Tool getTools(int index)

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
Tool

getToolsBuilder(int index)

public Tool.Builder getToolsBuilder(int index)

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
Tool.Builder

getToolsBuilderList()

public List<Tool.Builder> getToolsBuilderList()

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<Builder>

getToolsCount()

public int getToolsCount()

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

getToolsList()

public List<Tool> getToolsList()

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<Tool>

getToolsOrBuilder(int index)

public ToolOrBuilder getToolsOrBuilder(int index)

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
ToolOrBuilder

getToolsOrBuilderList()

public List<? extends ToolOrBuilder> getToolsOrBuilderList()

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<? extends com.google.cloud.aiplatform.v1.ToolOrBuilder>

hasGenerationConfig()

public boolean hasGenerationConfig()

Optional. Generation config that the model will use to generate the response.

optional .google.cloud.aiplatform.v1.GenerationConfig generation_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the generationConfig field is set.

hasSystemInstruction()

public boolean hasSystemInstruction()

Optional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.

optional .google.cloud.aiplatform.v1.Content system_instruction = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the systemInstruction field is set.

internalGetFieldAccessorTable()

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

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(CountTokensRequest other)

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

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

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

mergeGenerationConfig(GenerationConfig value)

public CountTokensRequest.Builder mergeGenerationConfig(GenerationConfig value)

Optional. Generation config that the model will use to generate the response.

optional .google.cloud.aiplatform.v1.GenerationConfig generation_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value GenerationConfig
Returns
Type Description
CountTokensRequest.Builder

mergeSystemInstruction(Content value)

public CountTokensRequest.Builder mergeSystemInstruction(Content value)

Optional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.

optional .google.cloud.aiplatform.v1.Content system_instruction = 5 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value Content
Returns
Type Description
CountTokensRequest.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

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

removeContents(int index)

public CountTokensRequest.Builder removeContents(int index)

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
CountTokensRequest.Builder

removeInstances(int index)

public CountTokensRequest.Builder removeInstances(int index)

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
CountTokensRequest.Builder

removeTools(int index)

public CountTokensRequest.Builder removeTools(int index)

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
CountTokensRequest.Builder

setContents(int index, Content value)

public CountTokensRequest.Builder setContents(int index, Content value)

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
value Content
Returns
Type Description
CountTokensRequest.Builder

setContents(int index, Content.Builder builderForValue)

public CountTokensRequest.Builder setContents(int index, Content.Builder builderForValue)

Optional. Input content.

repeated .google.cloud.aiplatform.v1.Content contents = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
builderForValue Content.Builder
Returns
Type Description
CountTokensRequest.Builder

setEndpoint(String value)

public CountTokensRequest.Builder setEndpoint(String value)

Required. The name of the Endpoint requested to perform token counting. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }

Parameter
Name Description
value String

The endpoint to set.

Returns
Type Description
CountTokensRequest.Builder

This builder for chaining.

setEndpointBytes(ByteString value)

public CountTokensRequest.Builder setEndpointBytes(ByteString value)

Required. The name of the Endpoint requested to perform token counting. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }

Parameter
Name Description
value ByteString

The bytes for endpoint to set.

Returns
Type Description
CountTokensRequest.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

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

setGenerationConfig(GenerationConfig value)

public CountTokensRequest.Builder setGenerationConfig(GenerationConfig value)

Optional. Generation config that the model will use to generate the response.

optional .google.cloud.aiplatform.v1.GenerationConfig generation_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value GenerationConfig
Returns
Type Description
CountTokensRequest.Builder

setGenerationConfig(GenerationConfig.Builder builderForValue)

public CountTokensRequest.Builder setGenerationConfig(GenerationConfig.Builder builderForValue)

Optional. Generation config that the model will use to generate the response.

optional .google.cloud.aiplatform.v1.GenerationConfig generation_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
builderForValue GenerationConfig.Builder
Returns
Type Description
CountTokensRequest.Builder

setInstances(int index, Value value)

public CountTokensRequest.Builder setInstances(int index, Value value)

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
value Value
Returns
Type Description
CountTokensRequest.Builder

setInstances(int index, Value.Builder builderForValue)

public CountTokensRequest.Builder setInstances(int index, Value.Builder builderForValue)

Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.

repeated .google.protobuf.Value instances = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
builderForValue Builder
Returns
Type Description
CountTokensRequest.Builder

setModel(String value)

public CountTokensRequest.Builder setModel(String value)

Optional. The name of the publisher model requested to serve the prediction. Format: projects/{project}/locations/{location}/publishers/*/models/*

string model = 3 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value String

The model to set.

Returns
Type Description
CountTokensRequest.Builder

This builder for chaining.

setModelBytes(ByteString value)

public CountTokensRequest.Builder setModelBytes(ByteString value)

Optional. The name of the publisher model requested to serve the prediction. Format: projects/{project}/locations/{location}/publishers/*/models/*

string model = 3 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value ByteString

The bytes for model to set.

Returns
Type Description
CountTokensRequest.Builder

This builder for chaining.

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

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

setSystemInstruction(Content value)

public CountTokensRequest.Builder setSystemInstruction(Content value)

Optional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.

optional .google.cloud.aiplatform.v1.Content system_instruction = 5 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value Content
Returns
Type Description
CountTokensRequest.Builder

setSystemInstruction(Content.Builder builderForValue)

public CountTokensRequest.Builder setSystemInstruction(Content.Builder builderForValue)

Optional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.

optional .google.cloud.aiplatform.v1.Content system_instruction = 5 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
builderForValue Content.Builder
Returns
Type Description
CountTokensRequest.Builder

setTools(int index, Tool value)

public CountTokensRequest.Builder setTools(int index, Tool value)

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
value Tool
Returns
Type Description
CountTokensRequest.Builder

setTools(int index, Tool.Builder builderForValue)

public CountTokensRequest.Builder setTools(int index, Tool.Builder builderForValue)

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

repeated .google.cloud.aiplatform.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int
builderForValue Tool.Builder
Returns
Type Description
CountTokensRequest.Builder

setUnknownFields(UnknownFieldSet unknownFields)

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