Skip to content

Conversation

maxjiang153
Copy link
Contributor

@maxjiang153 maxjiang153 commented Apr 16, 2024

Re-write Bedrock BedrockAwsConnectionConfiguration to use AwsCredentialsProvider and AwsRegionProvider to manage Amazon Bedrock AI model connections.

With this change, Spring-AI will provide the capability to customize the AwsCredentialsProvider and AwsRegionProvider configurations. Also with this feature, Spring-AI has capabilities compatible with Spring Cloud AWS credential management.

@maxjiang153
Copy link
Contributor Author

maxjiang153 commented Apr 17, 2024

@tzolov Could you check this out?  I know this is a breakable change. But it's very helpful for some of the projects that are using Spring Cloud AWS and Spring AI for AWS Bedrock usage.

Looking forward to your suggestions.

@tzolov
Copy link
Contributor

tzolov commented Apr 20, 2024

Hi @wmz7year, thanks for taking a pick at this.

Before we start reviewing it i have to point that the <artifactId>spring-cloud-aws-starter</artifactId> is not acceptable.
In fact no boot starter in a library code is ok.

So please cherry pick only the necessary minim of dependency. Often the awspring starters will try to bring the entire AWS ecosystem into your project.

@maxjiang153
Copy link
Contributor Author

Maybe there is another solution for the compatibility between Spring-AI and Spring-Cloud-AWS.

Sprint AI defined connection properties in BedrockAwsConnectionConfiguration and created AwsCredentialsProvider in BedrockAwsConnectionConfiguration.

But currently, we don't use AwsRegionProvider to manage the region configuration.

So maybe we can keep the current BedrockAwsConnectionConfiguration and the other BedrockClients's auto-configuration conditions; maybe only check 'AwsCredentialsProvider' and AwsRegionProvider, not dependency with BedrockAwsConnectionProperties.

So this will be compatible with Spring-Cloud-AWS and not necessarily integrated with it.

How do you think about this, if this is ok I'll change the PR @tzolov

@maxjiang153 maxjiang153 marked this pull request as draft April 20, 2024 10:15
@maxjiang153 maxjiang153 marked this pull request as ready for review April 20, 2024 13:18
@maxjiang153 maxjiang153 changed the title Integration of Spring Cloud AWS to management AWS credentials and region configuration to use AWS Bedrock. Bedrock client auto-configuration support external AwsCredentialsProvider and AwsRegionProvider Apr 20, 2024
@maxjiang153
Copy link
Contributor Author

Hi @tzolov could you check this out again? I removed spring-cloud-aws dependency and provided new capabilities with custom AwsCredentialsProvider and AwsRegionProvider .

Copy link
Contributor

@tzolov tzolov left a comment

Choose a reason for hiding this comment

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

Thank you @wmz7year. It looks very good.
Please fix the minor test naming issue and we are very close to merging it.

@maxjiang153 maxjiang153 requested a review from tzolov April 21, 2024 10:12
@tzolov tzolov added model client enhancement New feature or request labels Apr 22, 2024
@tzolov tzolov added this to the 1.0.0-M1 milestone Apr 22, 2024
@tzolov
Copy link
Contributor

tzolov commented Apr 22, 2024

Thank you @wmz7year , PR LGTM

@tzolov tzolov merged commit 563f9b4 into spring-projects:main Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request model client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants