Change math tool to CAT index tool in the workflow tutorial (#6401)
* Change math tool to CAT index tool in workflow tutorial Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Removed some tool descriptions Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Update _automating-workflows/workflow-tutorial.md Co-authored-by: Daniel Widdis <widdis@gmail.com> Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> --------- Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Co-authored-by: Daniel Widdis <widdis@gmail.com> Co-authored-by: Naarcha-AWS <97990722+Naarcha-AWS@users.noreply.github.com>
This commit is contained in:
parent
fedb5504df
commit
5ba3aeea85
|
@ -19,10 +19,10 @@ The setup requires the following sequence of API requests, with provisioned reso
|
|||
* [`deploy_model_3`](#deploy_model_3): Deploy the model.
|
||||
1. **Use the deployed model for inference**
|
||||
* Set up several tools that perform specific tasks:
|
||||
* [`math_tool`](#math_tool): Set up a math tool.
|
||||
* [`cat_index_tool`](#cat_index_tool): Set up a tool to obtain index information.
|
||||
* [`ml_model_tool`](#ml_model_tool): Set up a machine learning (ML) model tool.
|
||||
* Set up one or more agents that use some combination of the tools:
|
||||
* [`sub_agent`](#sub_agent): Create an agent that uses the math tool.
|
||||
* [`sub_agent`](#sub_agent): Create an agent that uses the `cat_index_tool`.
|
||||
* Set up tools representing these agents:
|
||||
* [`agent_tool`](#agent_tool): Wrap the `sub_agent` so that you can use it as a tool.
|
||||
* [`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.
|
|||
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/).
|
||||
|
||||
<!-- vale off -->
|
||||
### math_tool
|
||||
### cat_index_tool
|
||||
<!-- vale on -->
|
||||
|
||||
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:
|
||||
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:
|
||||
|
||||
```yaml
|
||||
- id: math_tool
|
||||
- id: cat_index_tool
|
||||
type: create_tool
|
||||
user_inputs:
|
||||
name: MathTool
|
||||
type: MathTool
|
||||
description: A general tool to calculate any math problem. The action input
|
||||
must be a valid math expression, like 2+3
|
||||
name: CatIndexTool
|
||||
type: CatIndexTool
|
||||
parameters:
|
||||
max_iteration: 5
|
||||
```
|
||||
|
@ -143,7 +141,7 @@ You can configure other tools to be used by the CoT agent. For example, you can
|
|||
### sub_agent
|
||||
<!-- vale on -->
|
||||
|
||||
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:
|
||||
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:
|
||||
|
||||
```yaml
|
||||
- id: sub_agent
|
||||
|
@ -151,7 +149,7 @@ To use the math tool in the agent configuration, specify it as one of the tools
|
|||
previous_node_inputs:
|
||||
# When llm.model_id is not present this can be used as a fallback value
|
||||
deploy-model-3: model_id
|
||||
math_tool: tools
|
||||
cat_index_tool: tools
|
||||
user_inputs:
|
||||
name: Sub Agent
|
||||
type: conversational
|
||||
|
@ -169,7 +167,7 @@ To use the math tool in the agent configuration, specify it as one of the tools
|
|||
OpenSearch will automatically create the following edges so that the agent can retrieve the fields from the previous node:
|
||||
|
||||
```yaml
|
||||
- source: math_tool
|
||||
- source: cat_index_tool
|
||||
dest: sub_agent
|
||||
- source: deploy_model_3
|
||||
dest: sub_agent
|
||||
|
@ -327,13 +325,11 @@ workflows:
|
|||
# For example purposes, the model_id obtained as the output of the deploy_model_3 step will be used
|
||||
# for several below steps. However, any other deployed model_id can be used for those steps.
|
||||
# This is one example tool from the Agent Framework.
|
||||
- id: math_tool
|
||||
- id: cat_index_tool
|
||||
type: create_tool
|
||||
user_inputs:
|
||||
name: MathTool
|
||||
type: MathTool
|
||||
description: A general tool to calculate any math problem. The action input
|
||||
must be a valid math expression, like 2+3
|
||||
name: CatIndexTool
|
||||
type: CatIndexTool
|
||||
parameters:
|
||||
max_iteration: 5
|
||||
# This simple agent only has one tool, but could be configured with many tools
|
||||
|
@ -341,11 +337,10 @@ workflows:
|
|||
type: register_agent
|
||||
previous_node_inputs:
|
||||
deploy-model-3: model_id
|
||||
math_tool: tools
|
||||
cat_index_tool: tools
|
||||
user_inputs:
|
||||
name: Sub Agent
|
||||
type: conversational
|
||||
description: this is a test agent
|
||||
parameters:
|
||||
hello: world
|
||||
llm.parameters:
|
||||
|
@ -362,7 +357,6 @@ workflows:
|
|||
user_inputs:
|
||||
name: AgentTool
|
||||
type: AgentTool
|
||||
description: Agent Tool
|
||||
parameters:
|
||||
max_iteration: 5
|
||||
# An ML Model can be used as a tool
|
||||
|
@ -374,7 +368,6 @@ workflows:
|
|||
name: MLModelTool
|
||||
type: MLModelTool
|
||||
alias: language_model_tool
|
||||
description: A general tool to answer any question.
|
||||
parameters:
|
||||
prompt: Answer the question as best you can.
|
||||
response_filter: choices[0].message.content
|
||||
|
@ -389,7 +382,6 @@ workflows:
|
|||
user_inputs:
|
||||
name: DEMO-Test_Agent
|
||||
type: flow
|
||||
description: this is a test agent
|
||||
parameters:
|
||||
prompt: Answer the question as best you can.
|
||||
llm.parameters:
|
||||
|
@ -405,7 +397,7 @@ workflows:
|
|||
dest: register_model_2
|
||||
- source: register_model_2
|
||||
dest: deploy_model_3
|
||||
- source: math_tool
|
||||
- source: cat_index_tool
|
||||
dest: sub_agent
|
||||
- source: deploy_model_3
|
||||
dest: sub_agent
|
||||
|
@ -490,12 +482,11 @@ The following is the same template in JSON format:
|
|||
}
|
||||
},
|
||||
{
|
||||
"id": "math_tool",
|
||||
"id": "cat_index_tool",
|
||||
"type": "create_tool",
|
||||
"user_inputs": {
|
||||
"name": "MathTool",
|
||||
"type": "MathTool",
|
||||
"description": "A general tool to calculate any math problem. The action input must be a valid math expression, like 2+3",
|
||||
"name": "CatIndexTool",
|
||||
"type": "CatIndexTool",
|
||||
"parameters": {
|
||||
"max_iteration": 5
|
||||
}
|
||||
|
@ -506,12 +497,11 @@ The following is the same template in JSON format:
|
|||
"type": "register_agent",
|
||||
"previous_node_inputs": {
|
||||
"deploy-model-3": "llm.model_id",
|
||||
"math_tool": "tools"
|
||||
"cat_index_tool": "tools"
|
||||
},
|
||||
"user_inputs": {
|
||||
"name": "Sub Agent",
|
||||
"type": "conversational",
|
||||
"description": "this is a test agent",
|
||||
"parameters": {
|
||||
"hello": "world"
|
||||
},
|
||||
|
@ -534,7 +524,6 @@ The following is the same template in JSON format:
|
|||
"user_inputs": {
|
||||
"name": "AgentTool",
|
||||
"type": "AgentTool",
|
||||
"description": "Agent Tool",
|
||||
"parameters": {
|
||||
"max_iteration": 5
|
||||
}
|
||||
|
@ -550,7 +539,6 @@ The following is the same template in JSON format:
|
|||
"name": "MLModelTool",
|
||||
"type": "MLModelTool",
|
||||
"alias": "language_model_tool",
|
||||
"description": "A general tool to answer any question.",
|
||||
"parameters": {
|
||||
"prompt": "Answer the question as best you can.",
|
||||
"response_filter": "choices[0].message.content"
|
||||
|
@ -568,7 +556,6 @@ The following is the same template in JSON format:
|
|||
"user_inputs": {
|
||||
"name": "DEMO-Test_Agent",
|
||||
"type": "flow",
|
||||
"description": "this is a test agent",
|
||||
"parameters": {
|
||||
"prompt": "Answer the question as best you can."
|
||||
},
|
||||
|
@ -597,7 +584,7 @@ The following is the same template in JSON format:
|
|||
"dest": "deploy_model_3"
|
||||
},
|
||||
{
|
||||
"source": "math_tool",
|
||||
"source": "cat_index_tool",
|
||||
"dest": "sub_agent"
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue