Giter Site home page Giter Site logo

genai-sandbox's Introduction

Chatbot application using Amazon Bedrock Agents and Amplify Gen2

This project lets you provision a ready-to-use fully serverless chatbot application using Amazon Bedrock Agents and Amplify Gen2. The infrastructure code is using the AWS Cloud Development Kit(AWS CDK) and implemented in both Typescript. The frontend is written using React + Vite + Amplify.

Solution Architecture

Solution Architecture

Prerequisites

  • AWS CLI installed and configured with the aws account you want to use.
  • AWS CDK installed and configured with the aws account you want to use.
  • docker installed and is up and running locally (required for the lambda function builds).
  • node-js 18 installed. If using nvm, run nvm use 18

Before you start deployment, ensure that you have enabled Amazon Bedrock Models - Titan Embeddings V2 and Anthropic Claude Sonnet in the region where the stacks will be deployed. You can do this by logging into the AWS Console and using the request model access feature.

Also ensure that the region is correctly setup in the terminal environment where you are running the commands by executing

export AWS_REGION=<REGION> 

Using AWS Cloud9

Above dependencies are pre-installed when using an AWS Cloud9 environment and hence can be skipped. When using cloud9 remember to resize your ebs volume though by running the following commands from root folder

chmod +x utils/cloud9-resize.sh
./utils/cloud9-resize.sh 100

Security considerations

For the sake of this demo, not all security features are enabled to save cost and effort of setting up a working PoC.

Getting started

Deploy the CDK stack

Switch to the infrastructure-ts folder, install the libraries and deploy the stacks

cd infrastructure-ts
npm install
cdk bootstrap
cdk deploy 

Please check the readme file in the infrastructure directory for more details.

Building the frontend and middleware

  • Change directory to where UI code lives.
    cd chatbot-client
  • Restore NPM packages for the project
    npm install
  • Deploy the Amplify middleware
    npx ampx sandbox
  • Run the chat application
    npm run dev

Open the application in the browser and signup using your email. In the chatbot, type in your queries to see responses from the backend. To test the agent which you have deployed, start your queries with '/agent' for example you can query using

/agent show me my claims

Cleanup

Run the following command in the relevant infrastructure directory to delete the cloudformation stacks:

    cdk destroy

Found an issue? Anything to add?

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

genai-sandbox's People

Contributors

sathishc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.