awslabs / generative-ai-cdk-constructs

AWS Generative AI CDK Constructs are sample implementations of AWS CDK for common generative AI patterns.
https://awslabs.github.io/generative-ai-cdk-constructs/
Apache License 2.0
330 stars 49 forks source link

(bedrock): implement prompt flows #647

Open aws-rafams opened 3 weeks ago

aws-rafams commented 3 weeks ago

Describe the feature

Prompt flows for Amazon Bedrock offers the ability for you to use supported foundation models (FMs) to build workflows by linking prompts, foundational models, and other AWS services to create end-to-end solutions. https://aws.amazon.com/bedrock/prompt-flows/

Use Case

Amazon Bedrock Prompt Flows accelerates the creation, testing, and deployment of workflows.

Proposed Solution

Implement a new module prompt.ts and prompt-flow.ts Cloudformation Resource is already available: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-bedrock-flow.html https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-bedrock-prompt.html CDK L1 should be available soon, we can already start talking about implementation details

Other Information

Can start working on the implementation right away as soon as L1 is released

Acknowledgements

krokoko commented 3 weeks ago

Thanks @aws-rafams ! As you mentioned, the feature is not exposed yet through the cdk, so it cannot be implemented now. In terms of implementation, I would see:

aws-rafams commented 3 weeks ago

CDK L1s released today in 2.154.0, starting implementation

krokoko commented 3 weeks ago

Just FYI, this new feature requires the library to be updated to cdk v2.154.0, however I just found out that there is a bug in that version (see here: https://github.com/aws/aws-cdk/issues/31183) which currently prevents the upgrade. The library won't build as a property was removed in cfnDataSource. For your local development, you can still use v2.154.0 and comment the data source part that is causing issues

aws-rafams commented 3 weeks ago

Thanks for the heads up! Currently doing local development with v2.154.1.

BTW, there's a bug in the CloudFormation resource for AWS::Bedrock::Flow->FlowNode.Type, which is currently delaying the implementation. Some node types that are available via the API and console, such as Retrieval, Storage, and Agent, are not listed in the CloudFormation resource.

I've created an issue to track this problem. I would really appreciate a +1 or a comment to the issue to help raise its visibility and priority.

krokoko commented 2 weeks ago

Created a separate ticket (https://github.com/awslabs/generative-ai-cdk-constructs/issues/664) for prompts/prompt management since the issue above is still open

aws-rafams commented 5 days ago

CloudFormation bug has been fixed, resuming implementation. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-bedrock-flow-flownode.html#cfn-bedrock-flow-flownode-type