class_docstr: Class for interacting with Vertex Prediction service.
class_docstr_tok: ["Class","for","interacting","with","Vertex","Prediction","service","."]
docstr: Creates a new endpoint for serving with AI Platform if not exists.
  
  Args:
    labels: The dict of labels that will be attached to this Vertex endpoint.
    ai_platform_serving_args: Dictionary containing arguments for pushing to
      AI Platform.
  
  Returns:
    The endpoint if it's created, otherwise None.
  
  Raises:
    RuntimeError if endpoint creation failed.
docstr_tok: ["Creates","a","new","endpoint","for","serving","with","AI","Platform","if","not","exists",".","Args",":","labels",":","The","dict","of","labels","that","will","be","attached","to","this","Vertex","endpoint",".","ai_platform_serving_args",":","Dictionary","containing","arguments","for","pushing","to","AI","Platform",".","Returns",":","The","endpoint","if","it","'s","created",",","otherwise","None",".","Raises",":","RuntimeError","if","endpoint","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 endpoint for serving with AI Platform if not exists.
  
      Args:
        labels: The dict of labels that will be attached to this Vertex endpoint.
        ai_platform_serving_args: Dictionary containing arguments for pushing to
          AI Platform.
  
      Returns:
        The endpoint if it's created, otherwise None.
  
      Raises:
        RuntimeError if endpoint creation failed.
      """
      endpoint = None
      endpoint_name = ai_platform_serving_args["endpoint_name"]
      try:
          self._get_endpoint(ai_platform_serving_args)
      except RuntimeError:
          # Endpoint doesn't exist
          endpoint_labels = {
              **ai_platform_serving_args.get("labels", {}),
              **labels,
          }
          try:
              endpoint = aiplatform.Endpoint.create(
                  display_name=endpoint_name, labels=endpoint_labels
              )
          except errors.HttpError as e:
              raise RuntimeError(
                  "Creating endpoint in AI Platform failed."
              ) from e
      else:
          logging.warn("Endpoint %s already exists", endpoint_name)
  
      return endpoint is not None
  
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 2 for calling the VertexPredictionClient 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: unknown