Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fix - tool parameters missing #1911

Merged
merged 2 commits into from
Jan 30, 2024
Merged

Conversation

jngz-es
Copy link
Collaborator

@jngz-es jngz-es commented Jan 23, 2024

Description

The tool's parameters configured in agent registration are missing when conversational agent runs the tool.
Tested in my local environment.

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.

Copy link

codecov bot commented Jan 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d0895bb) 82.94% compared to head (8f6f2ef) 82.95%.
Report is 10 commits behind head on main.

❗ Current head 8f6f2ef differs from pull request most recent head 7320cfc. Consider uploading reports for the commit 7320cfc to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1911      +/-   ##
============================================
+ Coverage     82.94%   82.95%   +0.01%     
- Complexity     5414     5415       +1     
============================================
  Files           521      521              
  Lines         21709    21710       +1     
  Branches       2213     2213              
============================================
+ Hits          18007    18010       +3     
+ Misses         2807     2804       -3     
- Partials        895      896       +1     
Flag Coverage Δ
ml-commons 82.95% <100.00%> (+0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env January 23, 2024 23:58 — with GitHub Actions Inactive
@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env January 23, 2024 23:58 — with GitHub Actions Inactive
@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env January 23, 2024 23:58 — with GitHub Actions Inactive
Signed-off-by: Jing Zhang <[email protected]>
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env January 29, 2024 20:33 — with GitHub Actions Failure
@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env January 29, 2024 20:34 — with GitHub Actions Inactive
@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env January 29, 2024 20:34 — with GitHub Actions Inactive
@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env January 29, 2024 20:34 — with GitHub Actions Inactive
@jngz-es jngz-es requested a review from Hailong-am January 29, 2024 20:35
@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env January 29, 2024 21:01 — with GitHub Actions Inactive
@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env January 29, 2024 21:01 — with GitHub Actions Inactive
@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env January 29, 2024 21:01 — with GitHub Actions Inactive
// Verify the size of parameters passed in the tool run method.
ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Map.class);
verify(firstTool).run((Map<String, String>) argumentCaptor.capture(), any());
assertEquals(3, ((Map) argumentCaptor.getValue()).size());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the map of argument is expecting size of 3, should match?

Map<String, String> params = new HashMap<>();
        params.put("action", action);
        params.put("action_input", actionInput); 
        params.put(FIRST_TOOL, someInput); 

@@ -465,7 +465,7 @@ private void runReAct(
action = toolName;

if (tools.containsKey(action) && inputTools.contains(action)) {
Map<String, String> toolParams = new HashMap<>();
Map<String, String> toolParams = new HashMap<>(toolSpecMap.get(action).getParameters());
toolParams.put("input", actionInput);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add a case for input will not be override?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let me add one more case in next pr.

@jngz-es jngz-es merged commit a5c500c into opensearch-project:main Jan 30, 2024
9 of 12 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-1911-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 a5c500cc8cb4826ea7ca819107da5bb940c82ff7
# Push it to GitHub
git push --set-upstream origin backport/backport-1911-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-1911-to-2.x.

jngz-es added a commit to jngz-es/ml-commons that referenced this pull request Feb 6, 2024
* bug fix - tool parameters missing

Signed-off-by: Jing Zhang <[email protected]>

* address comments

Signed-off-by: Jing Zhang <[email protected]>

---------

Signed-off-by: Jing Zhang <[email protected]>
jngz-es added a commit to jngz-es/ml-commons that referenced this pull request Feb 6, 2024
* bug fix - tool parameters missing

Signed-off-by: Jing Zhang <[email protected]>

* address comments

Signed-off-by: Jing Zhang <[email protected]>

---------

Signed-off-by: Jing Zhang <[email protected]>
jngz-es added a commit that referenced this pull request Feb 6, 2024
* bug fix - tool parameters missing



* address comments



---------

Signed-off-by: Jing Zhang <[email protected]>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Feb 9, 2024
* bug fix - tool parameters missing

Signed-off-by: Jing Zhang <[email protected]>

* address comments

Signed-off-by: Jing Zhang <[email protected]>

---------

Signed-off-by: Jing Zhang <[email protected]>
(cherry picked from commit a5c500c)
ylwu-amzn pushed a commit that referenced this pull request Feb 9, 2024
* bug fix - tool parameters missing

Signed-off-by: Jing Zhang <[email protected]>

* address comments

Signed-off-by: Jing Zhang <[email protected]>

---------

Signed-off-by: Jing Zhang <[email protected]>
(cherry picked from commit a5c500c)

Co-authored-by: Jing Zhang <[email protected]>
@jngz-es jngz-es deleted the bug_fix branch February 21, 2024 17:28
austintlee pushed a commit to austintlee/ml-commons that referenced this pull request Mar 19, 2024
* bug fix - tool parameters missing

Signed-off-by: Jing Zhang <[email protected]>

* address comments

Signed-off-by: Jing Zhang <[email protected]>

---------

Signed-off-by: Jing Zhang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants