@Generated public final class GenerateContentRequest extends com.google.protobuf.GeneratedMessage implements GenerateContentRequestOrBuilder
Request message for [PredictionService.GenerateContent].Protobuf type
google.cloud.aiplatform.v1.GenerateContentRequest| Modifier and Type | Class and Description |
|---|---|
static class |
GenerateContentRequest.Builder
Request message for [PredictionService.GenerateContent].
|
com.google.protobuf.GeneratedMessage.ExtendableBuilder<MessageT extends com.google.protobuf.GeneratedMessage.ExtendableMessage<MessageT>,BuilderT extends com.google.protobuf.GeneratedMessage.ExtendableBuilder<MessageT,BuilderT>>, com.google.protobuf.GeneratedMessage.ExtendableMessage<MessageT extends com.google.protobuf.GeneratedMessage.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessage.ExtendableMessageOrBuilder<MessageT extends com.google.protobuf.GeneratedMessage.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessage.FieldAccessorTable, com.google.protobuf.GeneratedMessage.GeneratedExtension<ContainingT extends com.google.protobuf.Message,T>, com.google.protobuf.GeneratedMessage.UnusedPrivateParameter| Modifier and Type | Field and Description |
|---|---|
static int |
CACHED_CONTENT_FIELD_NUMBER |
static int |
CONTENTS_FIELD_NUMBER |
static int |
GENERATION_CONFIG_FIELD_NUMBER |
static int |
LABELS_FIELD_NUMBER |
static int |
MODEL_ARMOR_CONFIG_FIELD_NUMBER |
static int |
MODEL_FIELD_NUMBER |
static int |
SAFETY_SETTINGS_FIELD_NUMBER |
static int |
SYSTEM_INSTRUCTION_FIELD_NUMBER |
static int |
TOOL_CONFIG_FIELD_NUMBER |
static int |
TOOLS_FIELD_NUMBER |
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, internalGetMapField, isStringEmpty, makeExtensionsImmutable, makeMutableCopy, makeMutableCopy, mergeFromAndMakeImmutableInternal, newFileScopedGeneratedExtension, newInstance, newMessageScopedGeneratedExtension, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTagfindInitializationErrors, getInitializationErrorString, hashFields, toStringaddAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final int MODEL_FIELD_NUMBER
public static final int CONTENTS_FIELD_NUMBER
public static final int SYSTEM_INSTRUCTION_FIELD_NUMBER
public static final int CACHED_CONTENT_FIELD_NUMBER
public static final int TOOLS_FIELD_NUMBER
public static final int TOOL_CONFIG_FIELD_NUMBER
public static final int LABELS_FIELD_NUMBER
public static final int SAFETY_SETTINGS_FIELD_NUMBER
public static final int MODEL_ARMOR_CONFIG_FIELD_NUMBER
public static final int GENERATION_CONFIG_FIELD_NUMBER
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection(int number)
internalGetMapFieldReflection in class com.google.protobuf.GeneratedMessageprotected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessagepublic String getModel()
Required. The fully qualified name of the publisher model or tuned model
endpoint to use.
Publisher model format:
`projects/{project}/locations/{location}/publishers/*/models/*`
Tuned model endpoint format:
`projects/{project}/locations/{location}/endpoints/{endpoint}`
string model = 5 [(.google.api.field_behavior) = REQUIRED];getModel in interface GenerateContentRequestOrBuilderpublic com.google.protobuf.ByteString getModelBytes()
Required. The fully qualified name of the publisher model or tuned model
endpoint to use.
Publisher model format:
`projects/{project}/locations/{location}/publishers/*/models/*`
Tuned model endpoint format:
`projects/{project}/locations/{location}/endpoints/{endpoint}`
string model = 5 [(.google.api.field_behavior) = REQUIRED];getModelBytes in interface GenerateContentRequestOrBuilderpublic List<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.aiplatform.v1.Content contents = 2 [(.google.api.field_behavior) = REQUIRED];
getContentsList in interface GenerateContentRequestOrBuilderpublic List<? extends ContentOrBuilder> 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.aiplatform.v1.Content contents = 2 [(.google.api.field_behavior) = REQUIRED];
getContentsOrBuilderList in interface GenerateContentRequestOrBuilderpublic int getContentsCount()
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.aiplatform.v1.Content contents = 2 [(.google.api.field_behavior) = REQUIRED];
getContentsCount in interface GenerateContentRequestOrBuilderpublic Content getContents(int index)
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.aiplatform.v1.Content contents = 2 [(.google.api.field_behavior) = REQUIRED];
getContents in interface GenerateContentRequestOrBuilderpublic ContentOrBuilder getContentsOrBuilder(int index)
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.aiplatform.v1.Content contents = 2 [(.google.api.field_behavior) = REQUIRED];
getContentsOrBuilder in interface GenerateContentRequestOrBuilderpublic 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 = 8 [(.google.api.field_behavior) = OPTIONAL];
hasSystemInstruction in interface GenerateContentRequestOrBuilderpublic 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 = 8 [(.google.api.field_behavior) = OPTIONAL];
getSystemInstruction in interface GenerateContentRequestOrBuilderpublic 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 = 8 [(.google.api.field_behavior) = OPTIONAL];
getSystemInstructionOrBuilder in interface GenerateContentRequestOrBuilderpublic String getCachedContent()
Optional. The name of the cached content used as context to serve the
prediction. Note: only used in explicit caching, where users can have
control over caching (e.g. what content to cache) and enjoy guaranteed cost
savings. Format:
`projects/{project}/locations/{location}/cachedContents/{cachedContent}`
string cached_content = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
getCachedContent in interface GenerateContentRequestOrBuilderpublic com.google.protobuf.ByteString getCachedContentBytes()
Optional. The name of the cached content used as context to serve the
prediction. Note: only used in explicit caching, where users can have
control over caching (e.g. what content to cache) and enjoy guaranteed cost
savings. Format:
`projects/{project}/locations/{location}/cachedContents/{cachedContent}`
string cached_content = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
getCachedContentBytes in interface GenerateContentRequestOrBuilderpublic 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];
getToolsList in interface GenerateContentRequestOrBuilderpublic 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];
getToolsOrBuilderList in interface GenerateContentRequestOrBuilderpublic 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];
getToolsCount in interface GenerateContentRequestOrBuilderpublic 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];
getTools in interface GenerateContentRequestOrBuilderpublic 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];
getToolsOrBuilder in interface GenerateContentRequestOrBuilderpublic boolean hasToolConfig()
Optional. Tool config. This config is shared for all tools provided in the request.
.google.cloud.aiplatform.v1.ToolConfig tool_config = 7 [(.google.api.field_behavior) = OPTIONAL];
hasToolConfig in interface GenerateContentRequestOrBuilderpublic ToolConfig getToolConfig()
Optional. Tool config. This config is shared for all tools provided in the request.
.google.cloud.aiplatform.v1.ToolConfig tool_config = 7 [(.google.api.field_behavior) = OPTIONAL];
getToolConfig in interface GenerateContentRequestOrBuilderpublic ToolConfigOrBuilder getToolConfigOrBuilder()
Optional. Tool config. This config is shared for all tools provided in the request.
.google.cloud.aiplatform.v1.ToolConfig tool_config = 7 [(.google.api.field_behavior) = OPTIONAL];
getToolConfigOrBuilder in interface GenerateContentRequestOrBuilderpublic int getLabelsCount()
GenerateContentRequestOrBuilderOptional. The labels with user-defined metadata for the request. It is used for billing and reporting only. Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.
map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL];getLabelsCount in interface GenerateContentRequestOrBuilderpublic boolean containsLabels(String key)
Optional. The labels with user-defined metadata for the request. It is used for billing and reporting only. Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.
map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL];containsLabels in interface GenerateContentRequestOrBuilder@Deprecated public Map<String,String> getLabels()
getLabelsMap() instead.getLabels in interface GenerateContentRequestOrBuilderpublic Map<String,String> getLabelsMap()
Optional. The labels with user-defined metadata for the request. It is used for billing and reporting only. Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.
map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL];getLabelsMap in interface GenerateContentRequestOrBuilderpublic String getLabelsOrDefault(String key, String defaultValue)
Optional. The labels with user-defined metadata for the request. It is used for billing and reporting only. Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.
map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL];getLabelsOrDefault in interface GenerateContentRequestOrBuilderpublic String getLabelsOrThrow(String key)
Optional. The labels with user-defined metadata for the request. It is used for billing and reporting only. Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.
map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL];getLabelsOrThrow in interface GenerateContentRequestOrBuilderpublic List<SafetySetting> getSafetySettingsList()
Optional. Per request settings for blocking unsafe content. Enforced on GenerateContentResponse.candidates.
repeated .google.cloud.aiplatform.v1.SafetySetting safety_settings = 3 [(.google.api.field_behavior) = OPTIONAL];
getSafetySettingsList in interface GenerateContentRequestOrBuilderpublic List<? extends SafetySettingOrBuilder> getSafetySettingsOrBuilderList()
Optional. Per request settings for blocking unsafe content. Enforced on GenerateContentResponse.candidates.
repeated .google.cloud.aiplatform.v1.SafetySetting safety_settings = 3 [(.google.api.field_behavior) = OPTIONAL];
getSafetySettingsOrBuilderList in interface GenerateContentRequestOrBuilderpublic int getSafetySettingsCount()
Optional. Per request settings for blocking unsafe content. Enforced on GenerateContentResponse.candidates.
repeated .google.cloud.aiplatform.v1.SafetySetting safety_settings = 3 [(.google.api.field_behavior) = OPTIONAL];
getSafetySettingsCount in interface GenerateContentRequestOrBuilderpublic SafetySetting getSafetySettings(int index)
Optional. Per request settings for blocking unsafe content. Enforced on GenerateContentResponse.candidates.
repeated .google.cloud.aiplatform.v1.SafetySetting safety_settings = 3 [(.google.api.field_behavior) = OPTIONAL];
getSafetySettings in interface GenerateContentRequestOrBuilderpublic SafetySettingOrBuilder getSafetySettingsOrBuilder(int index)
Optional. Per request settings for blocking unsafe content. Enforced on GenerateContentResponse.candidates.
repeated .google.cloud.aiplatform.v1.SafetySetting safety_settings = 3 [(.google.api.field_behavior) = OPTIONAL];
getSafetySettingsOrBuilder in interface GenerateContentRequestOrBuilderpublic boolean hasModelArmorConfig()
Optional. Settings for prompt and response sanitization using the Model Armor service. If supplied, safety_settings must not be supplied.
.google.cloud.aiplatform.v1.ModelArmorConfig model_armor_config = 11 [(.google.api.field_behavior) = OPTIONAL];
hasModelArmorConfig in interface GenerateContentRequestOrBuilderpublic ModelArmorConfig getModelArmorConfig()
Optional. Settings for prompt and response sanitization using the Model Armor service. If supplied, safety_settings must not be supplied.
.google.cloud.aiplatform.v1.ModelArmorConfig model_armor_config = 11 [(.google.api.field_behavior) = OPTIONAL];
getModelArmorConfig in interface GenerateContentRequestOrBuilderpublic ModelArmorConfigOrBuilder getModelArmorConfigOrBuilder()
Optional. Settings for prompt and response sanitization using the Model Armor service. If supplied, safety_settings must not be supplied.
.google.cloud.aiplatform.v1.ModelArmorConfig model_armor_config = 11 [(.google.api.field_behavior) = OPTIONAL];
getModelArmorConfigOrBuilder in interface GenerateContentRequestOrBuilderpublic boolean hasGenerationConfig()
Optional. Generation config.
.google.cloud.aiplatform.v1.GenerationConfig generation_config = 4 [(.google.api.field_behavior) = OPTIONAL];
hasGenerationConfig in interface GenerateContentRequestOrBuilderpublic GenerationConfig getGenerationConfig()
Optional. Generation config.
.google.cloud.aiplatform.v1.GenerationConfig generation_config = 4 [(.google.api.field_behavior) = OPTIONAL];
getGenerationConfig in interface GenerateContentRequestOrBuilderpublic GenerationConfigOrBuilder getGenerationConfigOrBuilder()
Optional. Generation config.
.google.cloud.aiplatform.v1.GenerationConfig generation_config = 4 [(.google.api.field_behavior) = OPTIONAL];
getGenerationConfigOrBuilder in interface GenerateContentRequestOrBuilderpublic final boolean isInitialized()
isInitialized in interface com.google.protobuf.MessageLiteOrBuilderisInitialized in class com.google.protobuf.GeneratedMessagepublic void writeTo(com.google.protobuf.CodedOutputStream output)
throws IOException
writeTo in interface com.google.protobuf.MessageLitewriteTo in class com.google.protobuf.GeneratedMessageIOExceptionpublic int getSerializedSize()
getSerializedSize in interface com.google.protobuf.MessageLitegetSerializedSize in class com.google.protobuf.GeneratedMessagepublic boolean equals(Object obj)
equals in interface com.google.protobuf.Messageequals in class com.google.protobuf.AbstractMessagepublic int hashCode()
hashCode in interface com.google.protobuf.MessagehashCode in class com.google.protobuf.AbstractMessagepublic static GenerateContentRequest parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static GenerateContentRequest parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static GenerateContentRequest parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static GenerateContentRequest parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static GenerateContentRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static GenerateContentRequest parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static GenerateContentRequest parseFrom(InputStream input) throws IOException
IOExceptionpublic static GenerateContentRequest parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic static GenerateContentRequest parseDelimitedFrom(InputStream input) throws IOException
IOExceptionpublic static GenerateContentRequest parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic static GenerateContentRequest parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
IOExceptionpublic static GenerateContentRequest parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic GenerateContentRequest.Builder newBuilderForType()
newBuilderForType in interface com.google.protobuf.MessagenewBuilderForType in interface com.google.protobuf.MessageLitepublic static GenerateContentRequest.Builder newBuilder()
public static GenerateContentRequest.Builder newBuilder(GenerateContentRequest prototype)
public GenerateContentRequest.Builder toBuilder()
toBuilder in interface com.google.protobuf.MessagetoBuilder in interface com.google.protobuf.MessageLiteprotected GenerateContentRequest.Builder newBuilderForType(com.google.protobuf.AbstractMessage.BuilderParent parent)
newBuilderForType in class com.google.protobuf.AbstractMessagepublic static GenerateContentRequest getDefaultInstance()
public static com.google.protobuf.Parser<GenerateContentRequest> parser()
public com.google.protobuf.Parser<GenerateContentRequest> getParserForType()
getParserForType in interface com.google.protobuf.MessagegetParserForType in interface com.google.protobuf.MessageLitegetParserForType in class com.google.protobuf.GeneratedMessagepublic GenerateContentRequest getDefaultInstanceForType()
getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuildergetDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilderCopyright © 2026 Google LLC. All rights reserved.