private static String reconcileModelName(String modelName) {
    for (String prefix : Constants.MODEL_NAME_PREFIXES) {
      if (modelName.startsWith(prefix)) {
        modelName = modelName.substring(modelName.lastIndexOf('/') + 1);
        break;
      }
    }
    return modelName;
  }
Keeps the model name only, if users specify the resource name, and returns the model name.
java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/GenerativeModel.java