Skip to content

Commit c486add

Browse files
zane-neokolchfa-awsnatebower
authored
Replace CatIndexTool with ListIndexTool (#9792)
* Replace CatIndexTool with ListIndexTool Signed-off-by: zane-neo <[email protected]> * fix version introduced ListIndexTool Signed-off-by: zane-neo <[email protected]> * fix version introduced ListIndexTool Signed-off-by: zane-neo <[email protected]> * Doc review Signed-off-by: Fanit Kolchina <[email protected]> * Apply suggestions from code review Co-authored-by: Nathan Bower <[email protected]> Signed-off-by: kolchfa-aws <[email protected]> --------- Signed-off-by: zane-neo <[email protected]> Signed-off-by: Fanit Kolchina <[email protected]> Signed-off-by: kolchfa-aws <[email protected]> Co-authored-by: Fanit Kolchina <[email protected]> Co-authored-by: kolchfa-aws <[email protected]> Co-authored-by: Nathan Bower <[email protected]>
1 parent de2c17f commit c486add

File tree

8 files changed

+51
-43
lines changed

8 files changed

+51
-43
lines changed

_about/breaking-changes.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,8 @@ The legacy notebooks feature has been removed from `dashboards-observability`. K
163163
- Only notebooks stored in the `.kibana` index (introduced in version 2.17) are supported.
164164
- You must migrate your notebooks to the new storage system before upgrading to version 3.0.
165165

166-
For more information, see issue [#2350](https://github.com/opensearch-project/dashboards-observability/issues/2350).
166+
For more information, see issue [#2350](https://github.com/opensearch-project/dashboards-observability/issues/2350).
167+
168+
### ML Commons plugin
169+
170+
- The `CatIndexTool` is removed in favor of the `ListIndexTool`.

_automating-configurations/workflow-tutorial.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ The setup requires the following sequence of API requests, with provisioned reso
1616
* [`deploy_model_3`](#deploy_model_3): Deploy the model.
1717
1. **Use the deployed model for inference**
1818
* Set up several tools that perform specific tasks:
19-
* [`cat_index_tool`](#cat_index_tool): Set up a tool to obtain index information.
19+
* [`list_index_tool`](#list_index_tool): Set up a tool to obtain index information.
2020
* [`ml_model_tool`](#ml_model_tool): Set up a machine learning (ML) model tool.
2121
* Set up one or more agents that use some combination of the tools:
22-
* [`sub_agent`](#sub_agent): Create an agent that uses the `cat_index_tool`.
22+
* [`sub_agent`](#sub_agent): Create an agent that uses the `list_index_tool`.
2323
* Set up tools representing these agents:
2424
* [`agent_tool`](#agent_tool): Wrap the `sub_agent` so that you can use it as a tool.
2525
* [`root_agent`](#root_agent): Set up a root agent that may delegate the task to either a tool or another agent.
@@ -119,17 +119,17 @@ If you define `previous_node_inputs`, then defining edges is optional.
119119
A CoT agent can use the deployed model in a tool. This step doesn’t strictly correspond to an API but represents a component of the body required by the [Register Agent API]({{site.url}}{{site.baseurl}}/ml-commons-plugin/). This simplifies the register request and allows reuse of the same tool in multiple agents. For more information about agents and tools, see [Agents and tools]({{site.url}}{{site.baseurl}}/ml-commons-plugin/).
120120

121121
<!-- vale off -->
122-
### cat_index_tool
122+
### list_index_tool
123123
<!-- vale on -->
124124

125-
You can configure other tools to be used by the CoT agent. For example, you can configure a `cat_index_tool` as follows. This tool does not depend on any previous steps:
125+
You can configure other tools to be used by the CoT agent. For example, you can configure a `list_index_tool` as follows. This tool does not depend on any previous steps:
126126

127127
```yaml
128-
- id: cat_index_tool
128+
- id: list_index_tool
129129
type: create_tool
130130
user_inputs:
131-
name: CatIndexTool
132-
type: CatIndexTool
131+
name: ListIndexTool
132+
type: ListIndexTool
133133
parameters:
134134
max_iteration: 5
135135
```
@@ -138,15 +138,15 @@ You can configure other tools to be used by the CoT agent. For example, you can
138138
### sub_agent
139139
<!-- vale on -->
140140

141-
To use the `cat_index_tool` in the agent configuration, specify it as one of the tools in the `previous_node_inputs` field of the agent. You can add other tools to `previous_node_inputs` as necessary. The agent also needs a large language model (LLM) in order to reason with the tools. The LLM is defined by the `llm.model_id` field. This example assumes that the `model_id` from the `deploy_model_3` step will be used. However, if another model is already deployed, the `model_id` of that previously deployed model could be included in the `user_inputs` field instead:
141+
To use the `list_index_tool` in the agent configuration, specify it as one of the tools in the `previous_node_inputs` field of the agent. You can add other tools to `previous_node_inputs` as necessary. The agent also needs a large language model (LLM) in order to reason with the tools. The LLM is defined by the `llm.model_id` field. This example assumes that the `model_id` from the `deploy_model_3` step will be used. However, if another model is already deployed, the `model_id` of that previously deployed model could be included in the `user_inputs` field instead:
142142

143143
```yaml
144144
- id: sub_agent
145145
type: register_agent
146146
previous_node_inputs:
147147
# When llm.model_id is not present this can be used as a fallback value
148148
deploy-model-3: model_id
149-
cat_index_tool: tools
149+
list_index_tool: tools
150150
user_inputs:
151151
name: Sub Agent
152152
type: conversational
@@ -164,7 +164,7 @@ To use the `cat_index_tool` in the agent configuration, specify it as one of the
164164
OpenSearch will automatically create the following edges so that the agent can retrieve the fields from the previous node:
165165

166166
```yaml
167-
- source: cat_index_tool
167+
- source: list_index_tool
168168
dest: sub_agent
169169
- source: deploy_model_3
170170
dest: sub_agent
@@ -322,19 +322,19 @@ workflows:
322322
# For example purposes, the model_id obtained as the output of the deploy_model_3 step will be used
323323
# for several below steps. However, any other deployed model_id can be used for those steps.
324324
# This is one example tool from the Agent Framework.
325-
- id: cat_index_tool
325+
- id: list_index_tool
326326
type: create_tool
327327
user_inputs:
328-
name: CatIndexTool
329-
type: CatIndexTool
328+
name: ListIndexTool
329+
type: ListIndexTool
330330
parameters:
331331
max_iteration: 5
332332
# This simple agent only has one tool, but could be configured with many tools
333333
- id: sub_agent
334334
type: register_agent
335335
previous_node_inputs:
336336
deploy-model-3: model_id
337-
cat_index_tool: tools
337+
list_index_tool: tools
338338
user_inputs:
339339
name: Sub Agent
340340
type: conversational
@@ -394,7 +394,7 @@ workflows:
394394
dest: register_model_2
395395
- source: register_model_2
396396
dest: deploy_model_3
397-
- source: cat_index_tool
397+
- source: list_index_tool
398398
dest: sub_agent
399399
- source: deploy_model_3
400400
dest: sub_agent
@@ -479,11 +479,11 @@ The following is the same template in JSON format:
479479
}
480480
},
481481
{
482-
"id": "cat_index_tool",
482+
"id": "list_index_tool",
483483
"type": "create_tool",
484484
"user_inputs": {
485-
"name": "CatIndexTool",
486-
"type": "CatIndexTool",
485+
"name": "ListIndexTool",
486+
"type": "ListIndexTool",
487487
"parameters": {
488488
"max_iteration": 5
489489
}
@@ -494,7 +494,7 @@ The following is the same template in JSON format:
494494
"type": "register_agent",
495495
"previous_node_inputs": {
496496
"deploy-model-3": "llm.model_id",
497-
"cat_index_tool": "tools"
497+
"list_index_tool": "tools"
498498
},
499499
"user_inputs": {
500500
"name": "Sub Agent",
@@ -581,7 +581,7 @@ The following is the same template in JSON format:
581581
"dest": "deploy_model_3"
582582
},
583583
{
584-
"source": "cat_index_tool",
584+
"source": "list_index_tool",
585585
"dest": "sub_agent"
586586
},
587587
{

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ redirect_from:
1212
**Introduced 2.13**
1313
{: .label .label-purple }
1414

15-
You can automate machine learning (ML) tasks using agents and tools. An _agent_ orchestrates and runs ML models and tools. A _tool_ performs a set of specific tasks. Some examples of tools are the `VectorDBTool`, which supports vector search, and the `CATIndexTool`, which executes the `cat indices` operation. For a list of supported tools, see [Tools]({{site.url}}{{site.baseurl}}/ml-commons-plugin/agents-tools/tools/index/).
15+
You can automate machine learning (ML) tasks using agents and tools. An _agent_ orchestrates and runs ML models and tools. A _tool_ performs a set of specific tasks. Some examples of tools are the `VectorDBTool`, which supports vector search, and the `ListIndexTool`, which executes the `cat indices` operation. For a list of supported tools, see [Tools]({{site.url}}{{site.baseurl}}/ml-commons-plugin/agents-tools/tools/index/).
1616

1717
## Agents
1818

@@ -109,7 +109,7 @@ Assistant:"""
109109

110110
### Conversational agents
111111

112-
Similarly to a conversational flow agent, a conversational agent stores the conversation in an index, in the following example, the `conversation_index`. A conversational agent can be configured with an LLM and a set of supplementary tools that perform specific jobs. For example, you can set up an LLM and a `CATIndexTool` when configuring an agent. When you send a question to the model, the agent also includes the `CATIndexTool` as context. The LLM then decides whether it needs to use the `CATIndexTool` to answer questions like "How many indexes are in my cluster?" The context allows an LLM to answer specific questions that are outside of its knowledge base. For example, the following agent is configured with an LLM and a `CATIndexTool` that retrieves information about your OpenSearch indexes:
112+
Similarly to a conversational flow agent, a conversational agent stores the conversation in an index, in the following example, the `conversation_index`. A conversational agent can be configured with an LLM and a set of supplementary tools that perform specific jobs. For example, you can set up an LLM and a `ListIndexTool` when configuring an agent. When you send a question to the model, the agent also includes the `ListIndexTool` as context. The LLM then decides whether it needs to use the `ListIndexTool` to answer questions like "How many indexes are in my cluster?" The context allows an LLM to answer specific questions that are outside of its knowledge base. For example, the following agent is configured with an LLM and a `ListIndexTool` that retrieves information about your OpenSearch indexes:
113113

114114
```json
115115
POST /_plugins/_ml/agents/_register
@@ -142,7 +142,7 @@ POST /_plugins/_ml/agents/_register
142142
}
143143
},
144144
{
145-
"type": "CatIndexTool",
145+
"type": "ListIndexTool",
146146
"name": "RetrieveIndexMetaTool",
147147
"description": "Use this tool to get OpenSearch index information: (health, status, index, uuid, primary count, replica count, docs.count, docs.deleted, store.size, primary.store.size)."
148148
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ Each tool takes a list of parameters specific to that tool. In the preceding exa
3232
|Tool | Description |
3333
|:--- |:--- |
3434
|[`AgentTool`]({{site.url}}{{site.baseurl}}/ml-commons-plugin/agents-tools/tools/agent-tool/) |Runs any agent. |
35-
|[`CatIndexTool`]({{site.url}}{{site.baseurl}}/ml-commons-plugin/agents-tools/tools/cat-index-tool/) |Retrieves index information for the OpenSearch cluster. |
3635
|[`ConnectorTool`]({{site.url}}{{site.baseurl}}/ml-commons-plugin/agents-tools/tools/connector-tool/) | Uses a [connector]({{site.url}}{{site.baseurl}}/ml-commons-plugin/remote-models/connectors/) to call any REST API function. |
37-
|[`IndexMappingTool`]({{site.url}}{{site.baseurl}}/ml-commons-plugin/agents-tools/tools/index-mapping-tool/) |Retrieves index mapping and setting information for an index. |
3836
|[`CreateAnomalyDetectorTool`]({{site.url}}{{site.baseurl}}/ml-commons-plugin/agents-tools/tools/create-anomaly-detector/) | Enables an LLM to suggest required parameters for creating an anomaly detector. |
37+
|[`IndexMappingTool`]({{site.url}}{{site.baseurl}}/ml-commons-plugin/agents-tools/tools/index-mapping-tool/) |Retrieves index mapping and setting information for an index. |
38+
|[`ListIndexTool`]({{site.url}}{{site.baseurl}}/ml-commons-plugin/agents-tools/tools/list-index-tool/) |Retrieves index information for the OpenSearch cluster. Introduced in OpenSearch version 3.0 as a replacement for the `CatIndexTool`. |
3939
|[`MLModelTool`]({{site.url}}{{site.baseurl}}/ml-commons-plugin/agents-tools/tools/ml-model-tool/) |Runs machine learning models. |
4040
|[`NeuralSparseSearchTool`]({{site.url}}{{site.baseurl}}/ml-commons-plugin/agents-tools/tools/neural-sparse-tool/) | Performs sparse vector retrieval. |
4141
|[`PPLTool`]({{site.url}}{{site.baseurl}}/ml-commons-plugin/agents-tools/tools/ppl-tool/) |Translates natural language into a Piped Processing Language (PPL) query. |

_ml-commons-plugin/agents-tools/tools/cat-index-tool.md renamed to _ml-commons-plugin/agents-tools/tools/list-index-tool.md

+16-12
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
---
22
layout: default
3-
title: CAT Index tool
3+
title: List Index tool
44
has_children: false
55
has_toc: false
6-
nav_order: 20
6+
nav_order: 35
77
parent: Tools
88
grand_parent: Agents and tools
99
---
1010

1111
<!-- vale off -->
12-
# CAT Index tool
13-
**Introduced 2.13**
12+
# List Index tool
13+
**Introduced 3.0**
1414
{: .label .label-purple }
1515
<!-- vale on -->
1616

17-
The `CatIndexTool` retrieves index information for the OpenSearch cluster, similarly to the [CAT Indices API]({{site.url}}{{site.baseurl}}/api-reference/cat/cat-indices/).
17+
The `ListIndexTool` retrieves index information for the OpenSearch cluster, similarly to the [List Indices API]({{site.url}}{{site.baseurl}}/api-reference/list/list-indices/).
1818

19-
## Step 1: Register a flow agent that will run the CatIndexTool
19+
The `ListIndexTool` replaces the `CatIndexTool` starting with OpenSearch version 3.0.
20+
{: .note}
21+
22+
## Step 1: Register a flow agent that will run the ListIndexTool
2023

2124
A flow agent runs a sequence of tools in order and returns the last tool's output. To create a flow agent, send the following register agent request:
2225

2326
```json
2427
POST /_plugins/_ml/agents/_register
2528
{
26-
"name": "Test_Agent_For_CatIndex_tool",
29+
"name": "Test_Agent_For_ListIndex_tool",
2730
"type": "flow",
28-
"description": "this is a test agent for the CatIndexTool",
31+
"description": "this is a test agent for the ListIndexTool",
2932
"tools": [
3033
{
31-
"type": "CatIndexTool",
32-
"name": "DemoCatIndexTool",
34+
"type": "ListIndexTool",
35+
"name": "DemoListIndexTool",
3336
"parameters": {
3437
"input": "${parameters.question}"
3538
}
@@ -118,8 +121,9 @@ The following table lists all tool parameters that are available when registerin
118121
Parameter | Type | Required/Optional | Description
119122
:--- | :--- | :--- | :---
120123
`input` | String | Required | The user input used to return index information.
121-
`index` | String | Optional | A comma-delimited list of one or more indexes on which to run the CAT operation. Default is an empty list, which means all indexes.
122-
`local` | Boolean | Optional | When `true`, retrieves information from the local node only instead of the cluster manager node (default is `false`).
124+
`indices` | String | Optional | A comma-delimited list of one or more indexes on which to run the list index operation. Default is an empty list, which means all indexes.
125+
`local` | Boolean | Optional | When `true`, retrieves information from the local node only instead of the cluster manager node. Default is `false`.
126+
`page_size` | Integer | Optional | Specifies the number of index results returned per page when using the List Indices API. The API retrieves index status in a paginated manner. Default is `100`.
123127

124128
## Execute parameters
125129

_ml-commons-plugin/api/agent-apis/register-agent.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ POST /_plugins/_ml/agents/_register
173173
}
174174
},
175175
{
176-
"type": "CatIndexTool",
176+
"type": "ListIndexTool",
177177
"name": "RetrieveIndexMetaTool",
178178
"description": "Use this tool to get OpenSearch index information: (health, status, index, uuid, primary count, replica count, docs.count, docs.deleted, store.size, primary.store.size)."
179179
}

_ml-commons-plugin/api/memory-apis/get-message-traces.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ green open opensearch_dashboards_sample_data_flights pJde0irnTce4-uobHw
9292
green open my_test_data T4hwNs7CTJGIfw2QpCqQ_Q 1 1 6 0 91.7kb 45.8kb
9393
green open .opendistro-job-scheduler-lock XjgmXAVKQ4e8Y-ac54VBzg 1 1 3 0 38.7kb 19.4kb
9494
""",
95-
"origin": "CatIndexTool",
95+
"origin": "ListIndexTool",
9696
"additional_info": {},
9797
"parent_message_id": "TAuCZY0BT2tRrkdmCPqZ",
9898
"trace_number": 2

_tutorials/gen-ai/chatbots/build-chatbot.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ POST _plugins/_ml/agents/_register
279279
}
280280
},
281281
{
282-
"type": "CatIndexTool",
282+
"type": "ListIndexTool",
283283
"description": "Use this tool to get OpenSearch index information: (health, status, index, uuid, primary count, replica count, docs.count, docs.deleted, store.size, primary.store.size). \nIt takes 2 optional arguments named `index` which is a comma-delimited list of one or more indices to get information from (default is an empty list meaning all indices), and `local` which means whether to return information from the local node only instead of the cluster manager node (default is false)."
284284
},
285285
{
@@ -313,7 +313,7 @@ Note the following testing tips:
313313
- Avoid configuring many tools in an agent.
314314
- Provide a detailed tool description clarifying what the tool can do.
315315
- Specify the tool to use in the LLM question, for example, `Can you use the PPLTool to query the opensearch_dashboards_sample_data_ecommerce index so it can calculate how many orders were placed last week?`.
316-
- Specify the tool to use when executing an agent. For example, specify that only `PPLTool` and `CatIndexTool` should be used to process the current request.
316+
- Specify the tool to use when executing an agent. For example, specify that only the `PPLTool` and `ListIndexTool` should be used to process the current request.
317317

318318
Test the agent:
319319

@@ -323,7 +323,7 @@ POST _plugins/_ml/agents/your_agent_id/_execute
323323
"parameters": {
324324
"question": "Can you query with index opensearch_dashboards_sample_data_ecommerce to calculate how many orders in last week?",
325325
"verbose": false,
326-
"selected_tools": ["PPLTool", "CatIndexTool"]
326+
"selected_tools": ["PPLTool", "ListIndexTool"]
327327
}
328328
}
329329
```

0 commit comments

Comments
 (0)