Skip to content

Commit e7ba169

Browse files
committed
nova model added
1 parent e919089 commit e7ba169

File tree

7 files changed

+31
-9
lines changed

7 files changed

+31
-9
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,16 @@ For a more accurate cost estimate, use the AWS Pricing Calculator and input your
9090

9191
### Supported AI Models
9292

93-
The system supports three different AI models for chat moderation:
93+
The system supports four different AI models for chat moderation:
9494

9595
1. **Anthropic Claude Haiku**: Claude 3 Haiku is Anthropic's fastest, most compact model for near-instant responsiveness. It answers simple queries and requests with speed. Customers will be able to build seamless AI experiences that mimic human interactions. Claude 3 Haiku can process images and return text outputs, and features a 200K context window.
9696

9797
2. **Amazon Titan**: Amazon Titan Text Premier is an advanced, high-performance, and cost-effective LLM engineered to deliver superior performance for enterprise-grade text generation applications, including optimized performance for retrieval-augmented generation (RAG) and Agents.
9898

9999
3. **Meta Llama**: Meta Llama 3 is an accessible, open large language model (LLM) designed for developers, researchers, and businesses to build, experiment, and responsibly scale their generative AI ideas. Part of a foundational system, it serves as a bedrock for innovation in the global community. Ideal for limited computational power and resources, edge devices, and faster training times.
100100

101+
4. **Amazon Nova Micro**: Amazon Nova family of models offer customers multiple price performance operating points to best optimize between accuracy, speed, and cost. Amazon Nova Micro is a text only model that delivers the lowest latency responses at the lowest cost per inference among Nova family.
102+
101103
Each model has its own strengths and characteristics. You can switch between these models using the `prompt-switch.bash` script.
102104

