-
Notifications
You must be signed in to change notification settings - Fork 50
Update parameter handling of tools #618
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
Conversation
- Add utilities for extracting required parameters and JSON input parameters - Apply parameter extraction in AbstractRetrieverTool and RAGTool - Define TOOL_REQUIRED_PARAMS constant for consistent parameter handling Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
- Update all Tool interface implementations to use extractInputParameters utility Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
| * @param attributes The tool attributes containing required parameter information | ||
| * @return A map containing only the required parameters or all parameters if no required parameters are specified | ||
| */ | ||
| public static Map<String, String> extractRequiredParameters(Map<String, String> parameters, Map<String, ?> attributes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not copy the code, skills has dependency to ml-commons, re-use the method directly, if the module is not introduced, try introduce it or change the code in ml-commons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with library method.
| public static final String ALERTING_CONFIG_INDEX = ".opendistro-alerting-config"; | ||
| public static final String ALERTING_ALERTS_INDEX = ".opendistro-alerting-alerts"; | ||
|
|
||
| public static final String TOOL_REQUIRED_PARAMS = "required_parameters"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the constant from ml-commons if possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pointing out. Fixed.
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #618 +/- ##
============================================
- Coverage 81.78% 74.97% -6.82%
- Complexity 193 404 +211
============================================
Files 11 24 +13
Lines 961 2162 +1201
Branches 137 302 +165
============================================
+ Hits 786 1621 +835
- Misses 121 438 +317
- Partials 54 103 +49 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Add parameter extraction utilities for tool inputs - Add utilities for extracting required parameters and JSON input parameters - Apply parameter extraction in AbstractRetrieverTool and RAGTool - Define TOOL_REQUIRED_PARAMS constant for consistent parameter handling Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> * Standardize parameter handling in all Tool implementations - Update all Tool interface implementations to use extractInputParameters utility Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> * Update release note Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> * Declare origin of helper method extractInputParameters Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> * Remove displaced comment in javadoc Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> * Fix failed test in AbstractRetrieverToolTests Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> * Replace copied tool utils to library ones Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> --------- Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> (cherry picked from commit addf057) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Add parameter extraction utilities for tool inputs - Add utilities for extracting required parameters and JSON input parameters - Apply parameter extraction in AbstractRetrieverTool and RAGTool - Define TOOL_REQUIRED_PARAMS constant for consistent parameter handling * Standardize parameter handling in all Tool implementations - Update all Tool interface implementations to use extractInputParameters utility * Update release note * Declare origin of helper method extractInputParameters * Remove displaced comment in javadoc * Fix failed test in AbstractRetrieverToolTests * Replace copied tool utils to library ones --------- (cherry picked from commit addf057) Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
The PR opensearch-project/ml-commons/pull/4053 introduced a change to parameter handling of tools. This leads to several IT failures.
This PR fixes these failures by updating the implementation. It standardizes parameter handling across all Tool implementations:
extractInputParametersutilityRelated Issues
Resolves #617
Check List
--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.