private static Content fromMultiModalDataWithRole(String role, Object... multiModalData) {
    Content.Builder contentBuilder = Content.newBuilder().setRole(role);
    for (Object partData : multiModalData) {
      if (partData instanceof String) {
        String textData = (String) partData;
        contentBuilder.addParts(Part.newBuilder().setText(textData));
      } else if (partData instanceof Part) {
        contentBuilder.addParts((Part) partData);
      } else {
        throw new IllegalArgumentException("Unsupported data type: " + partData.getClass());
      }
    }
    return contentBuilder.build();
  }
Creates a ContentMakerForRole for a given role.

@param role Currently accepted role values are: "user", "model". No need to call forRole for
    the "user" role since it's the default role.
java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ContentMaker.java