public GenerativeModel withGenerationConfig(GenerationConfig generationConfig) {
    checkNotNull(generationConfig, "GenerationConfig can't be null.");
    return new GenerativeModel(
        modelName,
        generationConfig,
        safetySettings,
        tools,
        toolConfig,
        systemInstruction,
        vertexAi);
  }
Creates a copy of the current model with updated GenerationConfig.

@param generationConfig a {@link com.google.cloud.vertexai.api.GenerationConfig} that will be
    used in the new model.
@return a new {@link GenerativeModel} instance with the specified GenerationConfig.
java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/GenerativeModel.java