Implement AWS Bedrock Provider via Converse API#181
Implement AWS Bedrock Provider via Converse API#181junaidbhura wants to merge 5 commits intoWordPress:trunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Hi @JasonTheAdams @felixarntz what do you think about this feature? |
|
Hi @junaidbhura! Thank you for sharing this! Our goal is to get the PHP and WP AI Clients into WordPress 7.0. As a part of this effort, we're actually going to be removing all providers from the PHP AI Client repository and moving them to their own repositories to be standalone packages/plugins. The reason for this is to decouple WordPress from any one provider, making use of packages and the wp.org plugins repository for folks to use the provider they want. We encourage you to do the same! We've discussed having some sort of a community list, but there aren't clear plans for how we want to do that yet. For now, users can find your provider plugin on the .org repository once it's accepted. |
|
Thanks @JasonTheAdams and @felixarntz. I wasn't sure how exactly this package is going to get merged into WordPress Core. Since this is currently a Composer package, I've gone ahead and released my feature as a Composer package as well, with this package as a dependency: https://github.com/Aysnc-Labs/wordpress-php-ai-client-bedrock I'll go ahead and close this Pull Request. I'll keep the issue #180 open for you to close out as needed. |
Closes #180
Summary
This PR introduces the
AwsBedrockProviderand its associated infrastructure. By leveraging the AWS Bedrock Converse API, this implementation provides a unified interface for multiple foundation models (Anthropic Claude, Meta Llama, Mistral, etc.) while adhering to enterprise-level security and compliance standards.Key Implementation Details
AwsBedrockApiKeyRequestAuthentication. This utilizes Bedrock’s native API Key (Bearer Token) support, ensuring the SDK remains lightweight without requiring the full AWS PHP SDK or SigV4 signing.converseandconverse-streamlogic.MessagePartandFileDTOs.FunctionDeclarationto Bedrock'stoolConfig, including support fortoolResultandtoolUseblocks.AwsBedrockModelMetadataDirectoryautomatically infers model capabilities (Text, Image, Tools) from the AWS Control Plane.Technical Architecture
bedrock.region.amazonaws.com) for model listing and Runtime (bedrock-runtime.region.amazonaws.com) for inference.stopReasonvalues are mapped to the library'sFinishReasonEnum.Testing & Verification
I have verified this implementation against the following scenarios using the
anthropic.claude-3-5-sonnet-20241022-v2:0model:usageobject.toolUsearguments intoFunctionCallDTOs.Example Usage