-
Notifications
You must be signed in to change notification settings - Fork 146
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 tutorials for cross encoder models on Amazon Bedrock #3278
add tutorials for cross encoder models on Amazon Bedrock #3278
Conversation
Signed-off-by: tkykenmt <[email protected]>
Signed-off-by: tkykenmt <[email protected]>
…n recieve empty result from a model. Signed-off-by: tkykenmt <[email protected]>
"content-type": "application/json" | ||
}, | ||
"pre_process_function": """ | ||
def query_text = params.query_text; |
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.
What do you think about raising a PR for pre & post processor functions for Bedrock rerank model like these.
In that way, customer can just mention the name of the pre/post process function rather than writing painless script in the connector payload.
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 think built-in pre & post processor is good solution to reduce overhead and ease implementation. I've submitted issues for the topic.
I'm not familiar with code development, but I'm happy to contribute in this area.
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'm going to implement built-in function in #3254 but please let me leave custom pre and post function as it is in this PR.
docs/tutorials/rerank/rerank_pipeline_with_Amazon_Rerank_model_on_Amazon_Bedrock.md
Show resolved
Hide resolved
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 agree with what was authored just minor feedback. Thank you for the contribution!
docs/tutorials/rerank/rerank_pipeline_with_Amazon_Rerank_model_on_Amazon_Bedrock.md
Show resolved
Hide resolved
docs/tutorials/rerank/rerank_pipeline_with_Amazon_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
{ | ||
"action_type": "predict", | ||
"method": "POST", | ||
"url": "https://bedrock-runtime.${parameters.region}.amazonaws.com/model/amazon.rerank-v1:0/invoke", |
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.
Similar feedback like before :)
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.
fixed on 9482b47
{ | ||
"action_type": "predict", | ||
"method": "POST", | ||
"url": "https://bedrock-runtime.${parameters.region}.amazonaws.com/model/cohere.rerank-v3-5:0/invoke", |
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.
Similar feedback like before
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.
fixed on 9482b47
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.
Some text suggestions for one of the tutorials. Since the text is the same, please apply to both tutorials. Thanks!
# Topic | ||
|
||
[Reranking pipeline](https://opensearch.org/docs/latest/search-plugins/search-relevance/reranking-search-results/) is a feature released in OpenSearch 2.12. | ||
It can rerank search results, providing a relevance score for each document in the search results with respect to the search query. |
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.
It can rerank search results, providing a relevance score for each document in the search results with respect to the search query. | |
It can rerank search results, providing a relevance score with respect to the search query for each matching document. |
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.
Thanks, I'm going to merge your recommendation on next commit.
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.
fixed on 9482b47
It can rerank search results, providing a relevance score for each document in the search results with respect to the search query. | ||
The relevance score is calculated by a cross-encoder model. | ||
|
||
This tutorial explains how to use the [Amazon Rerank 1.0 model in Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/rerank-supported.html) in a reranking pipeline. |
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 tutorial explains how to use the [Amazon Rerank 1.0 model in Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/rerank-supported.html) in a reranking pipeline. | |
This tutorial illustrates using the [Amazon Rerank 1.0 model in Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/rerank-supported.html) in a reranking pipeline. |
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.
Thanks, I'm going to merge your recommendation on next commit.
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.
fixed on 9482b47
# Steps | ||
|
||
## 0. Test the model on Amazon Bedrock | ||
You can perform a reranking test with the following code. |
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.
You can perform a reranking test with the following code. | |
You can perform a reranking test using the following code: |
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.
Thanks, I'm going to merge your recommendation on next commit.
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.
fixed on 9482b47
} | ||
``` | ||
|
||
If using the Amazon Opensearch Service, you can provide an IAM role arn that allows access to the bedrock service. Refer to this [AWS doc](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/ml-amazon-connector.html) |
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.
If using the Amazon Opensearch Service, you can provide an IAM role arn that allows access to the bedrock service. Refer to this [AWS doc](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/ml-amazon-connector.html) | |
If using the Amazon Opensearch Service, you can provide an IAM role ARN that allows access to the Amazon Bedrock service. For more information, see [AWS documentation](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/ml-amazon-connector.html): |
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'll update the sentence based on your recommendation
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.
fixed on 9482b47
} | ||
``` | ||
|
||
Each item in the array comprises a query_text and a text_docs string, separated by a . |
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 sentence is incomplete. Separated by what?
Each item in the array comprises a query_text and a text_docs string, separated by a . | |
Each item in the array comprises a `query_text` and a `text_docs` string, separated by a . |
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.
" separated by a ,
." is correct sentence. I'm going to fix it.
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.
fixed on 9482b47
|
||
The connector `pre_process_function` transforms the input into the format required by parameters shown previously. | ||
|
||
By default, Amazon Bedrock Rerank API output has the following format: |
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.
By default, Amazon Bedrock Rerank API output has the following format: | |
By default, the Amazon Bedrock Rerank API output has the following format: |
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'm going to apply your recommendation.
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.
fixed on 9482b47
] | ||
``` | ||
|
||
The connector `post_process_function` transforms the model's output into a format that the [Reranker processor](https://opensearch.org/docs/latest/search-plugins/search-pipelines/rerank-processor/) can interpret, and orders result by index. This adapted format is as follows: |
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 connector `post_process_function` transforms the model's output into a format that the [Reranker processor](https://opensearch.org/docs/latest/search-plugins/search-pipelines/rerank-processor/) can interpret, and orders result by index. This adapted format is as follows: | |
The connector `post_process_function` transforms the model's output into a format that the [Reranker processor](https://opensearch.org/docs/latest/search-plugins/search-pipelines/rerank-processor/) can interpret, and orders the results by index. This adapted format is as follows: |
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'm going to apply your recommendation.
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.
fixed on 9482b47
|
||
Explanation of the response: | ||
1. The response contains two `similarity` outputs. For each `similarity` output, the `data` array contains a relevance score of each document against the query. | ||
2. The `similarity` outputs are provided in the order of the input documents; the first result of similarity pertains to the first document. |
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.
2. The `similarity` outputs are provided in the order of the input documents; the first result of similarity pertains to the first document. | |
2. The `similarity` outputs are provided in the order of the input documents; the first similarity result pertains to the first document. |
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'm going to apply your recommendation.
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.
fixed on 9482b47
} | ||
``` | ||
|
||
Note: if you provide multiple filed names in `document_fields`, the values of all fields are first concatenated and then reranking is performed. |
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.
Note: if you provide multiple filed names in `document_fields`, the values of all fields are first concatenated and then reranking is performed. | |
Note: if you provide multiple file names in `document_fields`, the values of all fields are first concatenated and then reranking is performed. |
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.
filed is typo. field is correct. I'm going to fix.
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.
fixed on 9482b47
} | ||
``` | ||
|
||
Note: You can avoid writing the query twice by using query_text_path instead of query_text, as follows: |
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.
Note: You can avoid writing the query twice by using query_text_path instead of query_text, as follows: | |
Note: You can avoid writing the query twice by using the `query_text_path` instead of `query_text` as follows: |
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'm going to apply your recoomendation.
body=body | ||
) | ||
results = json.loads(response.get('body').read())["results"] | ||
print(json.dumps(sorted(results, key=lambda x: x['index']),indent=2)) |
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.
How about just print the model response directly? Adding sorted
may confuse user as this is some processed 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.
print(json.dumps(results, indent=2))
Response
[
{
"index": 2,
"relevance_score": 0.7711548724998493
},
{
"index": 0,
"relevance_score": 0.0025114635138098534
},
{
"index": 1,
"relevance_score": 2.4876490010363496e-05
},
{
"index": 3,
"relevance_score": 6.339210403977635e-06
}
]
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.
Thanks, I'm going to updated based on your recommendation on next commit.
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.
fixed on 9482b47
|
||
Test the model by using the Predict API: | ||
```json | ||
POST _plugins/_ml/models/your_model_id/_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.
Please make sure every step in the tutorial works. I tested and this step failed
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"... resultBuilder.append(' {\\\"name\\\": \\\"similarity ...",
" ^---- HERE"
],
"script": "\n if (params.result == null || params.result.length > 0) {\n throw new IllegalArgumentException(\"Post process function input is empty.\");\n }\n def outputs = params.results;\n def relevance_scores = new Double[outputs.length];\n for (int i=0; i<outputs.length; i++) {\n def index = new BigDecimal(outputs[i].index.toString()).intValue();\n relevance_scores[index] = outputs[i].relevance_score;\n }\n def resultBuilder = new StringBuilder('[');\n for (int i=0; i<relevance_scores.length; i++) {\n resultBuilder.append(' {\\\"name\\\": \\\"similarity\\\", \\\"data_type\\\": \\\"FLOAT32\\\", \\\"shape\\\": [1],');\n resultBuilder.append('\\\"data\\\": [');\n resultBuilder.append(relevance_scores[i]);\n resultBuilder.append(']}');\n if (i<outputs.length - 1) {\n resultBuilder.append(',');\n }\n }\n resultBuilder.append(']');\n return resultBuilder.toString();\n ",
"lang": "painless",
"position": {
"offset": 598,
"start": 573,
"end": 623
}
}
],
"type": "m_l_exception",
"reason": "m_l_exception: Fail to execute PREDICT in aws connector",
"caused_by": {
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"... resultBuilder.append(' {\\\"name\\\": \\\"similarity ...",
" ^---- HERE"
],
"script": "\n if (params.result == null || params.result.length > 0) {\n throw new IllegalArgumentException(\"Post process function input is empty.\");\n }\n def outputs = params.results;\n def relevance_scores = new Double[outputs.length];\n for (int i=0; i<outputs.length; i++) {\n def index = new BigDecimal(outputs[i].index.toString()).intValue();\n relevance_scores[index] = outputs[i].relevance_score;\n }\n def resultBuilder = new StringBuilder('[');\n for (int i=0; i<relevance_scores.length; i++) {\n resultBuilder.append(' {\\\"name\\\": \\\"similarity\\\", \\\"data_type\\\": \\\"FLOAT32\\\", \\\"shape\\\": [1],');\n resultBuilder.append('\\\"data\\\": [');\n resultBuilder.append(relevance_scores[i]);\n resultBuilder.append(']}');\n if (i<outputs.length - 1) {\n resultBuilder.append(',');\n }\n }\n resultBuilder.append(']');\n return resultBuilder.toString();\n ",
"lang": "painless",
"position": {
"offset": 598,
"start": 573,
"end": 623
},
"caused_by": {
"type": "illegal_argument_exception",
"reason": "unexpected character [' {\\\"]. The only valid escape sequences in strings starting with ['] are [\\\\] and [\\'].",
"caused_by": {
"type": "lexer_no_viable_alt_exception",
"reason": "lexer_no_viable_alt_exception: null"
}
}
}
},
"status": 500
}
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'm going to remove unnecessary escape character and test again on my side.
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.
fixed on 9482b47
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.
fixed on 9482b47
def text_docs = params.text_docs; | ||
def textDocsBuilder = new StringBuilder('['); | ||
for (int i=0; i<text_docs.length; i++) { | ||
textDocsBuilder.append('\"'); |
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.
textDocsBuilder.append('\"'); | |
textDocsBuilder.append('"'); |
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'm going to remove unnecessary escape character and test again on my side.
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.
fixed on 9482b47
for (int i=0; i<text_docs.length; i++) { | ||
textDocsBuilder.append('\"'); | ||
textDocsBuilder.append(text_docs[i]); | ||
textDocsBuilder.append('\"'); |
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.
textDocsBuilder.append('\"'); | |
textDocsBuilder.append('"'); |
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'm going to remove unnecessary escape character and test again on my side.
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.
fixed on 9482b47
} | ||
} | ||
textDocsBuilder.append(']'); | ||
def parameters = '{ \"query\": \"' + query_text + '\", \"documents\": ' + textDocsBuilder.toString() + ' }'; |
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.
def parameters = '{ \"query\": \"' + query_text + '\", \"documents\": ' + textDocsBuilder.toString() + ' }'; | |
def parameters = '{ "query": "' + query_text + '", "documents": ' + textDocsBuilder.toString() + ' }'; |
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'm going to remove unnecessary escape character and test again on my side.
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.
fixed on 9482b47
} | ||
textDocsBuilder.append(']'); | ||
def parameters = '{ \"query\": \"' + query_text + '\", \"documents\": ' + textDocsBuilder.toString() + ' }'; | ||
return '{\"parameters\": ' + parameters + '}'; |
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.
return '{\"parameters\": ' + parameters + '}'; | |
return '{"parameters": ' + parameters + '}'; |
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'm going to remove unnecessary escape character and test again on my side.
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.
fixed on 9482b47
""", | ||
"request_body": "{ \"query\": \"${parameters.query}\", \"documents\": ${parameters.documents} }", | ||
"post_process_function": """ | ||
if (params.result == null || params.result.length > 0) { |
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.
if (params.result == null || params.result.length > 0) { | |
if (params.results == null || params.results.length == 0) { |
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'm going to update condition
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.
fixed on 9482b47
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 think everything looks good just that one part where you keep mentioning SageMaker since you are using bedrock models
``` | ||
### 2.2 Create a reranking pipeline | ||
```json | ||
PUT /_search/pipeline/rerank_pipeline_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.
Why is written for Sagemaker here but the models are hosted on bedrock. Am I missing something?
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.
Thanks, fixed at a219218
``` | ||
### 2.2 Create a reranking pipeline | ||
```json | ||
PUT /_search/pipeline/rerank_pipeline_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.
Same here for the name and description
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.
Thanks, fixed at a219218
|
||
Note: You can avoid writing the query twice by using the `query_text_path` instead of `query_text` as follows: | ||
```json | ||
POST my-test-data/_search?search_pipeline=rerank_pipeline_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.
Make sure to change it where you write SageMaker too
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.
Thanks, fixed at a219218
…n Bedrock opensearch-project#3278 Signed-off-by: tkykenmt <[email protected]>
} | ||
``` | ||
|
||
Each item in the array comprises a `query_text` and a `text_docs` string, separated by a ` , `. |
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.
Move this to line 295, query_text
and a text_docs
string exist in the example of
POST _plugins/_ml/_predict/text_similarity/your_model_id
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.
Thank you for your review. Please let me delete this note because it's bit inaccurate. Deleted comment on commit 0a549fb
``` | ||
|
||
Explanation of the response: | ||
1. The response contains two `similarity` outputs. For each `similarity` output, the `data` array contains a relevance score of each document against the query. |
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.
1. The response contains two `similarity` outputs. For each `similarity` output, the `data` array contains a relevance score of each document against the query. | |
1. The response contains four `similarity` outputs. For each `similarity` output, the `data` array contains a relevance score of each document against the query. |
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.
Thank you for your review. Modified at commit 0a549fb
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.
_predict call doesn't work in the tutorial. "texts" param should be replaced with "documents" to match the request_body in the connector payload.
POST _plugins/_ml/models/your_model_id/_predict
{
"parameters": {
"query": "What is the capital city of America?",
**"texts":** [. ### This should be "documents"
"Carson City is the capital city of the American state of Nevada.",
"The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.",
"Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.",
"Capital punishment (the death penalty) has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states."
]
}
}
…opensearch-project#3278 Signed-off-by: tkykenmt <[email protected]>
docs/tutorials/rerank/rerank_pipeline_with_Amazon_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
}, | ||
"parameters": { | ||
"service_name": "bedrock", | ||
"service_code": "bedrock-runtime", |
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.
service_code
looks confusing, how about change to endpoint
Check https://docs.aws.amazon.com/bedrock/latest/APIReference/welcome.html
Amazon Bedrock provides the following service endpoints.
- bedrock – Contains control plane APIs for managing, training, and deploying models. For more information, see Amazon Bedrock Actions and Amazon Bedrock Data Types.
- bedrock-runtime – Contains data plane APIs for making inference requests for models hosted in Amazon Bedrock. For more information, see Amazon Bedrock Runtime Actions and Amazon Bedrock Runtime Data Types.
docs/tutorials/rerank/rerank_pipeline_with_Amazon_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
docs/tutorials/rerank/rerank_pipeline_with_Amazon_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
docs/tutorials/rerank/rerank_pipeline_with_Amazon_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
docs/tutorials/rerank/rerank_pipeline_with_Cohere_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
docs/tutorials/rerank/rerank_pipeline_with_Cohere_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
docs/tutorials/rerank/rerank_pipeline_with_Cohere_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
docs/tutorials/rerank/rerank_pipeline_with_Cohere_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
docs/tutorials/rerank/rerank_pipeline_with_Cohere_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
Signed-off-by: Yaliang Wu <[email protected]>
docs/tutorials/rerank/rerank_pipeline_with_Amazon_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
docs/tutorials/rerank/rerank_pipeline_with_Amazon_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
docs/tutorials/rerank/rerank_pipeline_with_Amazon_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
docs/tutorials/rerank/rerank_pipeline_with_Amazon_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
docs/tutorials/rerank/rerank_pipeline_with_Amazon_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
docs/tutorials/rerank/rerank_pipeline_with_Amazon_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
docs/tutorials/rerank/rerank_pipeline_with_Cohere_Rerank_model_on_Amazon_Bedrock.md
Outdated
Show resolved
Hide resolved
Signed-off-by: Yaliang Wu <[email protected]>
* add tutorials for cross encoder models on Amazon Bedrock Signed-off-by: tkykenmt <[email protected]> * fix bedrock url to reflect region parameter Signed-off-by: tkykenmt <[email protected]> * update error handling to throw exception when post processing function recieve empty result from a model. Signed-off-by: tkykenmt <[email protected]> * fix tutorials for cross encoder models on Amazon Bedrock based on review comments on #3278 Signed-off-by: tkykenmt <[email protected]> * fix wrong service name on tutorials for cross encoder models on Amazon Bedrock #3278 Signed-off-by: tkykenmt <[email protected]> * fix some notes on tutorials for cross encoder models on Amazon Bedrock #3278 Signed-off-by: tkykenmt <[email protected]> * some minor fix Signed-off-by: Yaliang Wu <[email protected]> * change cross-encoder to rerank Signed-off-by: Yaliang Wu <[email protected]> --------- Signed-off-by: tkykenmt <[email protected]> Signed-off-by: Yaliang Wu <[email protected]> Co-authored-by: Yaliang Wu <[email protected]> (cherry picked from commit 32a5788)
* add tutorials for cross encoder models on Amazon Bedrock Signed-off-by: tkykenmt <[email protected]> * fix bedrock url to reflect region parameter Signed-off-by: tkykenmt <[email protected]> * update error handling to throw exception when post processing function recieve empty result from a model. Signed-off-by: tkykenmt <[email protected]> * fix tutorials for cross encoder models on Amazon Bedrock based on review comments on #3278 Signed-off-by: tkykenmt <[email protected]> * fix wrong service name on tutorials for cross encoder models on Amazon Bedrock #3278 Signed-off-by: tkykenmt <[email protected]> * fix some notes on tutorials for cross encoder models on Amazon Bedrock #3278 Signed-off-by: tkykenmt <[email protected]> * some minor fix Signed-off-by: Yaliang Wu <[email protected]> * change cross-encoder to rerank Signed-off-by: Yaliang Wu <[email protected]> --------- Signed-off-by: tkykenmt <[email protected]> Signed-off-by: Yaliang Wu <[email protected]> Co-authored-by: Yaliang Wu <[email protected]> (cherry picked from commit 32a5788) Co-authored-by: Takayuki Enomoto <[email protected]>
Description
Add tutorials for Amazon Bedrock cross-encoder model (Amazon Rerank 1.0 and Cohere Rerank 3.5)
Related Issues
Resolves #3245
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.