Get models API

You can use this API to get the metadata of the latest version of all the models stored in MLz.

HTTP method and URI path

GET /v3/ml_assets/models

Standard headers

Use the following standard HTTP header with this request:

Content-Type: application/json

Authorization: <Bearer token>

Required authorizations

The user ID associated with the token which is specified in the request header needs to be granted with one of the following roles:

  • sysadm
  • mladm
  • apiuser (only if the model was created by the user)
  • devuser (only if the model was created by the user)

Query parameter

Table 1. Query parameter for the Get models API

In this table, the Parameter column lists the query parameters; the Type column lists the data type for the parameter, the Required or optional column indicates whether the parameter is required or optional for this request; and the Description column provides a brief description of the parameter.

Parameter Type Required or optional Description
modelName String Optional Model name for filtering from the response for all of the models. Specify this query parameter if you expect to get the model of which the name is modelName from all of the models.

Expected response

On completion, the service returns an HTTP response, which includes a status code that indicates whether your request is completed. Status code 200 indicates a successful completion. A status code of 4nn or 5nn indicates an error.

The response is a resources:{models_array} array which contains the metadata information of all the models returned. Each element of the array carries the information of a model with fields described in Table 2.
Table 2. Response from a successful request

In this table, the Field column and Subfield columns list the returned fields, and the Description column provides a brief description of the field.

Field Subfield Description
entity name The name of the model.
author

The author of the model creation.

name: The name of the author of the model.

description The description of the model.
model_url The URL of the model which contains the model ID.
framework

The framework used to create the model. The framework includes the framework’s name, version, and runtimes.

  • name – String for Required

    Framework name for the model. Supported frameworks: mllib, ml, pmml, scikit-learn, xgboost, scikit-learn-pmml, xgboost-pmml, arima and sarimax.

  • version

    Framework version for the specified framework. Supported versions:

    • 3.4.x or 3.5.x for ML or MLlib
    • 1.2.x or 1.3.x for scikit-learn
    • 0.72.x for scikit-learn-pmml
    • 1.7.x for xgboost
    • 0.9.x for xgboost-pmml
    • 1.15.x or 1.16.x for onnx
    • 0.14.x for arima or sarimax

    No restriction for other supported frameworks.

  • runtimes – Array[RuntimeInfo] for Optional

    This runtimes array specifies the runtime list that a model uses for training. For each RuntimeInfo, it consists of:

    • name (required for String): runtime name for model training. Supported runtime names: spark, python, java.
    • version (required for String): runtime version for model training. Supported runtime versions:
      • 4.0 for spark, mainly for mllib framework.
      • 3.13 for python, mainly for scikit-learn or xgboost model framework.
      • 17 or 21 for java, mainly for pmml or onnx framework.
        • customName (optional for String):The customized runtime name.
        • _id (optional for String): the customized runtime ID.
  • zaiu (boolean): Indicates if the model is eligible for scoring using IBM® z16™ on-chip AI accelerator. This flag is returned for ONNX models only.
  • telum2 (boolean): Indicates if the model is eligible for scoring using the IBM z17™ on-chip AI accelerator. This flag is returned for ONNX models only.
training_definition_url Training definition created for this model. It is only for Spark runtime model.
versionSeq The version sequence number of the latest version of the returned model.
model_type The value is standard. It means that the model was created from standard MLz’s API.
label_column The label column for the model.
prediction_column The prediction column for the model.
probability_column The probability column for the model.
model_version

The latest model version’s partial important information.

  • content_url: the model’s content URL for this latest version of the model. The content_url can be used to fetch the model’s content.
  • evaluation_metrics_url: The evaluation metrics URL for this latest version of the model. The evaluation_metrics_url can be used to fetch the evaluation metrics of the latest version of the model if the model has evaluation history.
  • guid: The ID of this latest version of the model.
  • url: the latest model version URL of the model. It contains the model ID and latest model version ID.
  • version_status: the status of this latest version of the model. It contains the version state and failure.
  • size: the cost number of model training. It contains the model_in_memory, peak_os_memory, and peak_heap_memory factors.
training_info

The training info for this model.

  • projectId (optional for String): project ID if you need to save the project where the model was trained in your application.
  • originType (optional for String): the type of training runtime for the model trained. For example, the notebook. This value depends on user’s training platform self-definition.
  • originId (optional for String): the training toolkit identifier for the model trained. For example, the notebook ID. This value depends on user’s training platform self-definition.
metadata guid The model ID.
created_at The creation timestamp for this model.
modified_at The timestamp of the last modification of the model.
url The URL of this model which contains the model ID.
Response example of a successful request:
{
resources: [{
"entity": {
"prediction_column": "prediction",
        "author": {
            "name": "mlz01"
        },
        "name": "tentModel_local_reference",
        "model_url": "https://127.0.0.1:11443/v3/ml_assets/models/f76b157f-0826-4d29-83f2-5dd48de3736d",
        "training_definition_url": "https://127.0.0.1:11443/v3/ml_assets/training_definitions/36e1c170-3738-434d-9f6a-979e0b1e1aee/versions/00ba1825-588a-4cae-9a79-07235617b8ac",
        "description": "Tent Model",
        "label_column": "label",
        "framework": {
            "name": "mllib",
            "version": "4.0",
            "runtimes": [
                {
                    "name": "spark",
                    "version": "4.0"
                }
        },
        "probability_column": "probability",
        "training_info": {
            "evaluation": {
                "next_fire_time": "",
                "status": "UNINITIALIZED"
            },
            "originId": "",
            "originType": "",
            "projectId": ""
        },
        "model_version": {
            "content_status": {
                "state": "no_content"
            },
            "content_url": "https://127.0.0.1:11443/v3/ml_assets/models/f76b157f-0826-4d29-83f2-5dd48de3736d/versions/3358f92f-2bd6-41f0-8df1-833cc39e0b78/content",
            "evaluation_metrics_url": "https://127.0.0.1:11443/v3/ml_assets/models/f76b157f-0826-4d29-83f2-5dd48de3736d/versions/3358f92f-2bd6-41f0-8df1-833cc39e0b78/evaluation_metrics",
            "guid": "3358f92f-2bd6-41f0-8df1-833cc39e0b78",
            "size": {
                "model_in_memory": 189937
            },
            "url": "https://127.0.0.1:11443/v3/ml_assets/models/f76b157f-0826-4d29-83f2-5dd48de3736d/versions/3358f92f-2bd6-41f0-8df1-833cc39e0b78"
        },
        "model_type": "standard",
        "versionSeq": 1
    },
    "metadata": {
        "created_at": "2022-11-14T08:01:38.965Z",
        "guid": "f76b157f-0826-4d29-83f2-5dd48de3736d",
        "model_status": [],
        "modified_at": "2022-11-14T08:01:38.965Z",
        "url": "https://127.0.0.1:11443/v3/ml_assets/models/f76b157f-0826-4d29-83f2-5dd48de3736d"
    }
}]
}