-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add tutorial for RAG with DeepSeek R1 model on Sagemaker #3455
Conversation
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
|
||
### Deploy DeepSeek R1 model to Sagemaker | ||
|
||
Follow this [blog](https://community.aws/content/2sG84dNUCFzA9z4HdfqTI0tcvKP/deploying-deepseek-r1-on-amazon-sagemaker) to deploy DeepSeek R1 model to Sagemaker. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting. Have you followed the steps and deployed successfully in SageMaker?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the result is from test cluster, not fake one
Add DeepSeek API endpoint to trusted URLs | ||
``` | ||
PUT /_cluster/settings | ||
{ | ||
"persistent": { | ||
"plugins.ml_commons.trusted_connector_endpoints_regex": [ | ||
"^https://api\\.deepseek\\.com/.*$" | ||
] | ||
} | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will not be needed from v2.19, so should we mention that here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add after 2.19
"status": "COMPLETED" | ||
} | ||
``` | ||
4. Predict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we link the deepseek chat api here? so users can be aware of which api we are hitting internally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first sentence already mentioned the API
This tutorial introduces how to build RAG in Amazon managed OpenSearch with DeepSeek Chat Model.
``` | ||
4. Predict | ||
``` | ||
POST /_plugins/_ml/models/Sym9sJQBts7fa6byEh1-/_predict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here? is it possible to provide some reference so users are aware of how this parameters work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is somehow not easy. Sagemaker team owns how the API works. I don't have clear view about this, no docs found
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made suggestions for the first 2 files. The 3rd one is almost the same, so please apply my suggestions to that one as well. Thanks.
## 5. RAG | ||
|
||
### 5.1 create search pipeline | ||
Create search pipeline with [RAG processor](https://opensearch.org/docs/latest/search-plugins/search-pipelines/rag-processor/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create search pipeline with [RAG processor](https://opensearch.org/docs/latest/search-plugins/search-pipelines/rag-processor/). | |
Create search pipeline with a [RAG processor](https://opensearch.org/docs/latest/search-plugins/search-pipelines/rag-processor/): |
} | ||
``` | ||
### 5.2 create vector database | ||
Follow this [neural search tutorial](https://opensearch.org/docs/latest/search-plugins/neural-search-tutorial/) to create embedding model, K-NN index `my-nlp-index`, and ingest data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow this [neural search tutorial](https://opensearch.org/docs/latest/search-plugins/neural-search-tutorial/) to create embedding model, K-NN index `my-nlp-index`, and ingest data | |
Follow the [neural search tutorial](https://opensearch.org/docs/latest/search-plugins/neural-search-tutorial/) to create an embedding model and a k-NN index. Then ingest data into the index: |
``` | ||
|
||
|
||
### 5.3 search |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### 5.3 search | |
### 5.3 Search the index |
|
||
|
||
### 5.3 search | ||
Run neural search to retrieve documents from vector database, then use DeepSeek model to do RAG. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run neural search to retrieve documents from vector database, then use DeepSeek model to do RAG. | |
Run vector search to retrieve documents from the vector database, then use the DeepSeek model for RAG: |
} | ||
} | ||
``` | ||
Response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Response | |
The response contains the matching documents: |
Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
* add tutorial for RAG with DeepSeek R1 model on Sagemaker Signed-off-by: Yaliang Wu <ylwu@amazon.com> * add tutorials for RAG with DeepSeek Chat model Signed-off-by: Yaliang Wu <ylwu@amazon.com> * add tutorial for RAG with DeepSeek R1 model on Sagemaker Signed-off-by: Yaliang Wu <ylwu@amazon.com> * Apply suggestions from code review Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Signed-off-by: Yaliang Wu <ylwu@amazon.com> * apply comments to sagemkaer tutorial Signed-off-by: Yaliang Wu <ylwu@amazon.com> --------- Signed-off-by: Yaliang Wu <ylwu@amazon.com> Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> (cherry picked from commit 8830a43)
* add tutorial for RAG with DeepSeek R1 model on Sagemaker Signed-off-by: Yaliang Wu <ylwu@amazon.com> * add tutorials for RAG with DeepSeek Chat model Signed-off-by: Yaliang Wu <ylwu@amazon.com> * add tutorial for RAG with DeepSeek R1 model on Sagemaker Signed-off-by: Yaliang Wu <ylwu@amazon.com> * Apply suggestions from code review Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Signed-off-by: Yaliang Wu <ylwu@amazon.com> * apply comments to sagemkaer tutorial Signed-off-by: Yaliang Wu <ylwu@amazon.com> --------- Signed-off-by: Yaliang Wu <ylwu@amazon.com> Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> (cherry picked from commit 8830a43) Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Description
This tutorial introduces how to use DeepSeek model deployed on Sagemaker to build RAG in OpenSearch
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
--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.