This repository is a sample code coach(include code interpreter ) using the Anthropic company's LLM Claude 2, one of the foundational models provided by Amazon Bedrock for generative AI. This sample is an innovative tool designed to assist developers in writing efficient and high-quality code .
It's an architecture built on AWS managed services, eliminating the need for infrastructure management. Utilizing Amazon Bedrock, there's no need to communicate with APIs outside of AWS. This enables deploying scalable, reliable, and secure applications.
- Amazon DynamoDB: NoSQL database for user auth information storage
- Amazon Bedrock: Managed service to utilize foundational models via APIs
- Amazon CloudFront + S3: Frontend application delivery (React, Chakra UI)
- Piston : code runtime
- Amazon EC2
- Amazon Javascript sdk v3
codecoach-demo.mp4
CodeCoach Vimeo link:
-
Authentication (Sign-up, Sign-in)
-
IAM Role, AK/SK, Cognito identity support
-
Docker Image
-
Docker Compose deploy file
-
Export chat history
-
Syntax highlighting for code
-
Rendering of Markdown'
-
Streaming Response
-
Python runtime support
-
PHP runtime support
-
golang runtime support
-
"How to fix " support
-
CDN support
-
ECS support
-
Install script
-
Cloudfromation/ CDK deployment script
-
Require: Amazon Bedrock Claude and DynamoDB access permession.
-
Launch EC2 instance , amazon linux 2023, m5.large, security group open 3000 , craete IAM Role for it that need DynamoDB and Bedrock Access permession.
-
Create a DynamoDB table with the default table name "bedrock-claude-codecoach-users". The password needs to be sha1 encoded, any you can use some online tools such as https://codebeautify.org/sha1-hash-generator to generate it.
aws dynamodb create-table \ --table-name bedrock-claude-codecoach-users \ --attribute-definitions \ AttributeName=email,AttributeType=S \ --key-schema \ AttributeName=email,KeyType=HASH \ --provisioned-throughput \ ReadCapacityUnits=5,WriteCapacityUnits=5 #change your password aws dynamodb put-item \ --table-name bedrock-claude-codecoach-users \ --item \ '{"email": {"S": "[email protected]"}, "password": {"S": "<your password>"}, "role": {"S": "admin"}}' aws dynamodb put-item \ --table-name bedrock-claude-codecoach-users \ --item \ '{"email": {"S": "[email protected]"}, "password": {"S": "<your password>"}, "role": {"S": "guest"}}'
-
install nodejs, yarn ,docker
sudo yum install nodejs.x86_64 git docker -y sudo npm install yarn -g sudo systemctl start docker sudo usermod -aG docker ec2-user #need relogin cd ~ python3 -m venv .venv . .venv/bin/activate pip install docker-compose git clone https://github.com/aws-samples/bedrock-claude-codecoach.git cd bedrock-claude-codecoach docker build -t codecoach . docker-compose up -d
-
install piston language runtime
cd ~ git clone https://github.com/engineer-man/piston.git cd piston/cli && yarn && cd ../ #install cli/index.js --piston-url http://127.0.0.1:2000 ppman install python=3.10.0 cli/index.js --piston-url http://127.0.0.1:2000 ppman install node cli/index.js --piston-url http://127.0.0.1:2000 ppman install go cli/index.js --piston-url http://127.0.0.1:2000 ppman install php cli/index.js --piston-url http://127.0.0.1:2000 ppman install typescript
-
Access CodeCoach
http://<ec2>:3000
- How to set up authentication? There are two roles for the user: the admin role uses EC2 IAM Role, and the guest can set up their own bedrock AK/SK and Cognito Identity Pool. All information is only saved locally, so if you refresh the browser, you need to set it up again.