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

feature: tune description on monitor and anomaly detection #120

Merged

Conversation

yuye-aws
Copy link
Member

@yuye-aws yuye-aws commented Jan 11, 2024

Description

This PR tunes description on monitor, anomaly detection, and alert. The description follows the hugging face template: https://huggingface.co/docs/transformers/custom_tools#custom-tools-and-prompts

Issues Resolved

This PR tunes description on monitor and anomaly detection.

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.

Signed-off-by: yuye-aws <[email protected]>
@yuye-aws yuye-aws changed the title featu: tune description on monitor and anomaly detection feature: tune description on monitor and anomaly detection Jan 11, 2024
@xinyual
Copy link
Collaborator

xinyual commented Jan 11, 2024

Have you checked the performance of new version description?

@yuye-aws
Copy link
Member Author

Have you checked the performance of new version description?

Good point! I am planning to check the performance of different descriptions later. As parameter description and returned result is missing now, can we include these information and replace the current description with the new description following hugging face format?

@Hailong-am
Copy link
Contributor

integration test depends on k-NN PR to merged opensearch-project/k-NN#1383

Copy link
Member

@ohltyler ohltyler left a comment

Choose a reason for hiding this comment

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

Few nits, overall LGTM as a starting point that we can tune later. Can you also include a similar description style for the search alerts tool? That will cover all of the AD and alerting tools.

@@ -48,7 +48,8 @@
@ToolAnnotation(SearchAnomalyDetectorsTool.TYPE)
public class SearchAnomalyDetectorsTool implements Tool {
public static final String TYPE = "SearchAnomalyDetectorsTool";
private static final String DEFAULT_DESCRIPTION = "Use this tool to search anomaly detectors.";
private static final String DEFAULT_DESCRIPTION =
"This is a tool that searches anomaly detectors. It takes 12 optional arguments named detectorName which is the explicit name of the monitor (default is null), and detectorNamePattern which is a wildcard query to match detector name (default is null), and indices which defines the index being detected (default is null), and highCardinality which defines whether the anomaly detector is high cardinality (default is null), and lastUpdateTime which defines the latest update time of the anomaly detector (default is null), and sortOrder which defines the order of the results (options are asc or desc, and default is asc), and sortString which defines how to sort the results (default is name.keyword), and size which defines the size of the request to be returned (default is 20), and startIndex which defines the index to start from (default is 0), and running which defines whether the anomaly detector is running (default is null, indicating both), and disabled which defines whether the anomaly detector is disabled (default is null, indicating both), and failed which defines whether the anomaly detector has failed (default is null, indicating both). The tool returns the a list of anomaly detectors.";
Copy link
Member

Choose a reason for hiding this comment

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

nit: Should be "returns the list of anomaly detectors, and the total number of anomaly detectors" for the last sentence

@@ -39,7 +39,8 @@
@ToolAnnotation(SearchAnomalyResultsTool.TYPE)
public class SearchAnomalyResultsTool implements Tool {
public static final String TYPE = "SearchAnomalyResultsTool";
private static final String DEFAULT_DESCRIPTION = "Use this tool to search anomaly results.";
private static final String DEFAULT_DESCRIPTION =
"This is a tool that searches anomaly results. It takes 9 arguments named detectorId which defines the detector ID to filter for (default is null), and realtime which defines whether the anomaly is real time, and anomalyGradeThreshold which defines the threshold for anomaly grade (a number between 0 and 1 that indicates how anomalous a data point is) (default is 0), and dataStartTime which defines the start time of the anomaly query (default is null), and dataEndTime which defines the end time of the anomaly query (default is null), and sortOrder which defines the order of the results (options are asc or desc, and default is desc), and sortString which which defines how to sort the results (default is data_start_time), and size which defines the size of the request to be returned (default is 20), and startIndex which defines the index to start from (default is 0).The tool returns a list of anomaly results.";
Copy link
Member

Choose a reason for hiding this comment

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

Same thing as previous comment - maybe something like "The tool returns a list of anomaly results, and the total number of anomaly results"

@@ -44,7 +44,8 @@
@ToolAnnotation(SearchMonitorsTool.TYPE)
public class SearchMonitorsTool implements Tool {
public static final String TYPE = "SearchMonitorsTool";
private static final String DEFAULT_DESCRIPTION = "Use this tool to search alerting monitors.";
private static final String DEFAULT_DESCRIPTION =
"This is a tool that searches alerting monitors. It takes 10 optional arguments named monitorId which defines the monitor ID to filter for (default is null), and monitorName which defines explicit name of the monitor (default is null), and monitorNamePattern which is a wildcard query to match detector name (default is null), and enabled which defines whether the monitor is enabled (default is null, indicating both), and hasTriggers which defines whether the monitor has triggers enabled (default is null, indicating both), and indices which defines the index being monitored (default is null), and sortOrder which defines the order of the results (options are asc or desc, and default is asc), and sortString which defines how to sort the results (default is name.keyword), and size which defines the size of the request to be returned (default is 20), and startIndex which defines the index to start from (default is 0). The tool returns a list of monitors.";
Copy link
Member

Choose a reason for hiding this comment

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

Same thing as previous comment - maybe something like "The tool returns a list of monitors, and the total number of monitors"

@yuye-aws
Copy link
Member Author

Thanks for the review comment. I will

Few nits, overall LGTM as a starting point that we can tune later. Can you also include a similar description style for the search alerts tool? That will cover all of the AD and alerting tools.

I will include the change on search alerts tool in this PR. Please help review, thanks!

@yuye-aws
Copy link
Member Author

Thanks for supplementing description on tool return results. I will apply your change.

Copy link

codecov bot commented Jan 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cf20a00) 81.23% compared to head (6c8c705) 80.82%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #120      +/-   ##
============================================
- Coverage     81.23%   80.82%   -0.42%     
  Complexity      193      193              
============================================
  Files            13       13              
  Lines           975      975              
  Branches        130      130              
============================================
- Hits            792      788       -4     
- Misses          133      137       +4     
  Partials         50       50              

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

@yuye-aws
Copy link
Member Author

@ohltyler I have included description on search alert tool and updated description on returned results from tools. This PR is ready for review now.

@yuye-aws yuye-aws requested a review from ohltyler January 12, 2024 05:48
Copy link
Member

@ohltyler ohltyler left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks again for helping out on this!

@ohltyler ohltyler merged commit c8b6898 into opensearch-project:main Jan 12, 2024
13 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 12, 2024
Signed-off-by: yuye-aws <[email protected]>
(cherry picked from commit c8b6898)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ohltyler pushed a commit that referenced this pull request Jan 12, 2024
(cherry picked from commit c8b6898)

Signed-off-by: yuye-aws <[email protected]>
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>
yuye-aws pushed a commit to yuye-aws/skills that referenced this pull request Apr 26, 2024
…h-project#120) (opensearch-project#126)

(cherry picked from commit c8b6898)

Signed-off-by: yuye-aws <[email protected]>
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>
Signed-off-by: yuye-aws <[email protected]>
@yuye-aws yuye-aws deleted the feature/descriptionOnMonitorAndAD branch November 21, 2024 03:24
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.

4 participants