# Wickr Bedrock Bot

This project is a WickrIO integration created via [cookiecutter-wickr-bot](https://github.com/WickrInc/cookiecutter-wickr-bot)

## Installation

See the WickrIO [Getting Started Guide](https://wickrinc.github.io/wickrio-docs/#wickr-io-getting-started).

## Usage

Bedrock Bot understands the following commands:

**Available commands in DMs**
- /clear - To clear the context in this conversation and start fresh
- /model - To learn what model is currently in use, and switch to a different model in this conversation
- /help - To generate a list of all available commands

**Available commands in Rooms**
- /chat - To start a conversation with the Bedrock bot in a room, type /chat before the conversation text
- /clear - To clear the context in this chat and start fresh
- /model - To learn what model is currently in use in this conversation, and find out other available models/help - To generate a list of all available commands

## Development

## Prerequisites
- AWS Account with appropriate permissions to Bedrock. Before you can chat with the bot, you need to [enable access to the configured models](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access-modify.html) within your AWS account. 
- Additionally, the host machine you're deploying from needs at least 2 CPU cores and 4GB of RAM to successfully run the WickrIOBedrock integration inside the WikcrIO docker container.
- Create an IAM role for your EC2 instance with the following policy:

```
{"Version": "2012-10-17",

"Statement": [

    {

        "Sid": "VisualEditor0",

        "Effect": "Allow",

        "Action": [

            "bedrock:InvokeModel",

            "bedrock:Retrieve",

            "bedrock:RetrieveAndGenerate",

            "bedrock:GenerateQuery",

            "bedrock:GetKnowledgeBase"

        ],

        "Resource": "*"

    }

]}
```
- Set up Knowledge base for your bedrock instance

## Configuration
Edit `model-config-yaml` file to include/exclude the models you want to configure for the bedrock bot. Follow the link below to see supported tools
https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-features.html
You can also configure other model parameters.

Edit `app-config-yaml` file to configure knowledge base id and guidelines accordingly.

### Building

Run `make` to create a new `software.tar.gz` package, which can be installed as a WickrIO Custom Integration. See the [WickrIO docs](https://wickrinc.github.io/wickrio-docs/#developing-integrations-creating-an-integration-locally) for more details.



