ml-commons icon indicating copy to clipboard operation
ml-commons copied to clipboard

add fill for selected tools

Open xinyual opened this issue 1 year ago • 1 comments

Description

We want to use a MLModelTool to firstly do tool selection and then limit the tool root agent can use. It will improve the tool selection accuracy. To do so, we need to fill the "TOOL_SELECT" field by previous MLMODELTool's output.

The request body would be like:

{
  "name": "Test_Agent_For_RAG_2",
  "type": "flow",
  "description": "Use this tool to transfer natural language to generate PPL and execute PPL to query inside. This tool will select index by itself. The input parameters are: {'question':UserQuestion}",
  "memory": {
    "type": "demo"
  },
  "tools": [
    {
      "type": "MLModelTool",
      "name": "RepCToolSelection",
      "description": "repc",
      "parameters": {
        "model_id": "<repc_id>",
        "prompt": "${parameters.question}"
      }
    },
      {
      "type": "AgentTool",
      "name": "RootAgent",
      "description": "root agent with all tools",
      "parameters": {
        "agent_id": "<root_agent_id>",
        "selected_tools": "[\"${parameters.RepCToolSelection.output}\"]"
      }
    }
  ]
}

Issues Resolved

[List any issues this PR will resolve]

Check List

  • [ ] New functionality includes testing.
    • [ ] All tests pass
  • [ ] New functionality has been documented.
    • [ ] New functionality has javadoc added
  • [ ] Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.

xinyual avatar Feb 22 '24 03:02 xinyual

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (5cba422) 81.87% compared to head (e819e30) 81.85%. Report is 1 commits behind head on main.

Files Patch % Lines
...nsearch/ml/engine/algorithms/agent/AgentUtils.java 16.66% 4 Missing and 1 partial :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2150      +/-   ##
============================================
- Coverage     81.87%   81.85%   -0.02%     
- Complexity     5662     5663       +1     
============================================
  Files           543      543              
  Lines         22857    22864       +7     
  Branches       2350     2350              
============================================
+ Hits          18714    18716       +2     
- Misses         3203     3207       +4     
- Partials        940      941       +1     
Flag Coverage Δ
ml-commons 81.85% <28.57%> (-0.02%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 22 '24 03:02 codecov[bot]