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

Add model related field for tools #491

Merged
merged 9 commits into from
Jan 26, 2025

Conversation

xinyual
Copy link
Collaborator

@xinyual xinyual commented Jan 24, 2025

Description

To check downstream task before deleting, we need to add list of model related fields for model related tools. The background PR is: opensearch-project/ml-commons#3209

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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: xinyual <[email protected]>
// the type of this tool
public static final String TYPE = "CreateAnomalyDetectorTool";

public static final String MODEL_ID_FIELD = "model_id";
Copy link
Member

Choose a reason for hiding this comment

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

Can we use this static variable to replace "model_id" constant in factory?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see this constant been used in multiple classes, let's create a common constant class, eg. CommonConstants to put it there, and that class can be used to put more global constants in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see this constant been used in multiple classes, let's create a common constant class, eg. CommonConstants to put it there, and that class can be used to put more global constants in the future.

I think each tool should have its own related tool field so we cannot use a generate one for all tools

Copy link
Collaborator

Choose a reason for hiding this comment

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

@zhichao-aws
Copy link
Member

It seems we have a compile error. Please fix it before merge.

/Users/runner/work/skills/skills/src/main/java/org/opensearch/agent/tools/VectorDBTool.java:115: error: Factory cannot be inherited with different arguments: <org.opensearch.agent.tools.NeuralSparseSearchTool> and <org.opensearch.agent.tools.VectorDBTool>
    public static class Factory extends AbstractRetrieverTool.Factory<VectorDBTool>

Signed-off-by: xinyual <[email protected]>
Signed-off-by: xinyual <[email protected]>
Signed-off-by: xinyual <[email protected]>
Copy link

codecov bot commented Jan 24, 2025

Codecov Report

Attention: Patch coverage is 65.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 81.90%. Comparing base (2b76e3c) to head (c67debe).
Report is 43 commits behind head on main.

Files with missing lines Patch % Lines
...va/org/opensearch/agent/tools/CreateAlertTool.java 66.66% 1 Missing ⚠️
...nsearch/agent/tools/CreateAnomalyDetectorTool.java 66.66% 1 Missing ⚠️
...opensearch/agent/tools/NeuralSparseSearchTool.java 66.66% 1 Missing ⚠️
.../main/java/org/opensearch/agent/tools/PPLTool.java 66.66% 1 Missing ⚠️
.../main/java/org/opensearch/agent/tools/RAGTool.java 75.00% 1 Missing ⚠️
.../java/org/opensearch/agent/tools/VectorDBTool.java 66.66% 1 Missing ⚠️
.../opensearch/agent/tools/utils/CommonConstants.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #491      +/-   ##
============================================
+ Coverage     81.78%   81.90%   +0.11%     
- Complexity      193      335     +142     
============================================
  Files            11       17       +6     
  Lines           961     1586     +625     
  Branches        137      222      +85     
============================================
+ Hits            786     1299     +513     
- Misses          121      201      +80     
- Partials         54       86      +32     

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

Signed-off-by: xinyual <[email protected]>
Signed-off-by: xinyual <[email protected]>
@xinyual xinyual merged commit a2f9e2c into opensearch-project:main Jan 26, 2025
9 of 10 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 26, 2025
* add related model fields list

Signed-off-by: xinyual <[email protected]>

* apply spotless

Signed-off-by: xinyual <[email protected]>

* fix compile error

Signed-off-by: xinyual <[email protected]>

* use static parameter

Signed-off-by: xinyual <[email protected]>

* apply spotless

Signed-off-by: xinyual <[email protected]>

* create a common constant for common model id

Signed-off-by: xinyual <[email protected]>

* fix error

Signed-off-by: xinyual <[email protected]>

* fix UT error

Signed-off-by: xinyual <[email protected]>

---------

Signed-off-by: xinyual <[email protected]>
(cherry picked from commit a2f9e2c)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
xinyual pushed a commit that referenced this pull request Jan 26, 2025
* add related model fields list



* apply spotless



* fix compile error



* use static parameter



* apply spotless



* create a common constant for common model id



* fix error



* fix UT error



---------


(cherry picked from commit a2f9e2c)

Signed-off-by: xinyual <[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>
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