@java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    for (int i = 0; i < contents_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, contents_.get(i));
    }
    for (int i = 0; i < safetySettings_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, safetySettings_.get(i));
    }
    if (((bitField0_ & 0x00000004) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getGenerationConfig());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(model_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, model_);
    }
    for (int i = 0; i < tools_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, tools_.get(i));
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getToolConfig());
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getSystemInstruction());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(cachedContent_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(9, cachedContent_);
    }
    for (java.util.Map.Entry<java.lang.String, java.lang.String> entry :
        internalGetLabels().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.String, java.lang.String> labels__ =
          LabelsDefaultEntryHolder.defaultEntry
              .newBuilderForType()
              .setKey(entry.getKey())
              .setValue(entry.getValue())
              .build();
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(10, labels__);
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }
<pre>
Optional. Generation config.
</pre>

<code>
.google.cloud.vertexai.v1.GenerationConfig generation_config = 4 [(.google.api.field_behavior) = OPTIONAL];
</code>
java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GenerateContentRequest.java