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

add blueprint and tutorial for pre and post process function of Bedrock Rerank API (#3254) #3352

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tkykenmt
Copy link
Contributor

@tkykenmt tkykenmt commented Jan 9, 2025

Description

Amazon Bedrock introduced Rerank model support. OpenSearch can invoke Rerank models on Bedrock by writing custom pre/post processing function, but pre-built function is good for performance. This PR is for adding blueprint and tutorials to illustrate how to use these process functions.

Related Issues

Resolves #3254

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.


A [reranking pipeline](https://opensearch.org/docs/latest/search-plugins/search-relevance/reranking-search-results/) 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 illustrates using the [Amazon Bedrock Rerank API](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Rerank.html) to rerank search results using a model hosted on Amazon Bedrock.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain the difference with https://github.com/opensearch-project/ml-commons/blob/main/docs/tutorials/rerank/rerank_pipeline_with_Amazon_Rerank_model_on_Amazon_Bedrock.md ?

I see both can use same model amazon.rerank-v1:0. Which tutorial cx should follow ? Any preference ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previous blueprint requires custom pre and post functions, and calls bedrock invoke API. For invoke API, users need to set model-specific parameters. New blueprint doesn't require custom function code. In addition, new blueprint adopts rerank API. By using Rerank API, users can perform reranking simply by specifying common parameters that are independent of the model. Users can also switch to another model by just changing the model ID.

@tkykenmt tkykenmt requested a deployment to ml-commons-cicd-env-require-approval January 10, 2025 01:39 — with GitHub Actions Waiting
@tkykenmt tkykenmt requested a review from ylwu-amzn January 14, 2025 06:09
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 BedrockRerank[Pre|Post]ProcessFunction
2 participants