ex-aws / ex_aws

A flexible, easy to use set of clients AWS APIs for Elixir
https://hex.pm/packages/ex_aws
MIT License
1.26k stars 521 forks source link

Bedrock endpoints #1023

Closed devstopfix closed 5 months ago

devstopfix commented 6 months ago

Hello! I am working with the Bedrock AWS service and would like to add this module to your project. I need the addition of the relevant endpoints (provided in this PR). For now I include all the supported regions with the exception of fips which I need to investigate - I see it requires different signing and I have not tested it :- https://docs.aws.amazon.com/general/latest/gr/bedrock.html#bedrock_region

I have implemented list, get and invoke models including streaming. I have not yet implemented agents or custom models - I want to start with the basics.

I will publish the repo in the new year. Here is an example:

prompt = ~s[
Please write me a polite excited memo in the style of a GitHub pull request.
The project name is ExAws. The feature is adding AI capabilities."
]

input = ExAws.Bedrock.Titan.TextModel.build(prompt, max_token_count: 450, temperature: 0.8)
request = ExAws.Bedrock.invoke_model("amazon.titan-text-lite-v1", input)
%{"results" => [%{"outputText" => output} | _]} = ExAws.request!(request, service_override: :bedrock)
output

generates:

Hey team! I am thrilled to announce the addition of AI capabilities to the project ExAws. This will be a game-changer for our users and will take the project to the next level. I want to give a special thanks to the team members who helped make this possible. Your hard work and dedication are greatly appreciated. Looking forward to seeing the impact of this feature. Let's keep up the great work and make ExAws the best it can be! Cheers,

deiwin commented 5 months ago

@bernardd, would you be able to take a look, please? This straight forward change would unblock anyone (including my team) who is trying to use this library for AWS Bedrock.

bernardd commented 5 months ago

Thanks @devstopfix!

bernardd commented 5 months ago

If and when you want to get the bedrock service repo added to the ex_aws organisation, please let me know :)

devstopfix commented 5 months ago

If and when you want to get the bedrock service repo added to the ex_aws organisation, please let me know :)

Thank you @bernardd! I am going through my code now - making sure it is fully tested and of same style and quality of ex_aws_s3 etc - will get back to you next week