Skip to content

Commit a71468d

Browse files
authored
Update to version v1.2.0
Update to version v1.2.0
2 parents 3ddb3ea + 9920481 commit a71468d

File tree

73 files changed

+804
-256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+804
-256
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.2.0] - 2023-12-18
9+
10+
### Added
11+
12+
- Support for Amazon Titan Text Lite, Anthropic Claude v2.1, Cohere Command models, and Meta Llama 2 Chat models
13+
14+
### Changed
15+
16+
- Increase the cap on the max number of docs retrieved in the Amazon Kendra retriever (for RAG use cases) from 5 to 100, to match the API limit
17+
18+
### Fixed
19+
20+
- Fix typo in UI deployment instructions (#26)
21+
- Fix bug causing failures with dictionary type advanced model parameters
22+
- Fixed bug causing erroneous error messages to appear to user in long running conversations
23+
24+
### Security
25+
26+
- Updated Python and Node package versions to resolve security vulnerabilities
27+
828
## [1.1.1] - 2023-11-16
929

1030
### Fixed

source/infrastructure/cdk.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@aws-cdk/core:target-partitions": ["aws", "aws-cn", "aws-us-gov"],
2929
"solution_id": "SO0276",
3030
"solution_name": "generative-ai-application-builder-on-aws",
31-
"solution_version": "v1.1.0",
31+
"solution_version": "v1.2.0",
3232
"app_registry_name": "GAAB",
3333
"application_type": "AWS-Solutions",
3434
"application_trademark_name": "Generative AI Application Builder on AWS"

source/infrastructure/lib/metrics/deployment-platform-dashboard.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
1616
import { Construct } from 'constructs';
1717
import { CustomDashboard, CustomDashboardProps } from './custom-dashboard';
1818
import { CloudWatchNamespace, CloudWatchMetrics } from '../utils/constants';
19-
import { SERVICE_NAME } from '../../lib/utils/constants'
19+
import { SERVICE_NAME } from '../../lib/utils/constants';
2020

2121
/**
2222
* This construct creates a custom Dashboard in Amazon CloudWatch and adds widgets and defines metrics. It defines
@@ -168,7 +168,7 @@ export class DeploymentPlatformDashboard extends CustomDashboard {
168168
statistic: cloudwatch.Stats.SAMPLE_COUNT,
169169
period: cdk.Duration.hours(1),
170170
dimensionsMap: {
171-
service: SERVICE_NAME,
171+
service: SERVICE_NAME
172172
},
173173
color: cloudwatch.Color.BLUE
174174
}),
@@ -178,7 +178,7 @@ export class DeploymentPlatformDashboard extends CustomDashboard {
178178
label: CloudWatchMetrics.UC_INITIATION_FAILURE + 'Count',
179179
statistic: cloudwatch.Stats.SAMPLE_COUNT,
180180
dimensionsMap: {
181-
service: SERVICE_NAME,
181+
service: SERVICE_NAME
182182
},
183183
period: cdk.Duration.hours(1),
184184
color: cloudwatch.Color.ORANGE
@@ -189,7 +189,7 @@ export class DeploymentPlatformDashboard extends CustomDashboard {
189189
label: CloudWatchMetrics.UC_DELETION_SUCCESS + 'Count',
190190
statistic: cloudwatch.Stats.SAMPLE_COUNT,
191191
dimensionsMap: {
192-
service: SERVICE_NAME,
192+
service: SERVICE_NAME
193193
},
194194
period: cdk.Duration.hours(1),
195195
color: cloudwatch.Color.PURPLE
@@ -200,7 +200,7 @@ export class DeploymentPlatformDashboard extends CustomDashboard {
200200
label: CloudWatchMetrics.UC_DELETION_FAILURE + 'Count',
201201
statistic: cloudwatch.Stats.SAMPLE_COUNT,
202202
dimensionsMap: {
203-
service: SERVICE_NAME,
203+
service: SERVICE_NAME
204204
},
205205
period: cdk.Duration.hours(1),
206206
color: cloudwatch.Color.RED
@@ -211,7 +211,7 @@ export class DeploymentPlatformDashboard extends CustomDashboard {
211211
label: CloudWatchMetrics.UC_UPDATE_SUCCESS + 'Count',
212212
statistic: cloudwatch.Stats.SAMPLE_COUNT,
213213
dimensionsMap: {
214-
service: SERVICE_NAME,
214+
service: SERVICE_NAME
215215
},
216216
period: cdk.Duration.hours(1),
217217
color: cloudwatch.Color.GREEN
@@ -222,7 +222,7 @@ export class DeploymentPlatformDashboard extends CustomDashboard {
222222
label: CloudWatchMetrics.UC_UPDATE_FAILURE + 'Count',
223223
statistic: cloudwatch.Stats.SAMPLE_COUNT,
224224
dimensionsMap: {
225-
service: SERVICE_NAME,
225+
service: SERVICE_NAME
226226
},
227227
period: cdk.Duration.hours(1),
228228
color: cloudwatch.Color.BROWN
@@ -233,7 +233,7 @@ export class DeploymentPlatformDashboard extends CustomDashboard {
233233
label: CloudWatchMetrics.UC_DESCRIBE_SUCCESS + 'Count',
234234
statistic: cloudwatch.Stats.SAMPLE_COUNT,
235235
dimensionsMap: {
236-
service: SERVICE_NAME,
236+
service: SERVICE_NAME
237237
},
238238
period: cdk.Duration.hours(1),
239239
color: cloudwatch.Color.PINK
@@ -244,7 +244,7 @@ export class DeploymentPlatformDashboard extends CustomDashboard {
244244
label: CloudWatchMetrics.UC_DESCRIBE_FAILURE + 'Count',
245245
statistic: cloudwatch.Stats.SAMPLE_COUNT,
246246
dimensionsMap: {
247-
service: SERVICE_NAME,
247+
service: SERVICE_NAME
248248
},
249249
period: cdk.Duration.hours(1),
250250
color: cloudwatch.Color.GREY

source/infrastructure/lib/use-case-management/management-stack.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,9 @@ const buildCfnDeployRole = (scope: Construct): iam.Role => {
659659
'dynamodb:CreateTable',
660660
'dynamodb:DeleteTable',
661661
'dynamodb:UpdateTimeToLive',
662-
'dynamodb:DescribeTimeToLive'
662+
'dynamodb:DescribeTimeToLive',
663+
'dynamodb:TagResource',
664+
'dynamodb:ListTagsOfResource'
663665
],
664666
resources: [
665667
`arn:${cdk.Aws.PARTITION}:dynamodb:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:table/*`

source/infrastructure/lib/utils/app-registry-aspects.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import * as appreg from '@aws-cdk/aws-servicecatalogappregistry-alpha';
1616
import * as cdk from 'aws-cdk-lib';
1717
import { CfnResourceAssociation } from 'aws-cdk-lib/aws-servicecatalogappregistry';
1818
import { Construct, IConstruct } from 'constructs';
19-
import * as crypto from 'crypto';
19+
import { hashValues } from './common-utils';
2020

2121
export interface AppRegistryProps {
2222
/**
@@ -116,11 +116,15 @@ export class AppRegistry extends Construct implements cdk.IAspect {
116116
}
117117

118118
const nestedStack = node;
119-
new CfnResourceAssociation(nestedStack, `ResourceAssociation${crypto.randomUUID()}`, {
120-
application: this.application.get(node.nestedStackParent!.stackId)!.applicationArn,
121-
resource: node.stackId,
122-
resourceType: 'CFN_STACK'
123-
});
119+
new CfnResourceAssociation(
120+
nestedStack,
121+
`ResourceAssociation${hashValues(cdk.Names.nodeUniqueId(nestedStack.node))}`,
122+
{
123+
application: this.application.get(node.nestedStackParent!.stackId)!.applicationId,
124+
resource: node.stackId,
125+
resourceType: 'CFN_STACK'
126+
}
127+
);
124128

125129
(nestedStack.node.defaultChild as cdk.CfnResource).addDependency(
126130
this.application.get(node.nestedStackParent!.stackId)!.node.defaultChild as cdk.CfnResource

source/infrastructure/lib/utils/common-utils.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import * as cdk from 'aws-cdk-lib';
1717
import * as iam from 'aws-cdk-lib/aws-iam';
1818
import * as lambda from 'aws-cdk-lib/aws-lambda';
1919
import * as s3_asset from 'aws-cdk-lib/aws-s3-assets';
20+
import * as crypto from 'crypto';
2021
import * as fs from 'fs';
2122
import * as log from 'npmlog';
2223
import * as path from 'path';
@@ -374,3 +375,12 @@ export function createDefaultLambdaRole(scope: Construct, id: string): iam.Role
374375

375376
return role;
376377
}
378+
379+
/**
380+
* Generates a unique hash identfifer using SHA256 encryption algorithm.
381+
*/
382+
export function hashValues(...values: string[]): string {
383+
const sha256 = crypto.createHash('sha256');
384+
values.forEach((val) => sha256.update(val));
385+
return sha256.digest('hex').slice(0, 12);
386+
}

source/infrastructure/lib/utils/constants.ts

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,26 @@ export const enum CHAT_PROVIDERS {
120120
export const SUPPORTED_CHAT_PROVIDERS = [CHAT_PROVIDERS.HUGGING_FACE, CHAT_PROVIDERS.ANTHROPIC, CHAT_PROVIDERS.BEDROCK];
121121

122122
export const enum BEDROCK_MODEL_FAMILIES {
123+
AI21 = 'ai21',
123124
AMAZON = 'amazon',
124125
ANTHROPIC = 'anthropic',
125-
AI21 = 'ai21'
126+
COHERE = 'cohere',
127+
META = 'meta'
126128
}
127129

128130
export const SUPPORTED_BEDROCK_CHAT_MODELS = [
129131
`${BEDROCK_MODEL_FAMILIES.AI21}.j2-ultra`,
130132
`${BEDROCK_MODEL_FAMILIES.AI21}.j2-mid`,
131133
`${BEDROCK_MODEL_FAMILIES.AMAZON}.titan-text-express-v1`,
134+
`${BEDROCK_MODEL_FAMILIES.AMAZON}.titan-text-lite-v1`,
132135
`${BEDROCK_MODEL_FAMILIES.ANTHROPIC}.claude-v1`,
133136
`${BEDROCK_MODEL_FAMILIES.ANTHROPIC}.claude-v2`,
134-
`${BEDROCK_MODEL_FAMILIES.ANTHROPIC}.claude-instant-v1`
137+
`${BEDROCK_MODEL_FAMILIES.ANTHROPIC}.claude-v2:1`,
138+
`${BEDROCK_MODEL_FAMILIES.ANTHROPIC}.claude-instant-v1`,
139+
`${BEDROCK_MODEL_FAMILIES.COHERE}.command-text-v14`,
140+
`${BEDROCK_MODEL_FAMILIES.COHERE}.command-light-text-v14`,
141+
`${BEDROCK_MODEL_FAMILIES.META}.llama2-13b-chat-v1`,
142+
`${BEDROCK_MODEL_FAMILIES.META}.llama2-70b-chat-v1`
135143
];
136144

137145
export const DEFAULT_HUGGINGFACE_TEMPERATURE = 1;
@@ -162,6 +170,9 @@ Current conversation:
162170
Human: {input}
163171
AI:`;
164172

173+
export const DEFAULT_META_CHAT_PROMPT = `[INST] ${DEFAULT_CHAT_PROMPT} [/INST]`;
174+
export const DEFAULT_META_RAG_PROMPT = `[INST] ${DEFAULT_HUGGINGFACE_RAG_PROMPT} [/INST]`
175+
165176
export const SUPPORTED_ANTHROPIC_CHAT_MODELS = ['claude-instant-1', 'claude-1', 'claude-2'];
166177
export const DEFAULT_ANTHROPIC_TEMPERATURE = 1;
167178
export const MIN_ANTHROPIC_TEMPERATURE = 0;
@@ -199,6 +210,9 @@ Assistant:`;
199210
export const DEFAULT_BEDROCK_AMAZON_PROMPT = DEFAULT_CHAT_PROMPT;
200211
export const DEFAULT_BEDROCK_ANTHROPIC_PROMPT = DEFAULT_ANTHROPIC_CHAT_PROMPT;
201212
export const DEFAULT_BEDROCK_AI21_PROMPT = DEFAULT_CHAT_PROMPT;
213+
export const DEFAULT_BEDROCK_COHERE_PROMPT = DEFAULT_CHAT_PROMPT;
214+
export const DEFAULT_BEDROCK_META_PROMPT = DEFAULT_META_CHAT_PROMPT;
215+
202216
export const DEFAULT_BEDROCK_AMAZON_RAG_PROMPT = `Instructions: You are an AI Assistant created to help answer the User's question. You are only to answer the User's question using the provided references. You are not allowed to make things up or use your own knowledge. Only use what is provided between the <references> XML tags.
203217
204218
Here are the only references you can use:
@@ -213,6 +227,28 @@ User: {input}
213227
Bot:`;
214228
export const DEFAULT_BEDROCK_ANTHROPIC_RAG_PROMPT = DEFAULT_ANTHROPIC_RAG_PROMPT;
215229
export const DEFAULT_BEDROCK_AI21_RAG_PROMPT = DEFAULT_HUGGINGFACE_RAG_PROMPT;
230+
export const DEFAULT_BEDROCK_COHERE_RAG_PROMPT = DEFAULT_HUGGINGFACE_RAG_PROMPT;
231+
export const DEFAULT_BEDROCK_META_RAG_PROMPT = DEFAULT_META_RAG_PROMPT;
232+
233+
export const DEFAULT_BEDROCK_ANTHROPIC_TEMPERATURE = DEFAULT_ANTHROPIC_TEMPERATURE;
234+
export const MIN_BEDROCK_ANTHROPIC_TEMPERATURE = MIN_ANTHROPIC_TEMPERATURE;
235+
export const MAX_BEDROCK_ANTHROPIC_TEMPERATURE = MAX_ANTHROPIC_TEMPERATURE;
236+
237+
export const DEFAULT_BEDROCK_AMAZON_TEMPERATURE = 0.5;
238+
export const MIN_BEDROCK_AMAZON_TEMPERATURE = 0;
239+
export const MAX_BEDROCK_AMAZON_TEMPERATURE = 1;
240+
241+
export const DEFAULT_BEDROCK_AI21_TEMPERATURE = 1;
242+
export const MIN_BEDROCK_AI21_TEMPERATURE = 0;
243+
export const MAX_BEDROCK_AI21_TEMPERATURE = 1;
244+
245+
export const DEFAULT_BEDROCK_COHERE_TEMPERATURE = 0.75;
246+
export const MIN_BEDROCK_COHERE_TEMPERATURE = 0;
247+
export const MAX_BEDROCK_COHERE_TEMPERATURE = 1;
248+
249+
export const DEFAULT_BEDROCK_META_TEMPERATURE = 0.5;
250+
export const MIN_BEDROCK_META_TEMPERATURE = 0;
251+
export const MAX_BEDROCK_META_TEMPERATURE = 1;
216252

217253
export const KENDRA_EDITIONS = ['DEVELOPER_EDITION', 'ENTERPRISE_EDITION'];
218254
export const DEFAULT_KENDRA_EDITION = 'DEVELOPER_EDITION';
@@ -247,7 +283,7 @@ export const DEFAULT_KENDRA_STORAGE_CAPACITY_UNITS = 0;
247283
export const MAX_KENDRA_QUERY_CAPACITY_UNITS = 1;
248284
export const MAX_KENDRA_STORAGE_CAPACITY_UNITS = 5;
249285
export const DEFAULT_KENDRA_NUMBER_OF_DOCS = 2;
250-
export const MAX_KENDRA_NUMBER_OF_DOCS = 5;
286+
export const MAX_KENDRA_NUMBER_OF_DOCS = 100;
251287
export const MIN_KENDRA_NUMBER_OF_DOCS = 1;
252288
export const MODEL_PARAM_TYPES = ['string', 'integer', 'float', 'boolean', 'list', 'dictionary'];
253289

@@ -292,26 +328,40 @@ export const additionalDeploymentPlatformConfigValues = {
292328
SupportedModels: SUPPORTED_BEDROCK_CHAT_MODELS,
293329
AllowsStreaming: true,
294330
ModelFamilyParams: {
331+
[BEDROCK_MODEL_FAMILIES.AI21]: {
332+
ChatPromptTemplate: DEFAULT_BEDROCK_AI21_PROMPT,
333+
RAGPromptTemplate: DEFAULT_BEDROCK_AI21_RAG_PROMPT,
334+
DefaultTemperature: DEFAULT_BEDROCK_AI21_TEMPERATURE,
335+
MinTemperature: MIN_BEDROCK_AI21_TEMPERATURE,
336+
MaxTemperature: MAX_BEDROCK_AI21_TEMPERATURE
337+
},
295338
[BEDROCK_MODEL_FAMILIES.AMAZON]: {
296339
ChatPromptTemplate: DEFAULT_BEDROCK_AMAZON_PROMPT,
297340
RAGPromptTemplate: DEFAULT_BEDROCK_AMAZON_RAG_PROMPT,
298-
DefaultTemperature: DEFAULT_ANTHROPIC_TEMPERATURE,
299-
MinTemperature: MIN_ANTHROPIC_TEMPERATURE,
300-
MaxTemperature: MAX_ANTHROPIC_TEMPERATURE
341+
DefaultTemperature: DEFAULT_BEDROCK_AMAZON_TEMPERATURE,
342+
MinTemperature: MIN_BEDROCK_AMAZON_TEMPERATURE,
343+
MaxTemperature: MAX_BEDROCK_AMAZON_TEMPERATURE
301344
},
302345
[BEDROCK_MODEL_FAMILIES.ANTHROPIC]: {
303346
ChatPromptTemplate: DEFAULT_BEDROCK_ANTHROPIC_PROMPT,
304347
RAGPromptTemplate: DEFAULT_BEDROCK_ANTHROPIC_RAG_PROMPT,
305-
DefaultTemperature: DEFAULT_ANTHROPIC_TEMPERATURE,
306-
MinTemperature: MIN_ANTHROPIC_TEMPERATURE,
307-
MaxTemperature: MAX_ANTHROPIC_TEMPERATURE
348+
DefaultTemperature: DEFAULT_BEDROCK_ANTHROPIC_TEMPERATURE,
349+
MinTemperature: MIN_BEDROCK_ANTHROPIC_TEMPERATURE,
350+
MaxTemperature: MAX_BEDROCK_ANTHROPIC_TEMPERATURE
308351
},
309-
[BEDROCK_MODEL_FAMILIES.AI21]: {
310-
ChatPromptTemplate: DEFAULT_BEDROCK_AI21_PROMPT,
311-
RAGPromptTemplate: DEFAULT_BEDROCK_AI21_RAG_PROMPT,
312-
DefaultTemperature: DEFAULT_ANTHROPIC_TEMPERATURE,
313-
MinTemperature: MIN_ANTHROPIC_TEMPERATURE,
314-
MaxTemperature: MAX_ANTHROPIC_TEMPERATURE
352+
[BEDROCK_MODEL_FAMILIES.COHERE]: {
353+
ChatPromptTemplate: DEFAULT_BEDROCK_COHERE_PROMPT,
354+
RAGPromptTemplate: DEFAULT_BEDROCK_COHERE_RAG_PROMPT,
355+
DefaultTemperature: DEFAULT_BEDROCK_COHERE_TEMPERATURE,
356+
MinTemperature: MIN_BEDROCK_COHERE_TEMPERATURE,
357+
MaxTemperature: MAX_BEDROCK_COHERE_TEMPERATURE
358+
},
359+
[BEDROCK_MODEL_FAMILIES.META]: {
360+
ChatPromptTemplate: DEFAULT_BEDROCK_META_PROMPT,
361+
RAGPromptTemplate: DEFAULT_BEDROCK_META_RAG_PROMPT,
362+
DefaultTemperature: DEFAULT_BEDROCK_META_TEMPERATURE,
363+
MinTemperature: MIN_BEDROCK_META_TEMPERATURE,
364+
MaxTemperature: MAX_BEDROCK_META_TEMPERATURE
315365
}
316366
}
317367
}

source/infrastructure/lib/utils/custom-infra-setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,6 @@ export class CustomInfraSetup extends Construct {
165165
reason: 'The wildcard permission is required to publish events for x-ray insights',
166166
appliesTo: ['Resource::*']
167167
}
168-
]);
168+
]);
169169
}
170170
}

source/infrastructure/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/infrastructure/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gen-ai-app-builder-on-aws-infrastructure",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"bin": {
55
"infrastructure": "bin/gen-ai-app-builder.js"
66
},

0 commit comments

Comments
 (0)