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

throw exception if remote model doesn't return 2xx status code; fix p… #1473

Merged
merged 4 commits into from
Oct 10, 2023

Conversation

ylwu-amzn
Copy link
Collaborator

@ylwu-amzn ylwu-amzn commented Oct 10, 2023

…dict runner

Description

  1. Throw exception if remote model doesn't return 2xx status code, for example invalid credential, exceed throttling limit.
  2. Fix predict runner: if predict is null, will directly return, otherwise will try to read model and predict,
  3. Check if task is in cache or not before updating to avoid "Task not found" error.
  4. Support generate embeddings for multiple docs for remote embedding model. Which was disabled by this PR Add neural search default processor for non OpenAI/Cohere scenario #1274

Test

bulk ingestion with invalid credential
Screenshot 2023-10-10 at 9 46 27 AM
bulk ingestion with throttling error
Screenshot 2023-10-10 at 4 26 03 AM

Reindex data from raw text to KNN index
Screenshot 2023-10-10 at 1 15 40 PM

neural search
Screenshot 2023-10-10 at 1 16 52 PM

neural search with exception

Screenshot 2023-10-10 at 1 49 51 PM

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.

…redict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env October 10, 2023 11:04 — with GitHub Actions Inactive
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env October 10, 2023 11:04 — with GitHub Actions Inactive
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env October 10, 2023 11:04 — with GitHub Actions Inactive
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env October 10, 2023 11:04 — with GitHub Actions Inactive
@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

Merging #1473 (d9c920c) into 2.9 (5fc555d) will decrease coverage by 0.02%.
The diff coverage is 44.44%.

❗ Current head d9c920c differs from pull request most recent head c52b1bf. Consider uploading reports for the commit c52b1bf to get more accurate results

@@             Coverage Diff              @@
##                2.9    #1473      +/-   ##
============================================
- Coverage     78.73%   78.71%   -0.02%     
- Complexity     2163     2166       +3     
============================================
  Files           168      168              
  Lines          8784     8792       +8     
  Branches        879      882       +3     
============================================
+ Hits           6916     6921       +5     
- Misses         1470     1471       +1     
- Partials        398      400       +2     
Flag Coverage Δ
ml-commons 78.71% <44.44%> (-0.02%) ⬇️

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

Files Coverage Δ
...engine/algorithms/remote/AwsConnectorExecutor.java 81.81% <50.00%> (-1.21%) ⬇️
...ch/ml/engine/algorithms/remote/ConnectorUtils.java 59.78% <0.00%> (ø)
...e/algorithms/remote/HttpJsonConnectorExecutor.java 66.66% <75.00%> (ø)
...n/java/org/opensearch/ml/model/MLModelManager.java 63.36% <0.00%> (ø)
...va/org/opensearch/ml/task/MLPredictTaskRunner.java 82.31% <40.00%> (-0.33%) ⬇️

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env October 10, 2023 11:55 — with GitHub Actions Inactive
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env October 10, 2023 11:55 — with GitHub Actions Inactive
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env October 10, 2023 17:34 — with GitHub Actions Inactive
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env October 10, 2023 17:34 — with GitHub Actions Inactive
Copy link
Contributor

@navneet1v navneet1v left a comment

Choose a reason for hiding this comment

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

Have we tested with the clients that they are able to handle the exception and throw the right exception to customer?

@ylwu-amzn
Copy link
Collaborator Author

Have we tested with the clients that they are able to handle the exception and throw the right exception to customer?

Yes , check the screenshot for bulk ingestion, which will invoke neural-search ingest process.

@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env October 10, 2023 18:04 — with GitHub Actions Inactive
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env October 10, 2023 18:04 — with GitHub Actions Inactive
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env October 10, 2023 18:04 — with GitHub Actions Inactive
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env October 10, 2023 18:04 — with GitHub Actions Inactive
@navneet1v
Copy link
Contributor

@ylwu-amzn can we test few of these cases:

  1. Can we test the search behavior also
  2. Can we also test a reindex usecase here.

