pacphi / BedrockSpringBootStarterDemo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Demo for Spring Cloud AWS Bedrock Starter

This is a Companion Demo Project that leverages Spring Cloud AWS Bedrock Starter.

Prerequisites

Make use of an existing or sign up for a new, AWS account. You will need credentials with appropriate IAM role and permissions. (We've tested this with an IAM user with a role that has a PowerUserAccess AWS managed policy attached).

Download and install the following CLIs

Download and install a JDK and Maven

sdk install java 21.0.1-librca
sdk install maven 3.9.5

Accept these as the default versions

Include the right Maven dependency into your project

<dependency>
    <groupId>io.clue2solve</groupId>
    <artifactId>spring-cloud-aws-bedrock-starter</artifactId>
    <version>0.0.2-SNAPSHOT</version>
</dependency>

or build the Starter from sources and install it into your local Maven repository

Clone

gh repo clone https://github.com/pacphi/spring-cloud-aws-bedrock-starter
gh repo clone https://github.com/pacphi/BedrockSpringBootStarterDemo

Build

cd spring-cloud-aws-bedrock-starter
mvn clean install
cd ../BedrockSpringBootStarterDemo
mvn clean install

Set environment variables

export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=

Make certain you are using authorized AWS credentials

Setup Bedrock

Review Set up Amazon Bedrock instructions.

Launch application

mvn spring-boot:run

Press Ctrl+C to quit

Interact with service endpoints

Claude

❯ http POST :8080/claude/invoke data="How much on average does an African lion weigh in pounds"
HTTP/1.1 200
Connection: keep-alive
Content-Length: 440
Content-Type: application/json
Date: Thu, 30 Nov 2023 14:26:55 GMT
Keep-Alive: timeout=60

 Here are some key details about the average weight of African lions:

- Male African lions typically weigh 330 to 550 pounds (150 to 250 kg).

- Female African lions typically weigh 265 to 395 pounds (120 to 180 kg).

- On average, male African lions are larger and heavier than females. 

- The average weight for an adult male African lion is about 420 pounds (190 kg).

- The average weight for an adult female African lion is about 280

Jurassic

❯ http POST :8080/jurassic/invoke

Llama

❯ http POST :8080/llama/invoke

Titan

❯ http POST :8080/titan/invoke

StableDiffusion

❯ http POST :8080/stablediffusion/invoke

Or with the hoppscotch desktop application:

Stable Diffusion example

About


Languages

Language:Java 100.0%