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

Implement model, model group and connector apis #170

Merged
merged 12 commits into from
Dec 18, 2023

Conversation

acha5066
Copy link
Contributor

Description

This PR implements the model, model group and connector apis from the ML Commons API so that developers can set up connectors to 3rd party tools like OpenAI as described here: https://github.com/opensearch-project/ml-commons/blob/main/docs/remote_inference_blueprints/openai_connector_embedding_blueprint.md

Issues Resolved

Closes #169

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.

Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

A cursory look at it, looks ok. It needs tests and documentation, please. I would write a working sample as well. Sign commits with -s to pass DCO.

I encourage anyone wanting to add APIs to spend time doing #97 instread of hand-rolling these.

@acha5066
Copy link
Contributor Author

acha5066 commented Dec 5, 2023

  • Added tests for the new namespace methods.
  • Added sample usage to USER_GUIDE.md.
  • Added documentation to the namespace class header. Linked to relevant API docs. Wasn't sure what documentation you had in mind so please let me know.

Regarding DCO I did signoff with Andrew Chappell and changed my username like: git config --global user.name "Andrew Chappell" so not sure why that isn't reflected. It keeps associating with andrew.chappell 🤔

Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Attention: 84 lines in your changes are missing coverage. Please review.

Comparison is base (9ebb183) 24.19% compared to head (e55cd04) 25.99%.

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

Files Patch % Lines
...OpenSearch/Namespaces/MachineLearningNamespace.php 85.81% 20 Missing ⚠️
...nts/MachineLearning/Connectors/DeleteConnector.php 50.00% 5 Missing ⚠️
...points/MachineLearning/Connectors/GetConnector.php 50.00% 5 Missing ⚠️
...s/MachineLearning/ModelGroups/DeleteModelGroup.php 50.00% 5 Missing ⚠️
...s/MachineLearning/ModelGroups/UpdateModelGroup.php 50.00% 5 Missing ⚠️
...h/Endpoints/MachineLearning/Models/DeleteModel.php 50.00% 5 Missing ⚠️
...h/Endpoints/MachineLearning/Models/DeployModel.php 50.00% 5 Missing ⚠️
...arch/Endpoints/MachineLearning/Models/GetModel.php 50.00% 5 Missing ⚠️
...earch/Endpoints/MachineLearning/Models/Predict.php 50.00% 5 Missing ⚠️
...Endpoints/MachineLearning/Models/UndeployModel.php 50.00% 5 Missing ⚠️
... and 8 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #170      +/-   ##
============================================
+ Coverage     24.19%   25.99%   +1.79%     
- Complexity     1938     2018      +80     
============================================
  Files           246      263      +17     
  Lines          6865     7145     +280     
============================================
+ Hits           1661     1857     +196     
- Misses         5204     5288      +84     

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

Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

I made a bunch of nitpicky comments. @shyim should take a look at the code.

For DCO I think you will have to amend previous commits. I would make a new branch off main and merge the code and re-commit it and force push the branch. LMK if you need help on how to do that!

CHANGELOG.md Outdated
- Added support for `format` parameter to specify the sql response format ([#161](https://github.com/opensearch-project/opensearch-php/pull/161))
- Implemented the Model, Model Group and Connector apis ([#170](https://github.com/opensearch-project/opensearch-php/pull/170))
Copy link
Member

Choose a reason for hiding this comment

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

Let's say Added ml-commons model, model group, and connector APIs to be consistent with the rest?

USER_GUIDE.md Outdated
@@ -24,7 +24,7 @@ class MyOpenSearchClass

public function __construct()
{
//simple Setup
//simple Setup
Copy link
Member

Choose a reason for hiding this comment

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

// space (I know it was there before, but let's fix - generally I find these comments sort of useless, but we should at least Capitalize and Space Them Consistently :)

USER_GUIDE.md Outdated
@@ -501,3 +501,69 @@ $client = \OpenSearch\ClientBuilder::fromConfig($config);

...
```
## Machine Learning Example Usage
Copy link
Member

Choose a reason for hiding this comment

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

Let's extract this into its own user guide like in https://github.com/opensearch-project/opensearch-py/tree/main/guides? It will be easier to grok. Link the guides from the user guide under maybe a new advanced or other topics section?

USER_GUIDE.md Outdated
@@ -501,3 +501,69 @@ $client = \OpenSearch\ClientBuilder::fromConfig($config);

...
```
## Machine Learning Example Usage

This example assumes you are using the AWS managed OpenSearch
Copy link
Member

Choose a reason for hiding this comment

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

No need to wrap in markdown

USER_GUIDE.md Outdated
## Machine Learning Example Usage

This example assumes you are using the AWS managed OpenSearch
service. See [The ML Commons documentation for more examples and further information.](https://github.com/opensearch-project/ml-commons/blob/main/docs/remote_inference_blueprints/openai_connector_embedding_blueprint.md)
Copy link
Member

Choose a reason for hiding this comment

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

Capitalize ml-commons consistently, it's lowercase and just link that word, so [ml commons documentation](...).

USER_GUIDE.md Outdated
service. See [The ML Commons documentation for more examples and further information.](https://github.com/opensearch-project/ml-commons/blob/main/docs/remote_inference_blueprints/openai_connector_embedding_blueprint.md)

It walks through the process of setting up a model to generate
vector embeddings from OpenAI.
Copy link
Member

Choose a reason for hiding this comment

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

We should probably add a prerequisites section of where to sign up / get keys from OpenAI.

Signed-off-by: Andrew Chappell <[email protected]>
Signed-off-by: Andrew Chappell <[email protected]>
Signed-off-by: Andrew Chappell <[email protected]>
Signed-off-by: Andrew Chappell <[email protected]>
Signed-off-by: Andrew Chappell <[email protected]>
Signed-off-by: Andrew Chappell <[email protected]>
Signed-off-by: Andrew Chappell <[email protected]>
@acha5066
Copy link
Contributor Author

DCO should be fine now

@dblock
Copy link
Member

dblock commented Dec 15, 2023

@shyim Got some time to CR this?

Copy link
Collaborator

@shyim shyim left a comment

Choose a reason for hiding this comment

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

Looks good

@dblock dblock merged commit c1fc911 into opensearch-project:main Dec 18, 2023
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Implement model, model group and connector apis
3 participants