You're viewing version 3.5 of the OpenSearch documentation. This version is no longer maintained. For the latest version, see the current documentation. For information about OpenSearch version maintenance, see Release Schedule and Maintenance Policy.
Update Context Management API
Introduced 3.5
Use this API to update an existing context management configuration. You can modify the description, hooks configuration, and context manager settings.
Endpoints
PUT /_plugins/_ml/context_management/<context_management_name>
Path parameters
The following table lists the available path parameters.
| Parameter | Data type | Required/Optional | Description |
|---|---|---|---|
context_management_name | String | Required | The name of the context management to update. |
Request body fields
The following table lists the available request body fields.
| Field | Data type | Required/Optional | Description |
|---|---|---|---|
description | String | Optional | A human-readable description of what this context management does. |
hooks | Object | Optional | A map of hook names to lists of context manager configurations. See The hooks object. |
The request body follows the same structure as the Create Context Management API.
Example request: Update description
PUT /_plugins/_ml/context_management/advanced-context-management
{
"description": "Updated description for advanced context management with multiple strategies"
}
Example request: Update hooks configuration
PUT /_plugins/_ml/context_management/sliding_window_max_40000_tokens_managers
{
"description": "Context management for truncating tool outputs to prevent input length issues",
"hooks": {
"pre_llm": [
{
"type": "SlidingWindowManager",
"config": {
"max_messages": 8,
"activation": {
"rule_type": "always"
}
}
}
],
"post_tool": [
{
"type": "ToolsOutputTruncateManager",
"config": {
"max_output_length": 40000,
"activation": {
"rule_type": "always"
}
}
}
]
}
}
Example response
{
"_index": ".plugins-ml-context-management-templates",
"_id": "sliding_window_max_40000_tokens_managers",
"_version": 2,
"result": "updated",
"forced_refresh": true,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"_seq_no": 4,
"_primary_term": 1
}
Related documentation
For more information, see Context management.