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

adding blueprint examples for remote inference #1155

Merged
merged 4 commits into from
Jul 25, 2023

Conversation

dhrubo-os
Copy link
Collaborator

Description

[adding blueprint examples for remote inference]

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.

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env July 24, 2023 20:11 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env July 24, 2023 20:11 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os had a problem deploying to ml-commons-cicd-env July 24, 2023 20:11 — with GitHub Actions Failure
@@ -0,0 +1,28 @@
```json
{
"name": "OpenAI Connector",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"name": "OpenAI Connector",
"name": "OpenAI Completions Connector",

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env July 25, 2023 00:49 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os had a problem deploying to ml-commons-cicd-env July 25, 2023 00:49 — with GitHub Actions Failure
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env July 25, 2023 00:49 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env July 25, 2023 00:49 — with GitHub Actions Inactive
-0.52246094,
-1.2714844,
1.8076172,
0.13842773,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let keep the first five embedding float values, then use ... to repreent the others. It seems not helping too much by showing thousands of floats.

"headers": {
"content-type": "application/json"
},
"url": "https://runtime.sagemaker.${parameters.region}.amazonaws.com/endpoints/lmi-model-2023-06-24-01-35-32-275/invocations",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Delete this URL , this is just our internal Sagemaker endpiont.

Suggested change
"url": "https://runtime.sagemaker.${parameters.region}.amazonaws.com/endpoints/lmi-model-2023-06-24-01-35-32-275/invocations",
"url": "<PLEASE ADD YOUR Sagemaker URL>",

"content-type": "application/json"
},
"url": "https://runtime.sagemaker.${parameters.region}.amazonaws.com/endpoints/lmi-model-2023-06-24-01-35-32-275/invocations",
"request_body": "[\"${parameters.inputs}\"]"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This request body is just from our test sagemaker embedding model. User should add their own body template.

Suggested change
"request_body": "[\"${parameters.inputs}\"]"
"request_body": "<PLEASE ADD YOUR REQUEST BODY>"

}
```

### Corresponding Predict request example:
Copy link
Collaborator

@ylwu-amzn ylwu-amzn Jul 25, 2023

Choose a reason for hiding this comment

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

As we can't predict what's the model deployed to Sagemaker on user side, so we should remove the predict request example and sample response.

```json
POST /_plugins/_ml/connectors/_create
{
"name": "sagemaker: embedding",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"name": "sagemaker: embedding",
"name": "<YOUR MODEL NAME>",

POST /_plugins/_ml/connectors/_create
{
"name": "sagemaker: embedding",
"description": "Test connector for Sagemaker embedding model",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"description": "Test connector for Sagemaker embedding model",
"description": "<YOUR MODEL DESCRIPTION>",

@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Merging #1155 (4a5c138) into 2.x (f6530e0) will decrease coverage by 0.04%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##                2.x    #1155      +/-   ##
============================================
- Coverage     78.95%   78.91%   -0.04%     
+ Complexity     2119     2116       -3     
============================================
  Files           167      167              
  Lines          8633     8633              
  Branches        869      869              
============================================
- Hits           6816     6813       -3     
- Misses         1422     1427       +5     
+ Partials        395      393       -2     
Flag Coverage Δ
ml-commons 78.91% <ø> (-0.04%) ⬇️

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

see 4 files with indirect coverage changes

@@ -0,0 +1,92 @@
### OpenAI connector blueprint example for chat:
Copy link
Collaborator

@ylwu-amzn ylwu-amzn Jul 25, 2023

Choose a reason for hiding this comment

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

Explain that this blueprint is created from OpenAI doc,
and example is from OpenAI doc https://platform.openai.com/docs/api-reference/chat?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Same for other examples, we should use the exact same example from OpenAI and Cohere official document. And we should put their doc link here so community user can refer to .

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env July 25, 2023 17:19 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env July 25, 2023 17:19 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env July 25, 2023 17:19 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env July 25, 2023 17:19 — with GitHub Actions Inactive
"content-type": "application/json"
},
"url": "<PLEASE ADD YOUR Sagemaker MODEL ENDPOINT URL>",
"request_body": "<PLEASE ADD YOUR REQUEST BODY. Example: [\"${parameters.inputs}\"]>"
Copy link
Collaborator

@ylwu-amzn ylwu-amzn Jul 25, 2023

Choose a reason for hiding this comment

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

How about just "{parameters.input}" ? Add [ and ] looks confusing as that's only for embedding generation , not a general one

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You mean: ${parameters.inputs} ?

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env July 25, 2023 17:39 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env July 25, 2023 17:39 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os had a problem deploying to ml-commons-cicd-env July 25, 2023 17:39 — with GitHub Actions Failure
Copy link
Collaborator

@ylwu-amzn ylwu-amzn left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks a lot

@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env July 25, 2023 18:01 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env July 25, 2023 18:01 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env July 25, 2023 18:01 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os merged commit 8b241a9 into opensearch-project:2.x Jul 25, 2023
zane-neo pushed a commit to zane-neo/ml-commons that referenced this pull request Sep 1, 2023
* adding blueprint examples for remote inference

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

* updating blue prints with sample response

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

* addressing comments

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

* addressed comments for sagemaker

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

---------

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
zane-neo pushed a commit that referenced this pull request Sep 1, 2023
* adding blueprint examples for remote inference

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

* updating blue prints with sample response

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

* addressing comments

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

* addressed comments for sagemaker

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

---------

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
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.

3 participants