Class GenerateContentRequest (1.8.0)

publicfinalclass GenerateContentRequestextendsGeneratedMessageV3implementsGenerateContentRequestOrBuilder

Request message for [PredictionService.GenerateContent].

Protobuf type google.cloud.vertexai.v1.GenerateContentRequest

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

CONTENTS_FIELD_NUMBER

publicstaticfinalintCONTENTS_FIELD_NUMBER
Field Value
Type Description
int

GENERATION_CONFIG_FIELD_NUMBER

publicstaticfinalintGENERATION_CONFIG_FIELD_NUMBER
Field Value
Type Description
int

MODEL_FIELD_NUMBER

publicstaticfinalintMODEL_FIELD_NUMBER
Field Value
Type Description
int

SAFETY_SETTINGS_FIELD_NUMBER

publicstaticfinalintSAFETY_SETTINGS_FIELD_NUMBER
Field Value
Type Description
int

SYSTEM_INSTRUCTION_FIELD_NUMBER

publicstaticfinalintSYSTEM_INSTRUCTION_FIELD_NUMBER
Field Value
Type Description
int

TOOLS_FIELD_NUMBER

publicstaticfinalintTOOLS_FIELD_NUMBER
Field Value
Type Description
int

TOOL_CONFIG_FIELD_NUMBER

publicstaticfinalintTOOL_CONFIG_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

publicstaticGenerateContentRequestgetDefaultInstance()
Returns
Type Description
GenerateContentRequest

getDescriptor()

publicstaticfinalDescriptors.DescriptorgetDescriptor()
Returns
Type Description
Descriptor

newBuilder()

publicstaticGenerateContentRequest.BuildernewBuilder()
Returns
Type Description
GenerateContentRequest.Builder

newBuilder(GenerateContentRequest prototype)

publicstaticGenerateContentRequest.BuildernewBuilder(GenerateContentRequestprototype)
Parameter
Name Description
prototype GenerateContentRequest
Returns
Type Description
GenerateContentRequest.Builder

parseDelimitedFrom(InputStream input)

publicstaticGenerateContentRequestparseDelimitedFrom(InputStreaminput)
Parameter
Name Description
input InputStream
Returns
Type Description
GenerateContentRequest
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

