README.md

# ExAws.Bedrock

> The easiest way to build and scale generative AI applications with foundation models
> -- https://aws.amazon.com/bedrock/


Service module for [Elixir AWS](https://github.com/ex-aws/ex_aws).

***NOTE*** this is a work in progress as the operations are uploaded over the next few days
and requires a minimum `ex_aws` version of 2.5.1.

[![ci](https://github.com/devstopfix/ex_aws_bedrock/actions/workflows/ci.yml/badge.svg)](https://github.com/devstopfix/ex_aws_bedrock/actions/workflows/ci.yml)
[![Hex.pm](https://img.shields.io/hexpm/v/ex_aws_bedrock.svg?style=flat-square)](https://hex.pm/packages/ex_aws_bedrock)
[![API Docs](https://img.shields.io/badge/api-docs-MediumOrange.svg?style=flat)](https://hexdocs.pm/ex_aws_bedrock/ExAws.Bedrock.html)


## Installation

The package can be installed by adding `:ex_aws_bedrock` to your list of dependencies in `mix.exs`
along with `:ex_aws`, and your preferred HTTP client and JSON codec.

```elixir
def deps do
  [
    {:ex_aws, ">= 2.5.1"},
    {:ex_aws_bedrock, "~> 1.5"},
    {:hackney, "~> 1.9"},
    {:jason, "~> 1.1"},
    {:poison, "~> 3.0"}
  ]
end
```

## Unit tests

The default suite of unit tests verify the requests generated by this library. 
If you wish to test against AWS with live requests then you need to 
configure `ExAws` in the standard way as described in it's README.

For example you could create an `.env` file:

    export AWS_ACCESS_KEY_ID="AK..."
    export AWS_SECRET_ACCESS_KEY="..."
    export AWS_REGION="us-east-1"
    
Then set the variables and run the tests with:

    source .env && mix test --only aws

## Usage

The AWS bedrock actions and operations are defined in [ExAws.Bedrock module][mod].

Each model takes their inference parameters as JSON documents which are defined 
in the [model parameters section of the AWS user guide][models]. You can pass 
plain Elixir maps which are then JSON encoded, or define structs which implement
the encoder protocol of your chosen JSON codec. This library has an example
under [ExAws.Bedrock.Titan.TextModel](lib/ex_aws/bedrock/titan/text_model.ex).

## License

The MIT License (MIT).

[json]: https://hexdocs.pm/jason/Jason.Encoder.html
[mod]: https://hexdocs.pm/ex_aws_bedrock/ExAws.Bedrock.html
[models]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html