@@ -101,6 +101,9 @@ public void invokeRemoteModel(MLInput mlInput, Map<String, String> parameters, S
throw new OpenSearchStatusException("No response from model", RestStatus.BAD_REQUEST);
}
String modelResponse = responseBuilder.toString();
if (statusCode < 200 || statusCode >= 300) {
Copy link
Contributor

@navneet1v navneet1v Oct 10, 2023

Choose a reason for hiding this comment

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

is there a reason why are not throwing exception for 201 or other status code? 200 seems to be the only case in which we should not throw exception.

Or another way to ask is can a remote model give 201 status code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That depends on the remote model service to determine return 200 or other 2xx code.

Check HTTP RFC

2xx (Successful): The request was successfully received,
understood, and accepted

Copy link
Contributor

Choose a reason for hiding this comment

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

So we are treating all 2XX as successful response.

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, because that's what HTTP RFC defines

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
@ylwu-amzn
Copy link
Collaborator Author

@ylwu-amzn can we test few of these cases:

  1. Can we test the search behavior also
  2. Can we also test a reindex usecase here.

Done, check the description part

@ylwu-amzn
Copy link
Collaborator Author

@ylwu-amzn can we test few of these cases:

  1. Can we test the search behavior also
  2. Can we also test a reindex usecase here.

Done, check the description part

I don't see the error image with neural search search query.

Test with same model , bulk ingest will throw error

{
  "errors": true,
  "ingest_took": 97,
  "items": [
    {
      "index": {
        "_id": null,
        "_index": "semantic_demostore_ylwu_cohere",
        "error": {
          "reason": "{\"message\":\"You are using a Trial key, which is limited to 1000 API calls / month. You can continue to use the Trial key for free or upgrade to a Production key with higher rate limits at 'https://dashboard.cohere.ai/api-keys'. Contact us on 'https://discord.gg/XW44jPfYJu' or email us at support@cohere.com with any questions\"}",
          "type": "status_exception"
        },
        "status": 429
      }
    },

Reindex does not

{
  "batches": 1,
  "created": 3,
  "deleted": 0,
  "failures": [],
  "noops": 0,
  "requests_per_second": -1.0,
  "retries": {
    "bulk": 1,
    "search": 0
  },
  "throttled_millis": 0,
  "throttled_until_millis": 0,
  "timed_out": false,
  "took": 694,
  "total": 3,
  "updated": 0,
  "version_conflicts": 0
}

Need neural-search team to help deep dive more. ml-commons does throw out exception as you can see in bulk ingestion result, but reindex part not show the error message

@ylwu-amzn
Copy link
Collaborator Author

Also is it expected that github workflows will fail?

Fixed. local build passed, let's see Github CI can pass or not

@navneet1v
Copy link
Contributor

@ylwu-amzn can we test few of these cases:

  1. Can we test the search behavior also
  2. Can we also test a reindex usecase here.

Done, check the description part

I don't see the error image with neural search search query.

Test with same model , bulk ingest will throw error

{
  "errors": true,
  "ingest_took": 97,
  "items": [
    {
      "index": {
        "_id": null,
        "_index": "semantic_demostore_ylwu_cohere",
        "error": {
          "reason": "{\"message\":\"You are using a Trial key, which is limited to 1000 API calls / month. You can continue to use the Trial key for free or upgrade to a Production key with higher rate limits at 'https://dashboard.cohere.ai/api-keys'. Contact us on 'https://discord.gg/XW44jPfYJu' or email us at support@cohere.com with any questions\"}",
          "type": "status_exception"
        },
        "status": 429
      }
    },

Reindex does not

{
  "batches": 1,
  "created": 3,
  "deleted": 0,
  "failures": [],
  "noops": 0,
  "requests_per_second": -1.0,
  "retries": {
    "bulk": 1,
    "search": 0
  },
  "throttled_millis": 0,
  "throttled_until_millis": 0,
  "timed_out": false,
  "took": 694,
  "total": 3,
  "updated": 0,
  "version_conflicts": 0
}

Need neural-search team to help deep dive more. ml-commons does throw out exception as you can see in bulk ingestion result, but reindex part not show the error message

The way you tested with the successful query can we test with the error being thrown from ML commons when request for predict api is for search.

@navneet1v
Copy link
Contributor

@ylwu-amzn can we test few of these cases:

  1. Can we test the search behavior also
  2. Can we also test a reindex usecase here.

Done, check the description part

I don't see the error image with neural search search query.

Test with same model , bulk ingest will throw error

{
  "errors": true,
  "ingest_took": 97,
  "items": [
    {
      "index": {
        "_id": null,
        "_index": "semantic_demostore_ylwu_cohere",
        "error": {
          "reason": "{\"message\":\"You are using a Trial key, which is limited to 1000 API calls / month. You can continue to use the Trial key for free or upgrade to a Production key with higher rate limits at 'https://dashboard.cohere.ai/api-keys'. Contact us on 'https://discord.gg/XW44jPfYJu' or email us at support@cohere.com with any questions\"}",
          "type": "status_exception"
        },
        "status": 429
      }
    },

Reindex does not

{
  "batches": 1,
  "created": 3,
  "deleted": 0,
  "failures": [],
  "noops": 0,
  "requests_per_second": -1.0,
  "retries": {
    "bulk": 1,
    "search": 0
  },
  "throttled_millis": 0,
  "throttled_until_millis": 0,
  "timed_out": false,
  "took": 694,
  "total": 3,
  "updated": 0,
  "version_conflicts": 0
}

Need neural-search team to help deep dive more. ml-commons does throw out exception as you can see in bulk ingestion result, but reindex part not show the error message

The way you tested with the successful query can we test with the error being thrown from ML commons when request for predict api is for search.

uploading from chat with @ylwu-amzn

Screenshot 2023-10-10 at 1 49 51 PM

@ylwu-amzn ylwu-amzn merged commit 513ca39 into opensearch-project:2.9 Oct 10, 2023
8 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.11 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.11 2.11
# Navigate to the new working tree
cd .worktrees/backport-2.11
# Create a new branch
git switch --create backport/backport-1473-to-2.11
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 513ca39cafba612b93cd19473b7e83c3c6670032
# Push it to GitHub
git push --set-upstream origin backport/backport-1473-to-2.11
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.11

Then, create a pull request where the base branch is 2.11 and the compare/head branch is backport/backport-1473-to-2.11.

ylwu-amzn added a commit to ylwu-amzn/ml-commons that referenced this pull request Oct 10, 2023
opensearch-project#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
ylwu-amzn added a commit that referenced this pull request Oct 10, 2023
… status code; fix p… (#1477)

* throw exception if remote model doesn't return 2xx status code; fix p… (#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 12, 2023
… status code; fix p… (#1477)

* throw exception if remote model doesn't return 2xx status code; fix p… (#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 201c8a8)
ylwu-amzn added a commit that referenced this pull request Oct 12, 2023
… status code; fix p… (#1477) (#1509)

* throw exception if remote model doesn't return 2xx status code; fix p… (#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 201c8a8)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>
rbhavna pushed a commit to rbhavna/ml-commons that referenced this pull request Nov 16, 2023
… status code; fix p… (opensearch-project#1477) (opensearch-project#1509)

* throw exception if remote model doesn't return 2xx status code; fix p… (opensearch-project#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 201c8a8)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>
rbhavna pushed a commit to rbhavna/ml-commons that referenced this pull request Nov 16, 2023
… status code; fix p… (opensearch-project#1477) (opensearch-project#1509)

* throw exception if remote model doesn't return 2xx status code; fix p… (opensearch-project#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 201c8a8)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>
ylwu-amzn added a commit that referenced this pull request Nov 17, 2023
* fix parameter name in preprocess function; fix remote model function … (#1362)

* fix parameter name in preprocess function; fix remote model function name

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix failed unit test

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* throw exception when model group not found during update request (#1447)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* add status code to model tensor (#1443) (#1453)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* register new versions to a model group based on the name provided (#1452)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* fixing metrics correlation algorithm (#1448)

* fixing metrics correlation algorithm

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>

* if model version fails to register, update model group accordingly (#1463)

* if model version fails to register, update model group accordingly

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Update Model API (#1350)

* Update Model API POC

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Using GetRequest to get model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Finalize model update API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compileTest

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add Unit Test Cases for Update Model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Tune back test coverage thereshold

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit tests on Update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add unit test for TransportUpdateModelAction class

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix a test error

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change exception thrown to failure response

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Move the function judgement to the outter block

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Check if model is undeployed before update model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit test for update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix unit test due to blocking java 11 CI workflow

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling auto bumping model version during registering to a new model group and address reviewers' other concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Autobump new model groups' latest version when register to a new model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the REST API method from POST to PUT

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the update REST API endpoint

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add a setting to control the update connector API (#1465)

* Add a setting to control the update connector API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in corresponding unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* fix update connector API (#1484)

* fix update connector API

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* Performance enhacement for predict action by caching model info (#1472) (#1508)

* Performance enhacement for predict action by caching model info

Signed-off-by: zane-neo <zaniu@amazon.com>

* Add context.restore() to avoid missing info

Signed-off-by: zane-neo <zaniu@amazon.com>

---------

Signed-off-by: zane-neo <zaniu@amazon.com>
(cherry picked from commit a985f6e)

Co-authored-by: zane-neo <zaniu@amazon.com>

* fix failed ut from PR 1472 (#1479) (#1510)

* fix failed ut from PR 1472

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* exclude class for low coverage

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit da5d829)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* [Backport to 2.11] throw exception if remote model doesn't return 2xx status code; fix p… (#1477) (#1509)

* throw exception if remote model doesn't return 2xx status code; fix p… (#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 201c8a8)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix no worker node exception for remote embedding model (#1482) (#1511)

* fix no worker node exception for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* only add model info to cache if model cache exist

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 6f83b9f)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix for delete model group API throwing incorrect error when model index not created (#1485) (#1486) (#1512)

* fix for delete model group API throwing incorrect error when model index not created

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 60ef0fd)

Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 5544681)

Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>

* fix no worker node error on multi-node cluster (#1487) (#1513)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit cea1cd6)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* add prefix to show the error is from remote service (#1499) (#1515)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 3897ad1)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix multiple docs support (#1516)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* adding another fix issue to the release note (#1498) (#1514)

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
(cherry picked from commit 440155c)

Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>

* add bedrockURL to trusted connector regex list (#1461)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* return parsing exception 400 for parsing errors

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* add more ut in restupdateconnector

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* fix format violations

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Fix model/connector update API to address security concern (#1595)

* Fix model/connector update API to address appsec concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile and build failure

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Improve unit test coverage

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix spotless

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Merge update connector feature flag to remote inference feature flag

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Keep fixing exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Spotless fix

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add UT on parsing exception

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* change XContentFactory to MediaTypeRegistry builder in MLRegisterModelInputTest class

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>
ylwu-amzn added a commit that referenced this pull request Nov 20, 2023
… status code; fix p… (#1477) (#1509)

* throw exception if remote model doesn't return 2xx status code; fix p… (#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 201c8a8)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>
dhrubo-os added a commit that referenced this pull request Jan 4, 2024
* Backport multiple PRs to main from 2.x (#1652)

* fix parameter name in preprocess function; fix remote model function … (#1362)

* fix parameter name in preprocess function; fix remote model function name

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix failed unit test

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* throw exception when model group not found during update request (#1447)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* add status code to model tensor (#1443) (#1453)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* register new versions to a model group based on the name provided (#1452)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* fixing metrics correlation algorithm (#1448)

* fixing metrics correlation algorithm

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>

* if model version fails to register, update model group accordingly (#1463)

* if model version fails to register, update model group accordingly

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Update Model API (#1350)

* Update Model API POC

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Using GetRequest to get model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Finalize model update API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compileTest

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add Unit Test Cases for Update Model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Tune back test coverage thereshold

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit tests on Update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add unit test for TransportUpdateModelAction class

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix a test error

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change exception thrown to failure response

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Move the function judgement to the outter block

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Check if model is undeployed before update model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit test for update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix unit test due to blocking java 11 CI workflow

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling auto bumping model version during registering to a new model group and address reviewers' other concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Autobump new model groups' latest version when register to a new model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the REST API method from POST to PUT

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the update REST API endpoint

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add a setting to control the update connector API (#1465)

* Add a setting to control the update connector API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in corresponding unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* fix update connector API (#1484)

* fix update connector API

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* Performance enhacement for predict action by caching model info (#1472) (#1508)

* Performance enhacement for predict action by caching model info

Signed-off-by: zane-neo <zaniu@amazon.com>

* Add context.restore() to avoid missing info

Signed-off-by: zane-neo <zaniu@amazon.com>

---------

Signed-off-by: zane-neo <zaniu@amazon.com>
(cherry picked from commit a985f6e)

Co-authored-by: zane-neo <zaniu@amazon.com>

* fix failed ut from PR 1472 (#1479) (#1510)

* fix failed ut from PR 1472

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* exclude class for low coverage

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit da5d829)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* [Backport to 2.11] throw exception if remote model doesn't return 2xx status code; fix p… (#1477) (#1509)

* throw exception if remote model doesn't return 2xx status code; fix p… (#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 201c8a8)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix no worker node exception for remote embedding model (#1482) (#1511)

* fix no worker node exception for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* only add model info to cache if model cache exist

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 6f83b9f)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix for delete model group API throwing incorrect error when model index not created (#1485) (#1486) (#1512)

* fix for delete model group API throwing incorrect error when model index not created

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 60ef0fd)

Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 5544681)

Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>

* fix no worker node error on multi-node cluster (#1487) (#1513)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit cea1cd6)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* add prefix to show the error is from remote service (#1499) (#1515)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 3897ad1)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix multiple docs support (#1516)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* adding another fix issue to the release note (#1498) (#1514)

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
(cherry picked from commit 440155c)

Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>

* add bedrockURL to trusted connector regex list (#1461)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* return parsing exception 400 for parsing errors

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* add more ut in restupdateconnector

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* fix format violations

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Fix model/connector update API to address security concern (#1595)

* Fix model/connector update API to address appsec concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile and build failure

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Improve unit test coverage

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix spotless

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Merge update connector feature flag to remote inference feature flag

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Keep fixing exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Spotless fix

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add UT on parsing exception

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* change XContentFactory to MediaTypeRegistry builder in MLRegisterModelInputTest class

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>

* Updated OpenSearch Lucene snapshot location

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>
Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 4, 2024
* Backport multiple PRs to main from 2.x (#1652)

* fix parameter name in preprocess function; fix remote model function … (#1362)

* fix parameter name in preprocess function; fix remote model function name

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix failed unit test

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* throw exception when model group not found during update request (#1447)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* add status code to model tensor (#1443) (#1453)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* register new versions to a model group based on the name provided (#1452)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* fixing metrics correlation algorithm (#1448)

* fixing metrics correlation algorithm

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>

* if model version fails to register, update model group accordingly (#1463)

* if model version fails to register, update model group accordingly

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Update Model API (#1350)

* Update Model API POC

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Using GetRequest to get model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Finalize model update API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compileTest

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add Unit Test Cases for Update Model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Tune back test coverage thereshold

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit tests on Update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add unit test for TransportUpdateModelAction class

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix a test error

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change exception thrown to failure response

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Move the function judgement to the outter block

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Check if model is undeployed before update model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit test for update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix unit test due to blocking java 11 CI workflow

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling auto bumping model version during registering to a new model group and address reviewers' other concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Autobump new model groups' latest version when register to a new model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the REST API method from POST to PUT

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the update REST API endpoint

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add a setting to control the update connector API (#1465)

* Add a setting to control the update connector API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in corresponding unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* fix update connector API (#1484)

* fix update connector API

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* Performance enhacement for predict action by caching model info (#1472) (#1508)

* Performance enhacement for predict action by caching model info

Signed-off-by: zane-neo <zaniu@amazon.com>

* Add context.restore() to avoid missing info

Signed-off-by: zane-neo <zaniu@amazon.com>

---------

Signed-off-by: zane-neo <zaniu@amazon.com>
(cherry picked from commit a985f6e)

Co-authored-by: zane-neo <zaniu@amazon.com>

* fix failed ut from PR 1472 (#1479) (#1510)

* fix failed ut from PR 1472

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* exclude class for low coverage

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit da5d829)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* [Backport to 2.11] throw exception if remote model doesn't return 2xx status code; fix p… (#1477) (#1509)

* throw exception if remote model doesn't return 2xx status code; fix p… (#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 201c8a8)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix no worker node exception for remote embedding model (#1482) (#1511)

* fix no worker node exception for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* only add model info to cache if model cache exist

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 6f83b9f)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix for delete model group API throwing incorrect error when model index not created (#1485) (#1486) (#1512)

* fix for delete model group API throwing incorrect error when model index not created

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 60ef0fd)

Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 5544681)

Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>

* fix no worker node error on multi-node cluster (#1487) (#1513)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit cea1cd6)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* add prefix to show the error is from remote service (#1499) (#1515)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 3897ad1)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix multiple docs support (#1516)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* adding another fix issue to the release note (#1498) (#1514)

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
(cherry picked from commit 440155c)

Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>

* add bedrockURL to trusted connector regex list (#1461)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* return parsing exception 400 for parsing errors

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* add more ut in restupdateconnector

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* fix format violations

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Fix model/connector update API to address security concern (#1595)

* Fix model/connector update API to address appsec concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile and build failure

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Improve unit test coverage

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix spotless

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Merge update connector feature flag to remote inference feature flag

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Keep fixing exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Spotless fix

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add UT on parsing exception

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* change XContentFactory to MediaTypeRegistry builder in MLRegisterModelInputTest class

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>

* Updated OpenSearch Lucene snapshot location

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>
Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>
(cherry picked from commit 8352e69)
Zhangxunmt pushed a commit that referenced this pull request Jan 4, 2024
* Backport multiple PRs to main from 2.x (#1652)

* fix parameter name in preprocess function; fix remote model function … (#1362)

* fix parameter name in preprocess function; fix remote model function name

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix failed unit test

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* throw exception when model group not found during update request (#1447)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* add status code to model tensor (#1443) (#1453)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* register new versions to a model group based on the name provided (#1452)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* fixing metrics correlation algorithm (#1448)

* fixing metrics correlation algorithm

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>

* if model version fails to register, update model group accordingly (#1463)

* if model version fails to register, update model group accordingly

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Update Model API (#1350)

* Update Model API POC

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Using GetRequest to get model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Finalize model update API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compileTest

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add Unit Test Cases for Update Model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Tune back test coverage thereshold

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit tests on Update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add unit test for TransportUpdateModelAction class

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix a test error

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change exception thrown to failure response

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Move the function judgement to the outter block

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Check if model is undeployed before update model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit test for update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix unit test due to blocking java 11 CI workflow

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling auto bumping model version during registering to a new model group and address reviewers' other concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Autobump new model groups' latest version when register to a new model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the REST API method from POST to PUT

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the update REST API endpoint

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add a setting to control the update connector API (#1465)

* Add a setting to control the update connector API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in corresponding unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* fix update connector API (#1484)

* fix update connector API

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* Performance enhacement for predict action by caching model info (#1472) (#1508)

* Performance enhacement for predict action by caching model info

Signed-off-by: zane-neo <zaniu@amazon.com>

* Add context.restore() to avoid missing info

Signed-off-by: zane-neo <zaniu@amazon.com>

---------

Signed-off-by: zane-neo <zaniu@amazon.com>
(cherry picked from commit a985f6e)

Co-authored-by: zane-neo <zaniu@amazon.com>

* fix failed ut from PR 1472 (#1479) (#1510)

* fix failed ut from PR 1472

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* exclude class for low coverage

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit da5d829)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* [Backport to 2.11] throw exception if remote model doesn't return 2xx status code; fix p… (#1477) (#1509)

* throw exception if remote model doesn't return 2xx status code; fix p… (#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 201c8a8)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix no worker node exception for remote embedding model (#1482) (#1511)

* fix no worker node exception for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* only add model info to cache if model cache exist

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 6f83b9f)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix for delete model group API throwing incorrect error when model index not created (#1485) (#1486) (#1512)

* fix for delete model group API throwing incorrect error when model index not created

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 60ef0fd)

Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 5544681)

Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>

* fix no worker node error on multi-node cluster (#1487) (#1513)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit cea1cd6)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* add prefix to show the error is from remote service (#1499) (#1515)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 3897ad1)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix multiple docs support (#1516)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* adding another fix issue to the release note (#1498) (#1514)

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
(cherry picked from commit 440155c)

Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>

* add bedrockURL to trusted connector regex list (#1461)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* return parsing exception 400 for parsing errors

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* add more ut in restupdateconnector

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* fix format violations

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Fix model/connector update API to address security concern (#1595)

* Fix model/connector update API to address appsec concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile and build failure

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Improve unit test coverage

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix spotless

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Merge update connector feature flag to remote inference feature flag

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Keep fixing exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Spotless fix

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add UT on parsing exception

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* change XContentFactory to MediaTypeRegistry builder in MLRegisterModelInputTest class

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>

* Updated OpenSearch Lucene snapshot location

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>
Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>
(cherry picked from commit 8352e69)

Co-authored-by: Owais Kazi <owaiskazi19@gmail.com>
ylwu-amzn added a commit that referenced this pull request Feb 1, 2024
* Backport multiple PRs to main from 2.x (#1652)

* fix parameter name in preprocess function; fix remote model function … (#1362)

* fix parameter name in preprocess function; fix remote model function name

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix failed unit test

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* throw exception when model group not found during update request (#1447)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* add status code to model tensor (#1443) (#1453)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* register new versions to a model group based on the name provided (#1452)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* fixing metrics correlation algorithm (#1448)

* fixing metrics correlation algorithm

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>

* if model version fails to register, update model group accordingly (#1463)

* if model version fails to register, update model group accordingly

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Update Model API (#1350)

* Update Model API POC

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Using GetRequest to get model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Finalize model update API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compileTest

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add Unit Test Cases for Update Model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Tune back test coverage thereshold

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit tests on Update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add unit test for TransportUpdateModelAction class

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix a test error

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change exception thrown to failure response

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Move the function judgement to the outter block

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Check if model is undeployed before update model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit test for update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix unit test due to blocking java 11 CI workflow

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling auto bumping model version during registering to a new model group and address reviewers' other concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Autobump new model groups' latest version when register to a new model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the REST API method from POST to PUT

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the update REST API endpoint

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add a setting to control the update connector API (#1465)

* Add a setting to control the update connector API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in corresponding unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* fix update connector API (#1484)

* fix update connector API

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* Performance enhacement for predict action by caching model info (#1472) (#1508)

* Performance enhacement for predict action by caching model info

Signed-off-by: zane-neo <zaniu@amazon.com>

* Add context.restore() to avoid missing info

Signed-off-by: zane-neo <zaniu@amazon.com>

---------

Signed-off-by: zane-neo <zaniu@amazon.com>
(cherry picked from commit a985f6e)

Co-authored-by: zane-neo <zaniu@amazon.com>

* fix failed ut from PR 1472 (#1479) (#1510)

* fix failed ut from PR 1472

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* exclude class for low coverage

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit da5d829)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* [Backport to 2.11] throw exception if remote model doesn't return 2xx status code; fix p… (#1477) (#1509)

* throw exception if remote model doesn't return 2xx status code; fix p… (#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 201c8a8)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix no worker node exception for remote embedding model (#1482) (#1511)

* fix no worker node exception for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* only add model info to cache if model cache exist

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 6f83b9f)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix for delete model group API throwing incorrect error when model index not created (#1485) (#1486) (#1512)

* fix for delete model group API throwing incorrect error when model index not created

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 60ef0fd)

Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 5544681)

Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>

* fix no worker node error on multi-node cluster (#1487) (#1513)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit cea1cd6)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* add prefix to show the error is from remote service (#1499) (#1515)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 3897ad1)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix multiple docs support (#1516)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* adding another fix issue to the release note (#1498) (#1514)

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
(cherry picked from commit 440155c)

Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>

* add bedrockURL to trusted connector regex list (#1461)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* return parsing exception 400 for parsing errors

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* add more ut in restupdateconnector

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* fix format violations

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Fix model/connector update API to address security concern (#1595)

* Fix model/connector update API to address appsec concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile and build failure

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Improve unit test coverage

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix spotless

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Merge update connector feature flag to remote inference feature flag

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Keep fixing exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Spotless fix

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add UT on parsing exception

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* change XContentFactory to MediaTypeRegistry builder in MLRegisterModelInputTest class

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>

* Allow model setting to transport from rest

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

* Added test

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

* Fixed integ test

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>
Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Feb 1, 2024
* Backport multiple PRs to main from 2.x (#1652)

* fix parameter name in preprocess function; fix remote model function … (#1362)

* fix parameter name in preprocess function; fix remote model function name

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix failed unit test

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* throw exception when model group not found during update request (#1447)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* add status code to model tensor (#1443) (#1453)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* register new versions to a model group based on the name provided (#1452)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* fixing metrics correlation algorithm (#1448)

* fixing metrics correlation algorithm

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>

* if model version fails to register, update model group accordingly (#1463)

* if model version fails to register, update model group accordingly

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Update Model API (#1350)

* Update Model API POC

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Using GetRequest to get model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Finalize model update API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compileTest

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add Unit Test Cases for Update Model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Tune back test coverage thereshold

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit tests on Update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add unit test for TransportUpdateModelAction class

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix a test error

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change exception thrown to failure response

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Move the function judgement to the outter block

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Check if model is undeployed before update model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit test for update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix unit test due to blocking java 11 CI workflow

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling auto bumping model version during registering to a new model group and address reviewers' other concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Autobump new model groups' latest version when register to a new model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the REST API method from POST to PUT

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the update REST API endpoint

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add a setting to control the update connector API (#1465)

* Add a setting to control the update connector API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in corresponding unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* fix update connector API (#1484)

* fix update connector API

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* Performance enhacement for predict action by caching model info (#1472) (#1508)

* Performance enhacement for predict action by caching model info

Signed-off-by: zane-neo <zaniu@amazon.com>

* Add context.restore() to avoid missing info

Signed-off-by: zane-neo <zaniu@amazon.com>

---------

Signed-off-by: zane-neo <zaniu@amazon.com>
(cherry picked from commit a985f6e)

Co-authored-by: zane-neo <zaniu@amazon.com>

* fix failed ut from PR 1472 (#1479) (#1510)

* fix failed ut from PR 1472

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* exclude class for low coverage

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit da5d829)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* [Backport to 2.11] throw exception if remote model doesn't return 2xx status code; fix p… (#1477) (#1509)

* throw exception if remote model doesn't return 2xx status code; fix p… (#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 201c8a8)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix no worker node exception for remote embedding model (#1482) (#1511)

* fix no worker node exception for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* only add model info to cache if model cache exist

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 6f83b9f)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix for delete model group API throwing incorrect error when model index not created (#1485) (#1486) (#1512)

* fix for delete model group API throwing incorrect error when model index not created

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 60ef0fd)

Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 5544681)

Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>

* fix no worker node error on multi-node cluster (#1487) (#1513)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit cea1cd6)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* add prefix to show the error is from remote service (#1499) (#1515)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 3897ad1)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix multiple docs support (#1516)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* adding another fix issue to the release note (#1498) (#1514)

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
(cherry picked from commit 440155c)

Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>

* add bedrockURL to trusted connector regex list (#1461)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* return parsing exception 400 for parsing errors

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* add more ut in restupdateconnector

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* fix format violations

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Fix model/connector update API to address security concern (#1595)

* Fix model/connector update API to address appsec concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile and build failure

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Improve unit test coverage

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix spotless

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Merge update connector feature flag to remote inference feature flag

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Keep fixing exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Spotless fix

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add UT on parsing exception

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* change XContentFactory to MediaTypeRegistry builder in MLRegisterModelInputTest class

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>

* Allow model setting to transport from rest

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

* Added test

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

* Fixed integ test

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>
Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>
(cherry picked from commit 6bff20d)
ylwu-amzn pushed a commit that referenced this pull request Feb 1, 2024
* Backport multiple PRs to main from 2.x (#1652)

* fix parameter name in preprocess function; fix remote model function … (#1362)

* fix parameter name in preprocess function; fix remote model function name

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix failed unit test

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* throw exception when model group not found during update request (#1447)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* add status code to model tensor (#1443) (#1453)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* register new versions to a model group based on the name provided (#1452)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* fixing metrics correlation algorithm (#1448)

* fixing metrics correlation algorithm

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>

* if model version fails to register, update model group accordingly (#1463)

* if model version fails to register, update model group accordingly

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Update Model API (#1350)

* Update Model API POC

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Using GetRequest to get model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Finalize model update API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compileTest

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add Unit Test Cases for Update Model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Tune back test coverage thereshold

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit tests on Update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add unit test for TransportUpdateModelAction class

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix a test error

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change exception thrown to failure response

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Move the function judgement to the outter block

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Check if model is undeployed before update model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit test for update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix unit test due to blocking java 11 CI workflow

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling auto bumping model version during registering to a new model group and address reviewers' other concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Autobump new model groups' latest version when register to a new model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the REST API method from POST to PUT

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the update REST API endpoint

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add a setting to control the update connector API (#1465)

* Add a setting to control the update connector API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in corresponding unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* fix update connector API (#1484)

* fix update connector API

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* Performance enhacement for predict action by caching model info (#1472) (#1508)

* Performance enhacement for predict action by caching model info

Signed-off-by: zane-neo <zaniu@amazon.com>

* Add context.restore() to avoid missing info

Signed-off-by: zane-neo <zaniu@amazon.com>

---------

Signed-off-by: zane-neo <zaniu@amazon.com>
(cherry picked from commit a985f6e)

Co-authored-by: zane-neo <zaniu@amazon.com>

* fix failed ut from PR 1472 (#1479) (#1510)

* fix failed ut from PR 1472

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* exclude class for low coverage

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit da5d829)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* [Backport to 2.11] throw exception if remote model doesn't return 2xx status code; fix p… (#1477) (#1509)

* throw exception if remote model doesn't return 2xx status code; fix p… (#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 201c8a8)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix no worker node exception for remote embedding model (#1482) (#1511)

* fix no worker node exception for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* only add model info to cache if model cache exist

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 6f83b9f)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix for delete model group API throwing incorrect error when model index not created (#1485) (#1486) (#1512)

* fix for delete model group API throwing incorrect error when model index not created

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 60ef0fd)

Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 5544681)

Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>

* fix no worker node error on multi-node cluster (#1487) (#1513)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit cea1cd6)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* add prefix to show the error is from remote service (#1499) (#1515)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 3897ad1)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix multiple docs support (#1516)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* adding another fix issue to the release note (#1498) (#1514)

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
(cherry picked from commit 440155c)

Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>

* add bedrockURL to trusted connector regex list (#1461)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* return parsing exception 400 for parsing errors

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* add more ut in restupdateconnector

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* fix format violations

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Fix model/connector update API to address security concern (#1595)

* Fix model/connector update API to address appsec concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile and build failure

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Improve unit test coverage

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix spotless

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Merge update connector feature flag to remote inference feature flag

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Keep fixing exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Spotless fix

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add UT on parsing exception

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* change XContentFactory to MediaTypeRegistry builder in MLRegisterModelInputTest class

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>

* Allow model setting to transport from rest

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

* Added test

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

* Fixed integ test

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>
Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>
(cherry picked from commit 6bff20d)

Co-authored-by: Owais Kazi <owaiskazi19@gmail.com>
austintlee pushed a commit to austintlee/ml-commons that referenced this pull request Feb 29, 2024
… status code; fix p… (opensearch-project#1477) (opensearch-project#1509)

* throw exception if remote model doesn't return 2xx status code; fix p… (opensearch-project#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 201c8a8)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>
austintlee pushed a commit to austintlee/ml-commons that referenced this pull request Mar 19, 2024
* Backport multiple PRs to main from 2.x (opensearch-project#1652)

* fix parameter name in preprocess function; fix remote model function … (opensearch-project#1362)

* fix parameter name in preprocess function; fix remote model function name

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix failed unit test

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* throw exception when model group not found during update request (opensearch-project#1447)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* add status code to model tensor (opensearch-project#1443) (opensearch-project#1453)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* register new versions to a model group based on the name provided (opensearch-project#1452)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* fixing metrics correlation algorithm (opensearch-project#1448)

* fixing metrics correlation algorithm

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>

* if model version fails to register, update model group accordingly (opensearch-project#1463)

* if model version fails to register, update model group accordingly

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Update Model API (opensearch-project#1350)

* Update Model API POC

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Using GetRequest to get model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Finalize model update API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compileTest

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add Unit Test Cases for Update Model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Tune back test coverage thereshold

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit tests on Update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add unit test for TransportUpdateModelAction class

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix a test error

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change exception thrown to failure response

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Move the function judgement to the outter block

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Check if model is undeployed before update model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit test for update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix unit test due to blocking java 11 CI workflow

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling auto bumping model version during registering to a new model group and address reviewers' other concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Autobump new model groups' latest version when register to a new model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the REST API method from POST to PUT

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the update REST API endpoint

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add a setting to control the update connector API (opensearch-project#1465)

* Add a setting to control the update connector API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in corresponding unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* fix update connector API (opensearch-project#1484)

* fix update connector API

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* Performance enhacement for predict action by caching model info (opensearch-project#1472) (opensearch-project#1508)

* Performance enhacement for predict action by caching model info

Signed-off-by: zane-neo <zaniu@amazon.com>

* Add context.restore() to avoid missing info

Signed-off-by: zane-neo <zaniu@amazon.com>

---------

Signed-off-by: zane-neo <zaniu@amazon.com>
(cherry picked from commit a985f6e)

Co-authored-by: zane-neo <zaniu@amazon.com>

* fix failed ut from PR 1472 (opensearch-project#1479) (opensearch-project#1510)

* fix failed ut from PR 1472

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* exclude class for low coverage

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit da5d829)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* [Backport to 2.11] throw exception if remote model doesn't return 2xx status code; fix p… (opensearch-project#1477) (opensearch-project#1509)

* throw exception if remote model doesn't return 2xx status code; fix p… (opensearch-project#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 201c8a8)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix no worker node exception for remote embedding model (opensearch-project#1482) (opensearch-project#1511)

* fix no worker node exception for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* only add model info to cache if model cache exist

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 6f83b9f)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix for delete model group API throwing incorrect error when model index not created (opensearch-project#1485) (opensearch-project#1486) (opensearch-project#1512)

* fix for delete model group API throwing incorrect error when model index not created

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 60ef0fd)

Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 5544681)

Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>

* fix no worker node error on multi-node cluster (opensearch-project#1487) (opensearch-project#1513)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit cea1cd6)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* add prefix to show the error is from remote service (opensearch-project#1499) (opensearch-project#1515)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 3897ad1)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix multiple docs support (opensearch-project#1516)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* adding another fix issue to the release note (opensearch-project#1498) (opensearch-project#1514)

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
(cherry picked from commit 440155c)

Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>

* add bedrockURL to trusted connector regex list (opensearch-project#1461)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* return parsing exception 400 for parsing errors

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* add more ut in restupdateconnector

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* fix format violations

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Fix model/connector update API to address security concern (opensearch-project#1595)

* Fix model/connector update API to address appsec concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile and build failure

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Improve unit test coverage

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix spotless

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Merge update connector feature flag to remote inference feature flag

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Keep fixing exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Spotless fix

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add UT on parsing exception

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* change XContentFactory to MediaTypeRegistry builder in MLRegisterModelInputTest class

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>

* Updated OpenSearch Lucene snapshot location

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>
Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>
austintlee pushed a commit to austintlee/ml-commons that referenced this pull request Mar 19, 2024
)

* Backport multiple PRs to main from 2.x (opensearch-project#1652)

* fix parameter name in preprocess function; fix remote model function … (opensearch-project#1362)

* fix parameter name in preprocess function; fix remote model function name

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix failed unit test

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* throw exception when model group not found during update request (opensearch-project#1447)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* add status code to model tensor (opensearch-project#1443) (opensearch-project#1453)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* register new versions to a model group based on the name provided (opensearch-project#1452)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* fixing metrics correlation algorithm (opensearch-project#1448)

* fixing metrics correlation algorithm

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>

* if model version fails to register, update model group accordingly (opensearch-project#1463)

* if model version fails to register, update model group accordingly

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Update Model API (opensearch-project#1350)

* Update Model API POC

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Using GetRequest to get model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Finalize model update API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compileTest

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add Unit Test Cases for Update Model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Tune back test coverage thereshold

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit tests on Update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add unit test for TransportUpdateModelAction class

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix a test error

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change exception thrown to failure response

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Move the function judgement to the outter block

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Check if model is undeployed before update model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit test for update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix unit test due to blocking java 11 CI workflow

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling auto bumping model version during registering to a new model group and address reviewers' other concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Autobump new model groups' latest version when register to a new model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the REST API method from POST to PUT

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the update REST API endpoint

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add a setting to control the update connector API (opensearch-project#1465)

* Add a setting to control the update connector API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling the update connnector setting in corresponding unit test

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* fix update connector API (opensearch-project#1484)

* fix update connector API

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* Performance enhacement for predict action by caching model info (opensearch-project#1472) (opensearch-project#1508)

* Performance enhacement for predict action by caching model info

Signed-off-by: zane-neo <zaniu@amazon.com>

* Add context.restore() to avoid missing info

Signed-off-by: zane-neo <zaniu@amazon.com>

---------

Signed-off-by: zane-neo <zaniu@amazon.com>
(cherry picked from commit a985f6e)

Co-authored-by: zane-neo <zaniu@amazon.com>

* fix failed ut from PR 1472 (opensearch-project#1479) (opensearch-project#1510)

* fix failed ut from PR 1472

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* exclude class for low coverage

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit da5d829)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* [Backport to 2.11] throw exception if remote model doesn't return 2xx status code; fix p… (opensearch-project#1477) (opensearch-project#1509)

* throw exception if remote model doesn't return 2xx status code; fix p… (opensearch-project#1473)

* throw exception if remote model doesn't return 2xx status code; fix predict runner

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix kmeans model deploy bug

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* support multiple docs for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix ut

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong class

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 201c8a8)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix no worker node exception for remote embedding model (opensearch-project#1482) (opensearch-project#1511)

* fix no worker node exception for remote embedding model

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* only add model info to cache if model cache exist

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 6f83b9f)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix for delete model group API throwing incorrect error when model index not created (opensearch-project#1485) (opensearch-project#1486) (opensearch-project#1512)

* fix for delete model group API throwing incorrect error when model index not created

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 60ef0fd)

Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
(cherry picked from commit 5544681)

Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>

* fix no worker node error on multi-node cluster (opensearch-project#1487) (opensearch-project#1513)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit cea1cd6)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* add prefix to show the error is from remote service (opensearch-project#1499) (opensearch-project#1515)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 3897ad1)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>

* fix multiple docs support (opensearch-project#1516)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* adding another fix issue to the release note (opensearch-project#1498) (opensearch-project#1514)

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
(cherry picked from commit 440155c)

Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>

* add bedrockURL to trusted connector regex list (opensearch-project#1461)

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* return parsing exception 400 for parsing errors

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* add more ut in restupdateconnector

Signed-off-by: Xun Zhang <xunzh@amazon.com>

* fix format violations

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

* Fix model/connector update API to address security concern (opensearch-project#1595)

* Fix model/connector update API to address appsec concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile and build failure

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Improve unit test coverage

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix spotless

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Merge update connector feature flag to remote inference feature flag

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Keep fixing exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Spotless fix

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add UT on parsing exception

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* change XContentFactory to MediaTypeRegistry builder in MLRegisterModelInputTest class

Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>

* Allow model setting to transport from rest

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

* Added test

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

* Fixed integ test

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Bhavana Ramaram <rbhavna@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>
Co-authored-by: Bhavana Ramaram <rbhavna@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Co-authored-by: Sicheng Song <sicheng.song@outlook.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: zane-neo <zaniu@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.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.

4 participants