You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _automating-workflows/workflow-tutorial.md
+20-33Lines changed: 20 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,10 +19,10 @@ The setup requires the following sequence of API requests, with provisioned reso
19
19
*[`deploy_model_3`](#deploy_model_3): Deploy the model.
20
20
1.**Use the deployed model for inference**
21
21
* Set up several tools that perform specific tasks:
22
-
*[`math_tool`](#math_tool): Set up a math tool.
22
+
*[`cat_index_tool`](#cat_index_tool): Set up a tool to obtain index information.
23
23
*[`ml_model_tool`](#ml_model_tool): Set up a machine learning (ML) model tool.
24
24
* Set up one or more agents that use some combination of the tools:
25
-
*[`sub_agent`](#sub_agent): Create an agent that uses the math tool.
25
+
*[`sub_agent`](#sub_agent): Create an agent that uses the `cat_index_tool`.
26
26
* Set up tools representing these agents:
27
27
*[`agent_tool`](#agent_tool): Wrap the `sub_agent` so that you can use it as a tool.
28
28
*[`root_agent`](#root_agent): Set up a root agent that may delegate the task to either a tool or another agent.
@@ -122,19 +122,17 @@ If you define `previous_node_inputs`, then defining edges is optional.
122
122
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/).
123
123
124
124
<!-- vale off -->
125
-
### math_tool
125
+
### cat_index_tool
126
126
<!-- vale on -->
127
127
128
-
You can configure other tools to be used by the CoT agent. For example, you can configure a math tool as follows. This tool does not depend on any previous steps:
128
+
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:
129
129
130
130
```yaml
131
-
- id: math_tool
131
+
- id: cat_index_tool
132
132
type: create_tool
133
133
user_inputs:
134
-
name: MathTool
135
-
type: MathTool
136
-
description: A general tool to calculate any math problem. The action input
137
-
must be a valid math expression, like 2+3
134
+
name: CatIndexTool
135
+
type: CatIndexTool
138
136
parameters:
139
137
max_iteration: 5
140
138
```
@@ -143,15 +141,15 @@ You can configure other tools to be used by the CoT agent. For example, you can
143
141
### sub_agent
144
142
<!-- vale on -->
145
143
146
-
To use the math 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:
144
+
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:
147
145
148
146
```yaml
149
147
- id: sub_agent
150
148
type: register_agent
151
149
previous_node_inputs:
152
150
# When llm.model_id is not present this can be used as a fallback value
153
151
deploy-model-3: model_id
154
-
math_tool: tools
152
+
cat_index_tool: tools
155
153
user_inputs:
156
154
name: Sub Agent
157
155
type: conversational
@@ -169,7 +167,7 @@ To use the math tool in the agent configuration, specify it as one of the tools
169
167
OpenSearch will automatically create the following edges so that the agent can retrieve the fields from the previous node:
170
168
171
169
```yaml
172
-
- source: math_tool
170
+
- source: cat_index_tool
173
171
dest: sub_agent
174
172
- source: deploy_model_3
175
173
dest: sub_agent
@@ -327,25 +325,22 @@ workflows:
327
325
# For example purposes, the model_id obtained as the output of the deploy_model_3 step will be used
328
326
# for several below steps. However, any other deployed model_id can be used for those steps.
329
327
# This is one example tool from the Agent Framework.
330
-
- id: math_tool
328
+
- id: cat_index_tool
331
329
type: create_tool
332
330
user_inputs:
333
-
name: MathTool
334
-
type: MathTool
335
-
description: A general tool to calculate any math problem. The action input
336
-
must be a valid math expression, like 2+3
331
+
name: CatIndexTool
332
+
type: CatIndexTool
337
333
parameters:
338
334
max_iteration: 5
339
335
# This simple agent only has one tool, but could be configured with many tools
340
336
- id: sub_agent
341
337
type: register_agent
342
338
previous_node_inputs:
343
339
deploy-model-3: model_id
344
-
math_tool: tools
340
+
cat_index_tool: tools
345
341
user_inputs:
346
342
name: Sub Agent
347
343
type: conversational
348
-
description: this is a test agent
349
344
parameters:
350
345
hello: world
351
346
llm.parameters:
@@ -362,7 +357,6 @@ workflows:
362
357
user_inputs:
363
358
name: AgentTool
364
359
type: AgentTool
365
-
description: Agent Tool
366
360
parameters:
367
361
max_iteration: 5
368
362
# An ML Model can be used as a tool
@@ -374,7 +368,6 @@ workflows:
374
368
name: MLModelTool
375
369
type: MLModelTool
376
370
alias: language_model_tool
377
-
description: A general tool to answer any question.
378
371
parameters:
379
372
prompt: Answer the question as best you can.
380
373
response_filter: choices[0].message.content
@@ -389,7 +382,6 @@ workflows:
389
382
user_inputs:
390
383
name: DEMO-Test_Agent
391
384
type: flow
392
-
description: this is a test agent
393
385
parameters:
394
386
prompt: Answer the question as best you can.
395
387
llm.parameters:
@@ -405,7 +397,7 @@ workflows:
405
397
dest: register_model_2
406
398
- source: register_model_2
407
399
dest: deploy_model_3
408
-
- source: math_tool
400
+
- source: cat_index_tool
409
401
dest: sub_agent
410
402
- source: deploy_model_3
411
403
dest: sub_agent
@@ -490,12 +482,11 @@ The following is the same template in JSON format:
490
482
}
491
483
},
492
484
{
493
-
"id": "math_tool",
485
+
"id": "cat_index_tool",
494
486
"type": "create_tool",
495
487
"user_inputs": {
496
-
"name": "MathTool",
497
-
"type": "MathTool",
498
-
"description": "A general tool to calculate any math problem. The action input must be a valid math expression, like 2+3",
488
+
"name": "CatIndexTool",
489
+
"type": "CatIndexTool",
499
490
"parameters": {
500
491
"max_iteration": 5
501
492
}
@@ -506,12 +497,11 @@ The following is the same template in JSON format:
506
497
"type": "register_agent",
507
498
"previous_node_inputs": {
508
499
"deploy-model-3": "llm.model_id",
509
-
"math_tool": "tools"
500
+
"cat_index_tool": "tools"
510
501
},
511
502
"user_inputs": {
512
503
"name": "Sub Agent",
513
504
"type": "conversational",
514
-
"description": "this is a test agent",
515
505
"parameters": {
516
506
"hello": "world"
517
507
},
@@ -534,7 +524,6 @@ The following is the same template in JSON format:
534
524
"user_inputs": {
535
525
"name": "AgentTool",
536
526
"type": "AgentTool",
537
-
"description": "Agent Tool",
538
527
"parameters": {
539
528
"max_iteration": 5
540
529
}
@@ -550,7 +539,6 @@ The following is the same template in JSON format:
550
539
"name": "MLModelTool",
551
540
"type": "MLModelTool",
552
541
"alias": "language_model_tool",
553
-
"description": "A general tool to answer any question.",
554
542
"parameters": {
555
543
"prompt": "Answer the question as best you can.",
556
544
"response_filter": "choices[0].message.content"
@@ -568,7 +556,6 @@ The following is the same template in JSON format:
568
556
"user_inputs": {
569
557
"name": "DEMO-Test_Agent",
570
558
"type": "flow",
571
-
"description": "this is a test agent",
572
559
"parameters": {
573
560
"prompt": "Answer the question as best you can."
574
561
},
@@ -597,7 +584,7 @@ The following is the same template in JSON format:
0 commit comments