-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added first iteration of custom model load supprot
- Loading branch information
Showing
3 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
opensearch_py_ml/ml_commons_integration/load/ml_common_load_client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
Copyright OpenSearch Contributors | ||
SPDX-License-Identifier: Apache-2.0 | ||
""" | ||
|
||
from opensearchpy import OpenSearch | ||
from opensearch_py_ml.ml_commons_integration.ml_common_utils import ML_BASE_URI | ||
|
||
|
||
class MLCommonLoadClient: | ||
""" | ||
Client for performing model upload tasks to ml-commons plugin for OpenSearch. | ||
""" | ||
def __init__(self, os_client: OpenSearch): | ||
self._client = os_client | ||
|
||
def load_model(self, model_name : str, version_num : int): | ||
""" | ||
Load a model with name model_name and version number version_num. | ||
""" | ||
return self._client.transport.perform_request( | ||
method="POST", | ||
url=f"{ML_BASE_URI}/custom_model/load", | ||
body={ | ||
"name": f"\"{model_name}\"", | ||
"version": version_num | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
opensearch_py_ml/ml_commons_integration/predict/ml_common_predict_client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
""" | ||
Copyright OpenSearch Contributors | ||
SPDX-License-Identifier: Apache-2.0 | ||
""" |