-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(stepfunctions-tasks): support for the Step Functions optimized integration for Bedrock InvokeModel API #28276
feat(stepfunctions-tasks): support for the Step Functions optimized integration for Bedrock InvokeModel API #28276
Conversation
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 pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
My account does not have Bedrock model access in us-east-1, so the integ test does not validate that the Step Functions state machine can successfully execute. I deployed the stack in my account in us-west-2 where I have model access, and manually executed the state machine successfully and returned an expected result: {
"names": "\nHere is the alphabetized list of first names:\n\n1. Elijah\n2. John\n3. Liam\n4. Oliver\n5. Noah"
} |
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
…ntegration for Bedrock InvokeModel API
466a6f2
to
a0924a6
Compare
Hey @clareliguori, this looks terrific! Before I dive into a full review, I had a couple of higher level questions. I see you created a I will also ask the team about if we have dealt with patterns similar to this, and how we approach them. Also a quick note about the bedrock output. Did you notice Noah and Oliver are out of alphabetical order! That is pretty funny 🙃 |
Yeah I went back and forth on that, and I'm happy to change it Pros of being in the aws-bedrock module:
Cons of being in the aws-bedrock module:
Note that I don't expect a base foundational model would ever be a CFN resource (since they don't belong to an account), so that would likely always be an import-only construct as it is in this PR.
LOL I did not notice that |
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.
Hi @clareliguori, thanks for the PR! This is an interesting one, and my feelings are that, while unusual, your aws-bedrock
pre-CFN implementation provides some benefit in creating the model arn, and is relatively low-risk in predicting what a bedrock L2 would look like in the future.
Know that our normal process for creating new L2s involves an RFC, experimental module first, and much more bureaucracy. But I think common sense should prevail here as this is simple enough.
Sending this off to @rix0rrr to glance at just to make sure there's not something obvious i'm missing about creating the aws-bedrock
submodule without cfn. I doubt that will cause any issues, although when bedrock gets CFN resources we'll have to rely on our L1 generation to be resilient enough to play nice with the existing folder.
packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/bedrock/invoke-model.ts
Outdated
Show resolved
Hide resolved
* | ||
* @see https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html | ||
*/ | ||
readonly model: bedrock.IModel; |
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.
Hmm. The alternative here is to just allow a modelArn
in the absence of bedrock CFN constructs. That seems like the simplest path forward, and we can always add in model: bedrock.IModel
later when CFN supports it.
The current benefit of your aws-bedrock
implementation is that there are some helper functions to achieving the arn. The question is, how will users of this task feel about that? Would they prefer to just copy/paste the model arn that they have created elsewhere?
The other interesting thing is that per your implementation, it looks like Foundation Models have well known arns based on their model ID. Perhaps that is enough benefit to move forward with what you've got.
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 the most common case will be using foundation models, so having that ARN constructed for you is pretty useful
Co-authored-by: Kaizen Conroy <[email protected]>
Pull request has been modified.
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.
Looks good! From my understanding of bedrock, it looks like at least the foundation model will never be a CFN resource since we are referencing something that exists rather than creating something new. So the bedrock pseudo-construct is actually the best we can do and will be useful if there are other places we want to send in a bedrock arn. Thanks @clareliguori
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Pull request has been modified.
@kaizencc I need your approval again - I ran into this issue with Mergify: |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Thanks for this PR! Sorry for a basic question, but how do i check which CDK version will contain this RP? |
@linkcd This is now released in 2.115.0 |
Step Functions recently released an optimized integration for Bedrock InvokeModel API, and these changes add support for adding the Bedrock InvokeModel task to Step Functions state machines.
Closes #28268.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license