Deploying Inference Services
Function
This API is used to deploy inference services.
URI
POST /v1/{project_id}/infer-services
Table 1 describes the URI parameters.
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID, which is used for resource isolation. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request
Table 2 describes the request parameters.
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| service_name | Yes | String | Service name. The value can contain a maximum of 48 characters. Only digits, letters, underscores (_), and hyphens (-) are allowed. It must start with res- and cannot end with a hyphen. |
| service_type | Yes | String | Service type. The options are infer, rank, or nlp. |
| description | No | String | Service description |
| flows | Yes | List | List of flows. For details, see Table 3. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Flow name. The value can contain a maximum of 60 characters. Only digits, letters, underscores (_), hyphens (-), and spaces are allowed. |
| rules | Yes | List | Configuration of different traffic and candidate set rules for each flow. For details, see Table 4. |
| backup_uuid | No | String | UUID generated when the retrieval strategy is manually imported |
| need_preferences | No | Boolean | Whether to enable the Preference function. This parameter must match global_features_info_path, profile_uuid, and attr_weight. For example, in a car purchase scenario, a candidate set generated by the ItemCF Recommendation strategy functions as items2; a collection of items suitable for a user functions as items1. To ensure that the recommended items match the user's age, gender, and other attributes as much as possible, select items that appear in items2 for the final candidate set generation. If the selected quantity is insufficient, choose from the remaining items to fill the vacancies. |
| global_features_info_path | Yes | String | Path storing the global feature files |
| profile_uuid | No | String | UUIDs generated by the User Profile-Item Profile-Standard Wide Table Generation operator
|
| attr_weight | No | List | Parameter used for attribute weight ranking or preferred item search. Table 11 describes attribute weight lists. |
| filter_conf | No | Object | List of filter rules. For details, see Table 6. |
| rank_conf | No | Object | List of ranking configurations. For details, see Table 9. |
| config | Yes | JSON | Configuration parameter. For details, see Table 5. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| candidate_uuid | Yes | String | Candidate set ID |
| rule_ratio | Yes | Integer | Proportion of data with the same priority. The value is an integer ranging from 0 to 100. The proportion of data with the same level is 100. |
| priority | Yes | String | Priority. The value is an integer ranging from 1 to 10. The value 1 indicates the highest priority. The value can contain a maximum of 32 characters. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| model_name | Yes | String | Model name |
| model_version | Yes | String | Model version |
| weight | Yes | Integer | A/B test traffic percentage. The value is an integer ranging from 0 to 100. The sum of all flows is 100. |
| specification | Yes | String | Node specification. Currently, only c2.m8.g0 is supported. |
| instance_count | Yes | Integer | Number of node instances. A maximum of two instances are supported. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| filter_uuid | No | String | UUID generated by using filter rules
|
| duplicate_info | No | Objcet | Duplication configurations. For details, see Table 7. |
| attribute_rules | No | List | Attribute filter configurations. For details, see Table 8. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| item_properties | No | List | A list of attributes to be deduplicated. For example: If product_color is entered, the items with the same color in the candidate set are deduplicated. Items left in the candidate set have a high retrieval score. |
| item_id_ignore_length | No | String | Length of an item ID to be ignored. For example, if SKU_A000123 and SKU_A000456 are in a candidate set, and the ignored length is set to 3, then the SKU_A000 with a higher retrieval score is left. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| user_attributes | Yes | List | User attribute to be filtered. Currently, only attributes of the string type and numerical type are supported. For example, for a user from tier-1 city, the attribute name is city, and the attribute value is tier-1 city. |
| item_attributes | Yes | List | Item attribute to be filtered. Currently, only attributes of the string type and numerical type are supported. For example, For an item whose weight is 0, the attribute name is weight and the attribute value is 0.00. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| model_path | No | String | OBS file path where models generated by sorting policy are located |
| etl_uuid | No | String | UUIDs of the ranking training samples generated in Feature Engineering |
| is_attrWeight_rank | No | Boolean | Whether to perform attribute ranking |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| weight | Yes | Integer | Traffic proportion of the current model version |
| specification | Yes | String | Specification of the compute node |
| instance_count | Yes | Integer | Number of compute nodes, or number of instances |
| image_id | No | String | Image ID. image_id and model_id are mutually exclusive. You can select only one of them. |
| model_id | Yes | String | Model ID. image_id and model_id are mutually exclusive. You can select only one of them. |
Response
Table 12 describes the response parameters.
Example
- Example request
{ "service_name": "res-service", "service_type": "infer", "description": "", "flows": [ { "name": "lc", "ratio": 100, "rules": [ { "rule_ratio": 100, "priority": "1", "candidate_uuid": "d7f23ad959bb409a89ec53b0e7346982" } ], "backup_uuid": "d7djdad959bb409a89ec53b0e7346982", "global_features_info_path": "<Path for storing the global feature files>", "profile_uuid": "593f1466661e40f58a7bda615b588d2e", "filter_conf": { "filter_uuid": "ca2b02b83338498da3b551b66d9654c3", "duplicate_info": { "item_properties": [ "product_name" ], "item_id_ignore_length": "" }, "attribute_rules": [ { "user_attributes": [ { "name": "gender", "value": "male" } ], "item_attributes": [ { "name": "color", "value": "red" } ] } ] }, "rank_conf": { "model_path": "<OBS path for storing the models generated by the ranking strategies>" }, "config": { "weight": 100, "specification": "modelarts.vm.cpu.2u", "instance_count": 1, "model_id": "5bbd6911-02d8-4109-80a1-e3dafc5a2cec" } } ] } - Example of a successful response
{ "is_success": true, "service_id": "bf024976-5ade-49bf-83bf-5600191922db" } - Example of a failed response
{ "is_success": false, "error_code": "res.1001", "error_msg": "The value of request parameter(service_name) is invalid." }
Status Code
For details about status codes, see Status Codes.
Last Article: Obtaining the Specification Lists
Next Article: Prediction APIs
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.