Creating a Model Endpoint using API

You can select a specific Cloudera AI Inference service instance and a model version from Cloudera AI Registry to create a new model endpoint.

  1. Retrieve a registered model's model ID and model version.

    This information is available in the Registered Models page in the Cloudera AI control plane UI.

  2. Create the model specification for the selected model.
    # cat ./examples/mlflow/model-spec-cml-registry.json
    

    The following is an example output:

    {
      "namespace": "serving-default",
      "name": "mlflow-wine-test-from-registry-onnx",
      "source": {
        "registry_source": {
          "version": 2, 
          "model_id": "3azn-tmqe-wsze-5u4s"
        }
      }
    }
    export DOMAIN=$(cdp ml describe-ml-serving-app --app-crn [***app-crn***] | jq -r '.app.cluster.domainName')
    In case you want to deploy a model from a remote Cloudera AI Registry, that is from a registry from another environment, pass the registry_id as in this example:
    {
    "namespace": "serving-default",
    "name": "mlflow-wine-test-from-registry-onnx",
    "source": {
    "registry_source": {
    "model_id": "3azn-tmqe-wsze-5u4s",
    "version": 2,
    "registry_id": ""
    }
    }
    }
  3. Create the model endpoint by using the following Cloudera AI Inference service deployEndpoint API:
    curl -v  -H "Content-Type: application/json" -H "Authorization: Bearer ${CDP_TOKEN}" "https://${DOMAIN}/api/v1alpha1/deployEndpoint" -d @./examples/mlflow/model-spec-cml-registry.json

    The DOMAIN looks like ml-67814ad5-b79.eng-ml-d.xcu2-8y8x.dev.cldr.work.

    You can retrieve the CDP_TOKEN by performing the steps from Preparing to interact with the Cloudera AI.