This page describes how to run OpenChat Playground (OCP) with Amazon Bedrock integration.
-
Get the repository root.
# bash/zsh REPOSITORY_ROOT=$(git rev-parse --show-toplevel)
# PowerShell $REPOSITORY_ROOT = git rev-parse --show-toplevel
-
Make sure you are at the repository root.
cd $REPOSITORY_ROOT
-
Add Amazon Bedrock access details for Amazon Bedrock connection. Make sure you should replace
{{AMAZON_BEDROCK_ACCESS_KEY_ID}}and{{AMAZON_BEDROCK_SECRET_ACCESS_KEY}}with your Amazon Bedrock access key ID and secret access key respectively.# bash/zsh dotnet user-secrets --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp \ set AmazonBedrock:AccessKeyId "{{AMAZON_BEDROCK_ACCESS_KEY_ID}}" dotnet user-secrets --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp \ set AmazonBedrock:SecretAccessKey "{{AMAZON_BEDROCK_SECRET_ACCESS_KEY}}"
# PowerShell dotnet user-secrets --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp ` set AmazonBedrock:AccessKeyId "{{AMAZON_BEDROCK_ACCESS_KEY_ID}}" dotnet user-secrets --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp ` set AmazonBedrock:SecretAccessKey "{{AMAZON_BEDROCK_SECRET_ACCESS_KEY}}"
To get more details of Amazon Bedrock authenticaiton, refer to the doc, Generate Amazon Bedrock API keys to easily authenticate to the Amazon Bedrock API.
-
Run the app by passing both region and model parameters,
{{AMAZON_BEDROCK_REGION}}. The default deployment name OCP uses isamazon.nova-micro-v1:0.# bash/zsh dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- \ --connector-type AmazonBedrock \ --region "{{AMAZON_BEDROCK_REGION}}"
# PowerShell dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- ` --connector-type AmazonBedrock ` --region "{{AMAZON_BEDROCK_REGION}}"
Alternatively, if you want to run with a different deployment, say
ai21.jamba-1-5-mini-v1:0, other than the default one, you can specify it as an argument.# bash/zsh dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- \ --connector-type AmazonBedrock \ --region "{{AMAZON_BEDROCK_REGION}}" \ --model-id "ai21.jamba-1-5-mini-v1:0"
# PowerShell dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- ` --connector-type AmazonBedrock ` --region "{{AMAZON_BEDROCK_REGION}}" ` --model-id "ai21.jamba-1-5-mini-v1:0"
-
Open your web browser, navigate to
http://localhost:5280, and enter prompts.
-
Make sure that you have the Amazon Bedrock access details including access key ID, secret access key and region.
-
Make sure you are at the repository root.
cd $REPOSITORY_ROOT
-
Build a container.
docker build -f Dockerfile -t openchat-playground:latest . -
Get Azure AI Foundry API Key.
# bash/zsh ACCESS_KEY_ID=$(dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | \ sed -n '/^\/\//d; p' | jq -r '."AmazonBedrock:AccessKeyId"') SECRET_ACCESS_KEY=$(dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | \ sed -n '/^\/\//d; p' | jq -r '."AmazonBedrock:SecretAccessKey"')
# PowerShell $ACCESS_KEY_ID = (dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | ` Select-String -NotMatch '^//(BEGIN|END)' | ConvertFrom-Json).'AmazonBedrock:AccessKeyId' $SECRET_ACCESS_KEY = (dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | ` Select-String -NotMatch '^//(BEGIN|END)' | ConvertFrom-Json).'AmazonBedrock:SecretAccessKey'
-
Run the app. The default deployment name OCP uses is
amazon.nova-micro-v1:0.# bash/zsh - from locally built container docker run -i --rm -p 8080:8080 openchat-playground:latest \ --connector-type AmazonBedrock \ --access-key-id $ACCESS_KEY_ID \ --secret-access-key $SECRET_ACCESS_KEY \ --region "{{AMAZON_BEDROCK_REGION}}"
# PowerShell - from locally built container docker run -i --rm -p 8080:8080 openchat-playground:latest ` --connector-type AmazonBedrock ` --access-key-id $ACCESS_KEY_ID ` --secret-access-key $SECRET_ACCESS_KEY ` --region "{{AMAZON_BEDROCK_REGION}}"
# bash/zsh - from GitHub Container Registry docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest \ --connector-type AmazonBedrock \ --access-key-id $ACCESS_KEY_ID \ --secret-access-key $SECRET_ACCESS_KEY \ --region "{{AMAZON_BEDROCK_REGION}}"
# PowerShell - from GitHub Container Registry docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest ` --connector-type AmazonBedrock ` --access-key-id $ACCESS_KEY_ID ` --secret-access-key $SECRET_ACCESS_KEY ` --region "{{AMAZON_BEDROCK_REGION}}"
Alternatively, if you want to run with a different deployment, say
ai21.jamba-1-5-mini-v1:0, other than the default one, you can specify it as an argument:# bash/zsh - from locally built container docker run -i --rm -p 8080:8080 openchat-playground:latest \ --connector-type AmazonBedrock \ --access-key-id $ACCESS_KEY_ID \ --secret-access-key $SECRET_ACCESS_KEY \ --region "{{AMAZON_BEDROCK_REGION}}" \ --model-id "ai21.jamba-1-5-mini-v1:0"
# PowerShell - from locally built container docker run -i --rm -p 8080:8080 openchat-playground:latest ` --connector-type AmazonBedrock ` --access-key-id $ACCESS_KEY_ID ` --secret-access-key $SECRET_ACCESS_KEY ` --region "{{AMAZON_BEDROCK_REGION}}" ` --model-id "ai21.jamba-1-5-mini-v1:0"
# bash/zsh - from GitHub Container Registry docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest \ --connector-type AmazonBedrock \ --access-key-id $ACCESS_KEY_ID \ --secret-access-key $SECRET_ACCESS_KEY \ --region "{{AMAZON_BEDROCK_REGION}}" \ --model-id "ai21.jamba-1-5-mini-v1:0"
# PowerShell - from GitHub Container Registry docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest ` --connector-type AmazonBedrock ` --access-key-id $ACCESS_KEY_ID ` --secret-access-key $SECRET_ACCESS_KEY ` --region "{{AMAZON_BEDROCK_REGION}}" ` --model-id "ai21.jamba-1-5-mini-v1:0"
-
Open your web browser, navigate to
http://localhost:8080, and enter prompts.
-
Make sure that you have the Azure AI Foundry Endpoint URL.
-
Make sure you are at the repository root.
cd $REPOSITORY_ROOT
-
Login to Azure.
azd auth login
-
Check login status.
azd auth login --check-status
-
Initialize
azdtemplate.azd init
NOTE: You will be asked to provide environment name for provisioning.
-
Get Amazon Bedrock access details.
# bash/zsh ACCESS_KEY_ID=$(dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | \ sed -n '/^\/\//d; p' | jq -r '."AmazonBedrock:AccessKeyId"') SECRET_ACCESS_KEY=$(dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | \ sed -n '/^\/\//d; p' | jq -r '."AmazonBedrock:SecretAccessKey"')
# PowerShell $ACCESS_KEY_ID = (dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | ` Select-String -NotMatch '^//(BEGIN|END)' | ConvertFrom-Json).'AmazonBedrock:AccessKeyId' $SECRET_ACCESS_KEY = (dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | ` Select-String -NotMatch '^//(BEGIN|END)' | ConvertFrom-Json).'AmazonBedrock:SecretAccessKey'
-
Set Amazon Bedrock configuration to azd environment variables.
azd env set AMAZON_BEDROCK_ACCESS_KEY_ID $ACCESS_KEY_ID azd env set AMAZON_BEDROCK_SECRET_ACCESS_KEY $SECRET_ACCESS_KEY azd env set AMAZON_BEDROCK_REGION "{{AMAZON_BEDROCK_REGION}}"
The default deployment name OCP uses is
amazon.nova-micro-v1:0. If you want to run with a different deployment, sayai21.jamba-1-5-mini-v1:0, other than the default one, add it to azd environment variables.azd env set AMAZON_BEDROCK_MODEL_ID "ai21.jamba-1-5-mini-v1:0"
-
Set the connector type to
AmazonBedrock.azd env set CONNECTOR_TYPE AmazonBedrock -
Run the following commands in order to provision and deploy the app.
azd up
NOTE: You will be asked to provide Azure subscription and location for deployment.
Once deployed, you will be able to see the deployed OCP app URL.
-
Open your web browser, navigate to the OCP app URL, and enter prompts.
-
Clean up all the resources.
azd down --force --purge