public GenerativeModel withSafetySettings(List<SafetySetting> safetySettings) {
    checkNotNull(
        safetySettings,
        "safetySettings can't be null. Use an empty list if no safety settings is intended.");
    return new GenerativeModel(
        modelName,
        generationConfig,
        ImmutableList.copyOf(safetySettings),
        tools,
        toolConfig,
        systemInstruction,
        vertexAi);
  }
Creates a copy of the current model with updated safetySettings.

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