Obtaining Details About an AI Application¶
Function¶
This API is used to query details about an AI application based on the AI application ID.
URI¶
GET /v1/{project_id}/models/{model_id}
Parameter | Mandatory | Type | Description |
---|---|---|---|
model_id | Yes | String | Model ID, which can be obtained from the response body when an AI application is created. You can also obtain the AI applications owned by the current user by calling the API for querying the AI application list. The model_id field indicates the model ID. |
project_id | Yes | String | Project ID. For details, see Obtaining a Project ID and Name. |
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
X-Auth-Token | Yes | String | User token. It can be obtained by calling the IAM API that is used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Response Parameters¶
Status code: 200
Parameter | Type | Description |
---|---|---|
model_version | String | Model version |
source_job_version | String | Version of the source training job |
source_location | String | OBS path where the model is located or the template address of the SWR image |
source_job_id | String | ID of the source training job |
source_copy | String | Whether to enable image replication. This parameter is valid only when model_type is set to Image.
|
description | String | Model description |
project | String | Project ID of the tenant to which a model belongs |
workspace_id | String | Workspace ID If no workspace is created, the default value is 0. If a workspace is created and used, the actual value prevails. |
model_algorithm | String | Model algorithm type, which can be predict_analysis, object_detection, or image_classification |
model_name | String | Model name |
tenant | String | Account ID of the tenant to which a model belongs |
model_docs | Array of GuideDoc objects | List of template documents |
owner | String | ID of the tenant to which a model belongs |
execution_code | String | OBS path for storing the execution code. The name of the execution code file is consistently to be customize_service.py. |
schema_doc | String | Download address of the model schema file |
image_address | String | Image path generated after model packaging |
output_params | Array of ModelParamsInfo objects | Collection of output parameters of a model |
health | ModelHealth object | Model health check API information. |
runtime | String | Model runtime environment |
model_metrics | String | Model precision |
source_type | String | Model source type. This parameter is valid and its value is auto only if the model is deployed using ExeML. |
model_type | String | Model type. The value is TensorFlow/Image/PyTorch/Template/MindSpore. |
model_id | String | Model ID |
dependencies | Array of ModelDependencies objects | Package required for running the code and model |
model_size | Long | Model size, in bytes |
model_status | String | Model status |
apis | String | All input and output apis parameter information of a model, which is obtained from the model preview |
model_source | String | Model source. Options:
|
tunable | Boolean | Whether a model can be tuned. Options:
|
market_flag | Boolean | Whether a model is subscribed from the marketplace. Options:
|
publishable_flag | Boolean | Whether a model can be published to the marketplace. Options:
|
model_labels | Array of strings | Model label array |
labels_map | Map<String,String> | Model label map. The key is consistently to be labels, and the value is the model label array. |
install_type | Array of strings | Supported service type for deployment |
config | String | Model configurations. Probe configurations include health, readiness_health, and startup_health. |
specification | ModelSpecification object | Minimum specifications for model deployment |
input_params | Array of ModelParamsInfo objects | Collection of input parameters of a model |
create_at | Long | Time when a model is created, in milliseconds calculated from 1970.1.1 0:0:0 UTC. |
cmd | String | Image startup command. |
Parameter | Type | Description |
---|---|---|
doc_url | String | HTTP(S) link of the document |
doc_name | String | Document name, which must start with a letter. |
Parameter | Type | Description |
---|---|---|
protocol | String | Request protocol of the health check API. Only HTTP is supported. |
initial_delay_seconds | String | After an instance is started, a health check starts after the time configured in initial_delay_seconds expires. |
timeout_seconds | String | Health check timeout. |
url | String | URL of a health check API. |
period_seconds | String | Health check period. |
failure_threshold | String | Maximum number of health check failures. |
check_method | String | Health check method, which can be HTTP or EXEC (commands). |
command | String | Commands, which are strings separated by spaces. |
Parameter | Type | Description |
---|---|---|
installer | String | Installation mode. Only pip is supported. |
packages | Array of Packages objects | Collection of dependency packages |
Parameter | Type | Description |
---|---|---|
package_version | String | Version of a dependency package. If this parameter is left blank, the latest version is installed by default. |
package_name | String | Name of a dependency package. Ensure that the package name is correct and available. |
restraint | String | Version restriction. This parameter is mandatory only when package_version exists. The options are as follows:
|
Parameter | Type | Description |
---|---|---|
min_cpu | String | Minimal CPU specifications |
min_gpu | String | Minimal GPU specifications |
min_memory | String | Minimum memory |
Parameter | Type | Description |
---|---|---|
protocol | String | Request protocol, for example, http. |
url | String | API URL |
min | Number | Minimum value of a numeric parameter. |
method | String | Request method, for example, post. |
max | Number | Maximum value of a numeric parameter. |
param_desc | String | Parameter description. |
param_name | String | Parameter name. |
param_type | String | Parameter type. |
Example Requests¶
GET https://{endpoint}/v1/{project_id}/models/{model_id}
Example Responses¶
Status code: 200
Model details
{
"model_id" : "10eb0091-887f-4839-9929-cbc884f1e20e",
"model_name" : "mnist",
"model_version" : "1.0.0",
"runtime" : "python2.7",
"tenant" : "6d28e85aa78b4e1a9b4bd83501bcd4a1",
"project" : "d04c10db1f264cfeb1966deff1a3527c",
"owner" : "6d28e85aa78b4e1a9b4bd83501bcd4a1",
"source_location" : "https://models.obs.xxxxx.com/mnist",
"model_type" : "TensorFlow",
"model_size" : 5633481,
"model_status" : "published",
"execution_code" : "https://testmodel.obs.xxxxx.com/customize_service.py",
"image_address" : "100.125.5.235:20202/models/10eb0091-887f-4839-9929-cbc884f1e20e:1.0.0",
"input_params" : [ {
"url" : "/",
"method" : "post",
"protocol" : "http",
"param_name" : "data",
"param_type" : "object",
"param_desc" : "{\"type\":\"object\",\"properties\":{\"req_data\":{\"items\":[{\"type\":\"object\",\"properties\":{}}],\"type\":\"array\"}}}"
} ],
"output_params" : [ {
"url" : "/",
"method" : "post",
"protocol" : "http",
"param_name" : "data",
"param_type" : "object",
"param_desc" : "{\"type\":\"object\",\"properties\":{\"resp_data\":{\"type\":\"array\",\"items\":[{\"type\":\"object\",\"properties\":{}}]}}}"
} ],
"dependencies" : [ {
"installer" : "pip",
"packages" : [ {
"package_name" : "pkg1",
"package_version" : "1.0.1",
"restraint" : "ATLEAST"
} ]
} ],
"model_metrics" : "{\"f1\":0.52381,\"recall\":0.666667,\"precision\":0.466667,\"accuracy\":0.625}",
"apis" : "[{\"protocol\":\"http\",\"method\":\"post\",\"url\":\"/\",\"input_params\":{\"type\":\"object\",\"properties\":{\"data\":{\"type\":\"object\",\"properties\":{\"req_data\":{\"items\":[{\"type\":\"object\",\"properties\":{}}],\"type\":\"array\"}}}}},\"output_params\":{\"type\":\"object\",\"properties\":{\"data\":{\"type\":\"object\",\"properties\":{\"resp_data\":{\"type\":\"array\",\"items\":[{\"type\":\"object\",\"properties\":{}}]}}}}}}]",
"model_labels" : [ ],
"labels_map" : {
"labels" : [ ]
},
"workspace_id" : "0",
"install_type" : [ "realtime", "batch", "edge" ],
"specification" : { },
"config" : "{\"model_algorithm\":\"image_classification\",\"model_source\":\"auto\",\"tunable\":false,\"downloadable_flag\":true,\"algorithm\":\"resnet_v2_50,mobilenet_v1\",\"metrics\":{\"f1\":0.912078373015873,\"recall\":0.9125,\"precision\":0.9340277777777778,\"accuracy\":0.263250724969475},\"model_type\":\"TensorFlow\",\"runtime\":\"tf1.13-python3.6-cpu\",\"apis\":[{\"protocol\":\"https\",\"url\":\"/\",\"method\":\"post\",\"request\":{\"data\":{\"type\":\"object\",\"properties\":{\"images\":{\"type\":\"file\"}}},\"Content-type\":\"multipart/form-data\"},\"response\":{\"data\":{\"type\":\"object\",\"required\":[\"predicted_label\",\"scores\"],\"properties\":{\"predicted_label\":{\"type\":\"string\"},\"scores\":{\"type\":\"array\",\"items\":{\"type\":\"array\",\"minItems\":2,\"maxItems\":2,\"items\":[{\"type\":\"string\"},{\"type\":\"number\"}]}}}},\"Content-type\":\"multipart/form-data\"}}],\"dependencies\":[{\"installer\":\"pip\",\"packages\":[{\"package_name\":\"numpy\",\"package_version\":\"1.17.0\",\"restraint\":\"EXACT\"},{\"package_name\":\"h5py\",\"package_version\":\"2.8.0\",\"restraint\":\"EXACT\"},{\"package_name\":\"Pillow\",\"package_version\":\"5.2.0\",\"restraint\":\"EXACT\"},{\"package_name\":\"scipy\",\"package_version\":\"1.2.1\",\"restraint\":\"EXACT\"},{\"package_name\":\"resampy\",\"package_version\":\"0.2.1\",\"restraint\":\"EXACT\"},{\"package_name\":\"scikit-learn\",\"package_version\":\"0.19.1\",\"restraint\":\"EXACT\"}]}],\"health\":{\"check_method\":\"HTTP\",\"protocol\":\"http\",\"url\":\"/health\",\"period_seconds\":\"5\",\"failure_threshold\":\"10\",\"initial_delay_seconds\":\"12\"},\"readiness_health\":{\"check_method\":\"HTTP\",\"protocol\":\"http\",\"url\":\"/readiness_health\",\"period_seconds\":\"5\",\"failure_threshold\":\"20\",\"initial_delay_seconds\":\"12\"},\"startup_health\":{\"check_method\":\"HTTP\",\"protocol\":\"http\",\"url\":\"/startup_health\",\"period_seconds\":\"5\",\"failure_threshold\":\"10\",\"initial_delay_seconds\":\"12\"}}"
}
Status Codes¶
Status Code | Description |
---|---|
200 | Model details |
Error Codes¶
See Error Codes.