Update a model
Introduced 2.12
Updates a model based on the model_ID
.
For information about user access for this API, see Model access control considerations.
Path and HTTP methods
PUT /_plugins/_ml/models/<model_id>
Request body fields
The following table lists the updatable fields. Not all request fields are applicable to all models. To determine whether the field is applicable to your model type, see Register Model API.
Field | Data type | Description |
---|---|---|
connector | Object | Contains specifications for a connector for a model hosted on a third-party platform. For more information, see Creating a connector for a specific model. For information about the updatable fields within a connector, see Update Connector API request fields. |
connector_id | Optional | The connector ID of a standalone connector for a model hosted on a third-party platform. For more information, see Standalone connector. To update a standalone connector, you must undeploy the model, update the connector, and then redeploy the model. |
description | String | The model description. |
is_enabled | Boolean | Specifies whether the model is enabled. Disabling the model makes it unavailable for Predict API requests, regardless of the model’s deployment status. Default is true . |
model_config | Object | The model’s configuration, including the model_type , embedding_dimension , and framework_type . all_config is an optional JSON string that contains all model configurations. For more information, see The model_config object. |
model_group_id | String | The model group ID of the model group to which to register this model. |
name | String | The model name. |
rate_limiter | Object | Limits the number of times any user can call the Predict API on the model. For more information, see Rate limiting inference calls. |
rate_limiter.limit | Integer | The maximum number of times any user can call the Predict API on the model per unit of time. By default, there is no limit on the number of Predict API calls. Once you set a limit, you cannot reset it to no limit. As an alternative, you can specify a high limit value and a small time unit, for example, 1 request per nanosecond. |
rate_limiter.unit | String | The unit of time for the rate limiter. Valid values are DAYS , HOURS , MICROSECONDS , MILLISECONDS , MINUTES , NANOSECONDS , and SECONDS . |
guardrails | Object | The guardrails for the model. |
interface | Object | The interface for the model. |
Example request: Disabling a model
PUT /_plugins/_ml/models/MzcIJX8BA7mbufL6DOwl
{
"is_enabled": false
}
copy
Example request: Rate limiting inference calls for a model
The following request limits the number of times you can call the Predict API on the model to 4 Predict API calls per minute:
PUT /_plugins/_ml/models/T_S-cY0BKCJ3ot9qr0aP
{
"rate_limiter": {
"limit": "4",
"unit": "MINUTES"
}
}
copy
Example requests: Updating the guardrails
PUT /_plugins/_ml/models/MzcIJX8BA7mbufL6DOwl
{
"guardrails": {
"type": "local_regex",
"input_guardrail": {
"stop_words": [
{
"index_name": "updated_stop_words_input",
"source_fields": ["updated_title"]
}
],
"regex": ["updated_regex1", "updated_regex2"]
},
"output_guardrail": {
"stop_words": [
{
"index_name": "updated_stop_words_output",
"source_fields": ["updated_title"]
}
],
"regex": ["updated_regex1", "updated_regex2"]
}
}
}
copy
PUT /_plugins/_ml/models/9uGdCJABjaMXYrp14YRj
{
"guardrails": {
"type": "model",
"input_guardrail": {
"model_id": "V-G1CJABjaMXYrp1QoUC",
"response_validation_regex": "^\\s*[Aa]ccept\\s*$"
},
"output_guardrail": {
"model_id": "V-G1CJABjaMXYrp1QoUC",
"response_validation_regex": "^\\s*[Aa]ccept\\s*$"
}
}
}
copy
Example response
{
"_index": ".plugins-ml-model",
"_id": "MzcIJX8BA7mbufL6DOwl",
"_version": 10,
"result": "updated",
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"_seq_no": 48,
"_primary_term": 4
}
当前内容版权归 OpenSearch 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 OpenSearch .