103105
## Prerequisites
@@ -222,7 +224,7 @@ To switch between different AI models or prompts:
222224
./prompt-switch.bash <model-name>
223225
```
224226

225-
Replace `<model-name>` with one of the available options: `titan`, `haiku`, or `llama`. The aforementioned `./install.bash` script configures Anthropic Claude Haiku to be used by default.
227+
Replace `<model-name>` with one of the available options: `titan`, `haiku`, `llama` or `nova-micro`. The aforementioned `./install.bash` script configures Anthropic Claude Haiku to be used by default.
226228

227229
### Updating the Front-End
228230

@@ -234,6 +236,10 @@ After making changes to the front-end code, deploy updates using:
234236

235237
This script will build the React application and update the S3 bucket and CloudFront distribution. This is not required at the first deployment.
236238

239+
### Scripts Usage
240+
241+
The scripts should be executed from the `./scripts` directory. Running from another path may cause issues or the scripts may fail.
242+
237243
### Moderation Guidelines
238244

239245
The AI models use the following prompt as the main guideline for moderating chat messages:

backend/cdk/lib/api-stack.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ export class Api extends cdk.NestedStack {
306306
`arn:aws:bedrock:${this.region}:*:foundation-model/amazon.titan-text-premier-v1:0`,
307307
`arn:aws:bedrock:${this.region}:*:foundation-model/anthropic.claude-3-haiku-20240307-v1:0`,
308308
`arn:aws:bedrock:${this.region}:*:foundation-model/meta.llama3-8b-instruct-v1:0`,
309+
`arn:aws:bedrock:${this.region}:*:foundation-model/amazon.nova-micro-v1:0`
309310
],
310311
}),
311312
],

backend/cdk/lib/main-stack.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export class MainStack extends cdk.Stack {
6565
"amazon.titan-text-premier-v1:0",
6666
"anthropic.claude-3-haiku-20240307-v1:0",
6767
"meta.llama3-8b-instruct-v1:0",
68+
"amazon.nova-micro-v1:0"
6869
];
6970

7071
const observability = new Observability(this, "Observability", {

scripts/insert-prompt.bash

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Check if an argument is provided
44
if [ -z "$1" ]; then
5-
echo -e "\n${RED}[ERROR] Please provide a model name (titan, haiku, or llama) as an argument."
5+
echo -e "\n${RED}[ERROR] Please provide a model name (titan, haiku, llama or nova-micro) as an argument."
66
exit 1
77
fi
88

@@ -51,8 +51,16 @@ case "$1" in
5151
TEMPERATURE=0
5252
TOP_P=0
5353
;;
54+
nova-micro)
55+
MODEL_ID="amazon.nova-micro-v1:0"
56+
MODEL_NAME="Amazon Nova Micro"
57+
MODEL_OUTPUT_KEY="NovaMicroModelUUID"
58+
MAX_TOKENS=256
59+
TEMPERATURE=0
60+
TOP_P=0
61+
;;
5462
*)
55-
echo -e "\n${RED}[ERROR] Invalid model name provided. Please use titan, haiku, or llama."
63+
echo -e "\n${RED}[ERROR] Invalid model name provided. Please use titan, haiku, llama or nova-micro."
5664
exit 1
5765
;;
5866
esac
@@ -102,4 +110,4 @@ if [ $? -eq 0 ]; then
102110
else
103111
echo -e "\n${RED}[ERROR] Failed to insert ${MODEL_NAME} model prompt.${NC}"
104112
exit 1
105-
fi
113+
fi

scripts/install.bash

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ update_and_run_scripts() {
147147
run_script ./insert-prompt.bash haiku
148148

149149
run_script ./insert-prompt.bash llama
150-
150+
151+
run_script ./insert-prompt.bash nova-micro
152+
151153
run_script ./prompt-switch.bash haiku
152154

153155
run_script ./publish.bash

scripts/prompt-switch.bash

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ STACK_NAME=$(jq -r 'keys[0]' "$CDK_OUTPUTS_FILE")
1010
TITAN_MODEL_UUID=$(jq -r '.'"$STACK_NAME"'.TitanModelUUID' "$CDK_OUTPUTS_FILE")
1111
HAIKU_MODEL_UUID=$(jq -r '.'"$STACK_NAME"'.HaikuModelUUID' "$CDK_OUTPUTS_FILE")
1212
LLAMA_MODEL_UUID=$(jq -r '.'"$STACK_NAME"'.LlamaModelUUID' "$CDK_OUTPUTS_FILE")
13+
NOVA_MICRO_MODEL_UUID=$(jq -r '.'"$STACK_NAME"'.NovaMicroModelUUID' "$CDK_OUTPUTS_FILE")
1314
PROMPT_SWITCH_PARAMETER_NAME=$(jq -r '.'"$STACK_NAME"'.PromptSwitchParameterName' "$CDK_OUTPUTS_FILE")
1415

1516
# Color variables
@@ -36,8 +37,11 @@ case "$1" in
3637
llama)
3738
NEW_ACTIVE_MODEL="$LLAMA_MODEL_UUID"
3839
;;
40+
nova-micro)
41+
NEW_ACTIVE_MODEL="$NOVA_MICRO_MODEL_UUID"
42+
;;
3943
*)
40-
echo -e "\n${RED}[ERROR] Invalid model name provided. Please use titan, haiku, or llama."
44+
echo -e "\n${RED}[ERROR] Invalid model name provided. Please use titan, haiku, llama or nova-micro."
4145
exit 1
4246
;;
4347
esac
@@ -57,4 +61,4 @@ if [ $? -ne 0 ]; then
5761
fi
5862

5963
echo -e "\n${YELLOW}[WARNING] Model and prompt switched to: $1 (UUID: $NEW_ACTIVE_MODEL)"
60-
echo -e "\n${GREEN}[SUCCESS] Model and prompt switch completed successfully!${NC}"
64+
echo -e "\n${GREEN}[SUCCESS] Model and prompt switch completed successfully!${NC}"

scripts/publish.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,4 @@ aws cloudfront wait invalidation-completed --distribution-id "$CLOUDFRONT_DISTRI
8888
check_status "CloudFront invalidation completion"
8989

9090
echo -e "\n${GREEN}[SUCCESS] Front-End Environment published successfully.${NC}"
91-
echo -e "\n${BLUE}[INFO] CloudFront Distribution Domain: https://${CLOUDFRONT_DISTRIBUTION_DOMAIN}${NC}"
91+
echo -e "\n${BLUE}[INFO] CloudFront Distribution Domain: https://${CLOUDFRONT_DISTRIBUTION_DOMAIN}${NC}"

0 commit comments

Comments
 (0)