class_docstr: Class for interacting with CAIP Prediction service.
class_docstr_tok: ["Class","for","interacting","with","CAIP","Prediction","service","."]
docstr: Creates a new model for serving with AI Platform if not exists.
  
  Args:
    labels: The dict of labels that will be attached to this job.
    ai_platform_serving_args: Dictionary containing arguments for pushing to
      AI Platform.
  
  Returns:
    Whether a new model is created.
  
  Raises:
    RuntimeError if model creation failed.
docstr_tok: ["Creates","a","new","model","for","serving","with","AI","Platform","if","not","exists",".","Args",":","labels",":","The","dict","of","labels","that","will","be","attached","to","this","job",".","ai_platform_serving_args",":","Dictionary","containing","arguments","for","pushing","to","AI","Platform",".","Returns",":","Whether","a","new","model","is","created",".","Raises",":","RuntimeError","if","model","creation","failed","."]
code: def create_model_for_aip_prediction_if_not_exist(
      self,
      labels: Dict[str, str],
      ai_platform_serving_args: Dict[str, Any],
  ) -> bool:
      """Creates a new model for serving with AI Platform if not exists.
  
      Args:
        labels: The dict of labels that will be attached to this job.
        ai_platform_serving_args: Dictionary containing arguments for pushing to
          AI Platform.
  
      Returns:
        Whether a new model is created.
  
      Raises:
        RuntimeError if model creation failed.
      """
      model_name = ai_platform_serving_args["model_name"]
      project_id = ai_platform_serving_args["project_id"]
      regions = ai_platform_serving_args.get("regions", [])
      body = {"name": model_name, "regions": regions, "labels": labels}
      parent = "projects/{}".format(project_id)
      result = True
      try:
          self._client.projects().models().create(
              body=body, parent=parent
          ).execute()
      except errors.HttpError as e:
          # If the error is to create an already existing model, it's ok to ignore.
          if e.resp.status == 409:
              logging.warn("Model %s already exists", model_name)
              result = False
          else:
              raise RuntimeError(
                  "Creating model to AI Platform failed: {}".format(e)
              )
      return result
  
imports: import abc
  import sys
  import time
  from typing import Any, Dict, Optional, Union
  from absl import logging
  from google.cloud import aiplatform
  from googleapiclient import discovery
  from googleapiclient import errors
  import tensorflow
label_desc: Use image node_id 3 for calling the CAIPTfxPredictionClient obj's underlying member method code with example usage: obj.create_model_for_aip_prediction_if_not_exist(labels, ai_platform_serving_args) and returns: result