publicstaticGenerateContentRequestparseDelimitedFrom(InputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentRequest
Exceptions
Type Description
IOException

parseFrom(byte[] data)

publicstaticGenerateContentRequestparseFrom(byte[]data)
Parameter
Name Description
data byte[]
Returns
Type Description
GenerateContentRequest
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

publicstaticGenerateContentRequestparseFrom(byte[]data,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentRequest
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

publicstaticGenerateContentRequestparseFrom(ByteStringdata)
Parameter
Name Description
data ByteString
Returns
Type Description
GenerateContentRequest
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

publicstaticGenerateContentRequestparseFrom(ByteStringdata,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentRequest
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

publicstaticGenerateContentRequestparseFrom(CodedInputStreaminput)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
GenerateContentRequest
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

publicstaticGenerateContentRequestparseFrom(CodedInputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentRequest
Exceptions
Type Description
IOException

parseFrom(InputStream input)

publicstaticGenerateContentRequestparseFrom(InputStreaminput)
Parameter
Name Description
input InputStream
Returns
Type Description
GenerateContentRequest
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

publicstaticGenerateContentRequestparseFrom(InputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentRequest
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

publicstaticGenerateContentRequestparseFrom(ByteBufferdata)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
GenerateContentRequest
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

publicstaticGenerateContentRequestparseFrom(ByteBufferdata,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentRequest
Exceptions
Type Description
InvalidProtocolBufferException

parser()

publicstaticParser<GenerateContentRequest>parser()
Returns
Type Description
Parser<GenerateContentRequest>

Methods

equals(Object obj)

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

getContents(int index)

publicContentgetContents(intindex)

Required. The content of the current conversation with the model.

For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request.

repeated .google.cloud.vertexai.v1.Content contents = 2 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
index int
Returns
Type Description
Content

getContentsCount()

publicintgetContentsCount()

Required. The content of the current conversation with the model.

For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request.

repeated .google.cloud.vertexai.v1.Content contents = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
int

getContentsList()

publicList<Content>getContentsList()

Required. The content of the current conversation with the model.

For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request.

repeated .google.cloud.vertexai.v1.Content contents = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
List<Content>

getContentsOrBuilder(int index)

publicContentOrBuildergetContentsOrBuilder(intindex)

Required. The content of the current conversation with the model.

For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request.

repeated .google.cloud.vertexai.v1.Content contents = 2 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
index int
Returns
Type Description
ContentOrBuilder

getContentsOrBuilderList()

publicList<?extendsContentOrBuilder>getContentsOrBuilderList()

Required. The content of the current conversation with the model.

For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request.

repeated .google.cloud.vertexai.v1.Content contents = 2 [(.google.api.field_behavior) = REQUIRED];

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

getDefaultInstanceForType()

publicGenerateContentRequestgetDefaultInstanceForType()
Returns
Type Description
GenerateContentRequest

getGenerationConfig()

publicGenerationConfiggetGenerationConfig()

Optional. Generation config.

.google.cloud.vertexai.v1.GenerationConfig generation_config = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
GenerationConfig

The generationConfig.

getGenerationConfigOrBuilder()

publicGenerationConfigOrBuildergetGenerationConfigOrBuilder()

Optional. Generation config.

.google.cloud.vertexai.v1.GenerationConfig generation_config = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
GenerationConfigOrBuilder

getModel()

publicStringgetModel()

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

string model = 5 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
String

The model.

getModelBytes()

publicByteStringgetModelBytes()

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

string model = 5 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
ByteString

The bytes for model.

getParserForType()

publicParser<GenerateContentRequest>getParserForType()
Returns
Type Description
Parser<GenerateContentRequest>
Overrides

getSafetySettings(int index)

publicSafetySettinggetSafetySettings(intindex)

Optional. Per request settings for blocking unsafe content. Enforced on GenerateContentResponse.candidates.

repeated .google.cloud.vertexai.v1.SafetySetting safety_settings = 3 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
SafetySetting

getSafetySettingsCount()

publicintgetSafetySettingsCount()

Optional. Per request settings for blocking unsafe content. Enforced on GenerateContentResponse.candidates.

repeated .google.cloud.vertexai.v1.SafetySetting safety_settings = 3 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

getSafetySettingsList()

publicList<SafetySetting>getSafetySettingsList()

Optional. Per request settings for blocking unsafe content. Enforced on GenerateContentResponse.candidates.

repeated .google.cloud.vertexai.v1.SafetySetting safety_settings = 3 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<SafetySetting>

getSafetySettingsOrBuilder(int index)

publicSafetySettingOrBuildergetSafetySettingsOrBuilder(intindex)

Optional. Per request settings for blocking unsafe content. Enforced on GenerateContentResponse.candidates.

repeated .google.cloud.vertexai.v1.SafetySetting safety_settings = 3 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
SafetySettingOrBuilder

getSafetySettingsOrBuilderList()

publicList<?extendsSafetySettingOrBuilder>getSafetySettingsOrBuilderList()

Optional. Per request settings for blocking unsafe content. Enforced on GenerateContentResponse.candidates.

repeated .google.cloud.vertexai.v1.SafetySetting safety_settings = 3 [(.google.api.field_behavior) = OPTIONAL];

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

getSerializedSize()

publicintgetSerializedSize()
Returns
Type Description
int
Overrides

getSystemInstruction()

publicContentgetSystemInstruction()

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.vertexai.v1.Content system_instruction = 8 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Content

The systemInstruction.

getSystemInstructionOrBuilder()

publicContentOrBuildergetSystemInstructionOrBuilder()

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.vertexai.v1.Content system_instruction = 8 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ContentOrBuilder

getToolConfig()

publicToolConfiggetToolConfig()

Optional. Tool config. This config is shared for all tools provided in the request.

.google.cloud.vertexai.v1.ToolConfig tool_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ToolConfig

The toolConfig.

getToolConfigOrBuilder()

publicToolConfigOrBuildergetToolConfigOrBuilder()

Optional. Tool config. This config is shared for all tools provided in the request.

.google.cloud.vertexai.v1.ToolConfig tool_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ToolConfigOrBuilder

getTools(int index)

publicToolgetTools(intindex)

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.vertexai.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
Tool

getToolsCount()

publicintgetToolsCount()

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.vertexai.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

getToolsList()

publicList<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.vertexai.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<Tool>

getToolsOrBuilder(int index)

publicToolOrBuildergetToolsOrBuilder(intindex)

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.vertexai.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
ToolOrBuilder

getToolsOrBuilderList()

publicList<?extendsToolOrBuilder>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.vertexai.v1.Tool tools = 6 [(.google.api.field_behavior) = OPTIONAL];

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

hasGenerationConfig()

publicbooleanhasGenerationConfig()

Optional. Generation config.

.google.cloud.vertexai.v1.GenerationConfig generation_config = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the generationConfig field is set.

hasSystemInstruction()

publicbooleanhasSystemInstruction()

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.vertexai.v1.Content system_instruction = 8 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the systemInstruction field is set.

hasToolConfig()

publicbooleanhasToolConfig()

Optional. Tool config. This config is shared for all tools provided in the request.

.google.cloud.vertexai.v1.ToolConfig tool_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the toolConfig field is set.

hashCode()

publicinthashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protectedGeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

publicfinalbooleanisInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

publicGenerateContentRequest.BuildernewBuilderForType()
Returns
Type Description
GenerateContentRequest.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protectedGenerateContentRequest.BuildernewBuilderForType(GeneratedMessageV3.BuilderParentparent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
GenerateContentRequest.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

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

toBuilder()

publicGenerateContentRequest.BuildertoBuilder()
Returns
Type Description
GenerateContentRequest.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.