This guide will walk you through the steps to set up the genai-bedrock-voicebot
projects using AWS Amplify and App Runner.
- Fork the Repository
- Login to AWS
- Create a GitHub Connection in AWS App Runner
- Create the Admin Console Amplify App
- Retrieve API Endpoints
- Create the Chat UI Amplify App
- Update Environment Variable in Admin Console
- Navigate to the repository: genai-bedrock-voicebot.
- Click on the Fork button at the top right corner.
- Select your GitHub account to create the fork.
- Once forked, note down your fork's URL (e.g.,
https://github.com/<YourGitHubUsername>/genai-bedrock-voicebot
).
- Open the AWS Management Console.
- Enter your AWS account credentials to log in.
2.1. Enable Bedrock "Mixtral 8x7B Instruct" LLM Model Access
- In the AWS Console, search for App Runner and open the App Runner console.
- Click on Connections in the left-hand menu.
- Click Create connection.
- Follow the instructions to authenticate your GitHub account and create the connection.
- Copy the ARN of the newly created GitHub connection.
step-1 In the console navigate for "AWS App Runner" and click on three horizontal bars in the top left.
step-2 Now click on connected account.
step-2 Select Github in drop down and click on Add
Step 4 Provide a connection name, select Github App, then click on Next.
Step 5 Now copy the ARN and provide it in the Environment Variable.
- Open the AWS Amplify console by searching for Amplify in the AWS Console.
- Click New App > Host web app.
- Select GitHub as the repository provider and connect your GitHub account.
- Now click on Authorize AWS Amplify.
- If your GitHub repository does not appear in the search box, click on Update GitHub permissions.
- Choose All repository and click on Install and Authorize.
Now search for the recently created repository which contains all the files.
- Choose your forked repository and select the branch you want to use (default:
main
). - Enable Monorepo and set the "Monorepo root Directory" to
amplify-chat-admin
.- On the next screen, modify the project name to something like
genai-bedrock-voicebot-admin
.
- On the next screen, modify the project name to something like
- Scroll down and expand Advance Settings, then click on Add New.
In the Advanced settings section, add the following environment variables:
JWT_SECRET='<Specify a random string>'
APPRUNNER_GITHUB_URL='<Your GitHub Fork URL>'
APPRUNNER_GITHUB_BRANCH_MAIN='<Your GitHub Fork Branch Name>'
(Default ismain
)APPRUNNER_GITHUB_CONNECTION_ARN='<ARN of GitHub Connection from App Runner>'
CHAT_PROD_API=""
(Leave this blank initially)BHASHINI_USER_ID="<User ID of Bhashini>"
(Optional)BHASHINI_API_KEY="<API Key of Bhashini>"
(Optional)
- Review everything and click on Save and Deploy
- It will start creating Amplify App for you.
- Soon, it will start deploying.
- It will take a few minutes to deploy.
- Wait for the deployment to complete.
- Download the
amplify_outputs.json
file from the Amplify console. - Locate the following variables in the last two lines of the file:
VITE_APIGW_ENDPOINT: <HTTP API Gateway URL>
VITE_STREAMING_API_ENDPOINT: <App Runner URL>
- Note down these values for later use.
- In the Amplify console, click New App > Host web app.
- Select your forked repository and branch.
- Set the "Monorepo root Directory" to
amplify-chat-ui
. - Click Next.
In the Advanced settings section, add the following environment variables:
VITE_APIGW_ENDPOINT='<HTTP API Gateway URL>'
(from the previous step)VITE_STREAMING_API_ENDPOINT='<App Runner URL>'
(from the previous step)
- Modify the project name to something like
genai-bedrock-voicebot-chat-ui
. - Click Save and Deploy.
- After deploying the Chat UI, copy the Amplify URL for the Chat UI deployment.
- Return to the Amplify console for the Admin Console project (
genai-bedrock-voicebot-admin
). - Navigate to Environment Variables.
- Update the
CHAT_PROD_API
environment variable with the URL of the Chat UI Amplify project. - Redeploy the Admin Console application to apply the changes.
This guide should help you set up both the Admin Console and Chat UI projects in AWS Amplify, with all necessary configurations and environment variables in place.
To test the application, follow these steps:
Open the Amplify Admin Application URL:
Navigate to the URL provided by the Amplify Admin Console deployment.Cognito Authentication:
The application will prompt you for authentication using Amazon Cognito. Create an account using your email ID.- After signing up, check your email for a verification link.
- Complete the email verification and log in to the console.
Access the Chatbot:
Test Basic Functionality:
Validate Website Crawling:
- Wait for approximately 30 minutes to allow the backend engine to crawl the specified website.
- Afterward, try asking a question related to the website content to experience the capabilities of the GenAI chatbot powered by Amazon Bedrock.
Test Voice Bot Functionality:
- Click on the microphone button to test the voice bot functionality.
- The bot supports voice input in English and Hindi (powered by Amazon Polly) and other Indian local languages if Bhashini is configured.
- If you have entered your Bhashini User ID and API Key, the bot will also respond in regional Indian languages.
Integrate Chatbot into a Website:
- For demo purposes, the chatbot can be integrated into any website via a TamperMonkey script.
- For production deployment, you can embed the chatbot directly into the website using a simple 4-line script.
Comments
Post a Comment