kolchfa-aws 3f7468b504
Add agent framework/throttling/hidden model/OS assistant and update conversational search documentation (#6354)
* Add agent framework documentation

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add hidden model and API updates

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Vale error

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Updated field names

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add updating credentials

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Added tools table

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add OpenSearch forum thread for OS Assistant

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add tech review for conv search

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Fix links

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add tools

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add links to tools

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* More info about tools

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Tool parameters

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Update cat-index-tool.md

Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

* Parameter clarification

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Tech review feedback

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Typo fix

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* More tech review feedback: RAG tool

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Tech review feedback: memory APis

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Update _ml-commons-plugin/agents-tools/index.md

Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

* Update _ml-commons-plugin/agents-tools/tools/neural-sparse-tool.md

Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

* Update _ml-commons-plugin/agents-tools/tools/neural-sparse-tool.md

Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

* Update _ml-commons-plugin/agents-tools/tools/neural-sparse-tool.md

Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

* Update _ml-commons-plugin/opensearch-assistant.md

Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

* Update _ml-commons-plugin/agents-tools/tools/ppl-tool.md

Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

* Separated search and get APIs and add conversational flow agent

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* More parameters for PPL tool

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Added more parameters

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Tech review feedback: PPL tool

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Apply suggestions from code review

Co-authored-by: Nathan Bower <nbower@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

* Rename to automating configurations

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Editorial comments on the new text

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add parameter to PPl tool

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Changed link to configurations

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Rate limiter feedback and added warning

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

---------

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>
Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
Co-authored-by: Nathan Bower <nbower@amazon.com>
2024-02-20 12:09:31 -05:00

5.0 KiB

layout, title, parent, grand_parent, nav_order
layout title parent grand_parent nav_order
default Create controller Controller APIs ML Commons APIs 10

Create or update a controller

Introduced 2.12 {: .label .label-purple }

Use this API to create or update a controller for a model. A model may be shared by multiple users. A controller sets rate limits for the number of Predict API calls users can make on the model. A controller consists of a set of rate limiters for different users.

You can only create a controller for a model once you have registered the model and received a model ID. {: .tip}

The POST method creates a new controller. The PUT method updates an existing controller.

To learn how to set rate limits at the model level for all users, see Update Model API. The rate limit is set to either the model-level limit or the user-level limit, whichever is more restrictive. For example, if the model-level limit is 2 requests per minute and the user-level limit is 4 requests per minute, the overall limit will be set to 2 requests per minute.

Path and HTTP methods

POST /_plugins/_ml/controllers/<model_id>
PUT /_plugins/_ml/controllers/<model_id>

{% include copy-curl.html %}

Path parameters

The following table lists the available path parameters.

Parameter Data type Description
model_id String The model ID of the model for which you want to set rate limits. Required.

Request fields

The following table lists the available request fields.

Field Data type Required/Optional Description
user_rate_limiter Object Required Limits the number of times users can call the Predict API on the model. For more information, see Rate limiting inference calls.

The user_rate_limiter object contains an object for each user, specified by username. The user object contains the following fields.

Field Data type Description
limit Integer The maximum number of times the 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.
unit String The unit of time for the rate limiter. Valid values are DAYS, HOURS, MICROSECONDS, MILLISECONDS, MINUTES, NANOSECONDS, and SECONDS.

Example request: Create a controller

POST _plugins/_ml/controllers/mtw-ZI0B_1JGmyB068C0
{
  "user_rate_limiter": {
    "user1": {
      "limit": 4,
      "unit": "MINUTES"
    },
    "user2": {
      "limit": 4,
      "unit": "MINUTES"
    }
  }
}

{% include copy-curl.html %}

Example response

{
  "model_id": "mtw-ZI0B_1JGmyB068C0",
  "status": "CREATED"
}

Example request: Update the rate limit for one user

To update the limit for user1, send a PUT request and specify the updated information:

PUT _plugins/_ml/controllers/mtw-ZI0B_1JGmyB068C0
{
  "user_rate_limiter": {
    "user1": {
      "limit": 6,
      "unit": "MINUTES"
    }
  }
}

{% include copy-curl.html %}

This will update only the user1 object, leaving all other user limits intact:

{
  "model_id": "mtw-ZI0B_1JGmyB068C0",
  "user_rate_limiter": {
    "user1": {
      "limit": "6",
      "unit": "MINUTES"
    },
    "user2": {
      "limit": "4",
      "unit": "MINUTES"
    }
  }
}

Example response

{
  "_index": ".plugins-ml-controller",
  "_id": "mtw-ZI0B_1JGmyB068C0",
  "_version": 2,
  "result": "updated",
  "forced_refresh": true,
  "_shards": {
    "total": 2,
    "successful": 2,
    "failed": 0
  },
  "_seq_no": 1,
  "_primary_term": 1
}

Example request: Delete the rate limit for one user

To delete the limit for user2, send a POST request containing all other users' limits:

POST _plugins/_ml/controllers/mtw-ZI0B_1JGmyB068C0
{
  "user_rate_limiter": {
    "user1": {
      "limit": 6,
      "unit": "MINUTES"
    }
  }
}

{% include copy-curl.html %}

This will overwrite the controller with the new information:

{
  "model_id": "mtw-ZI0B_1JGmyB068C0",
  "user_rate_limiter": {
    "user1": {
      "limit": "6",
      "unit": "MINUTES"
    }
  }
}

Example response

{
  "_index": ".plugins-ml-controller",
  "_id": "mtw-ZI0B_1JGmyB068C0",
  "_version": 2,
  "result": "updated",
  "forced_refresh": true,
  "_shards": {
    "total": 2,
    "successful": 2,
    "failed": 0
  },
  "_seq_no": 1,
  "_primary_term": 1
}

Required permissions

If you use the Security plugin, make sure you have the appropriate permissions: cluster:admin/opensearch/ml/controllers/create and cluster:admin/opensearch/ml/controllers/update.