Skip to content

Commit 263f96f

Browse files
authored
Update to version v3.0.1
### Security - Upgraded urllib3 to `2.5.0` - Upgraded requests to `2.32.4` - Upgraded brace-expansion to `2.0.2` ### Added - Support for Kendra GenAI Index backed Bedrock knowledge bases. ### Changed - Deployment UI to show an error when a regular user attempts to log in. - Custom Resource IAM Role to be scoped down to only necessary DynamoDB Tables. ### Fixed - Bug where CloudFormation deployment would fail using existing Cognito resources due to user/group creation conflict. ([#193](#193)). - Bug where history in prompt for SageMaker models was being replaced by LangChain BaseMessage objects instead of just the content of the messages. - Bug where context in prompt was being replaced by LangChain Document objects instead of the content of the documents. - Bug where Langchain layer poetry lock wasn't being respected.
2 parents a14c57e + c0d4029 commit 263f96f

File tree

95 files changed

+1759
-536
lines changed

Some content is hidden

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

95 files changed

+1759
-536
lines changed

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,30 @@ 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+
## [3.0.1] - 2025-06-26
9+
10+
### Security
11+
12+
- Upgraded urllib3 to `2.5.0`
13+
- Upgraded requests to `2.32.4`
14+
- Upgraded brace-expansion to `2.0.2`
15+
16+
### Added
17+
18+
- Support for Kendra GenAI Index backed Bedrock knowledge bases.
19+
20+
### Changed
21+
22+
- Deployment UI to show an error when a regular user attempts to log in.
23+
- Custom Resource IAM Role to be scoped down to only necessary DynamoDB Tables.
24+
25+
### Fixed
26+
27+
- Bug where CloudFormation deployment would fail using existing Cognito resources due to user/group creation conflict. ([#193](https://github.com/aws-solutions/generative-ai-application-builder-on-aws/issues/193)).
28+
- Bug where history in prompt for SageMaker models was being replaced by LangChain BaseMessage objects instead of just the content of the messages.
29+
- Bug where context in prompt was being replaced by LangChain Document objects instead of the content of the documents.
30+
- Bug where Langchain layer poetry lock wasn't being respected.
31+
832
## [3.0.0] - 2025-05-29
933

1034
### Added

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The [Generative AI Application Builder on AWS](https://aws.amazon.com/solutions/
99

1010
The Generative AI Application Builder is published under an Apache 2.0 license and is targeted for novice to experienced users who want to experiment and productionize different Gen AI use cases. The solution uses [LangChain](https://www.langchain.com/) open-source software (OSS) to configure connections to your choice of Large Language Models (LLMs) for different use cases. The first release of GAAB allows users to deploy chat use cases which allow the ability to query over users' enterprise data in a chatbot-style User Interface (UI), along with an API to support custom end-user implementations.
1111

12-
Some of the features of GAAB are:
12+
Some of the features of GAAB are:
1313

1414
- Rapid experimentation with ability to productionize at scale
1515
- Extendable and modularized architecture using nested [Amazon CloudFormation](https://aws.amazon.com/cloudformation/) stacks

deployment/build-s3-dist.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ set -e
3030
# Check to see if input has been provided:
3131
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ]; then
3232
echo "Please provide all required parameters for the build script"
33-
echo "For example: ./build-s3-dist.sh solutions trademarked-solution-name v3.0.0 template-bucket-name"
33+
echo "For example: ./build-s3-dist.sh solutions trademarked-solution-name v3.0.1 template-bucket-name"
3434
exit 1
3535
fi
3636

source/infrastructure/cdk.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"@custom-bundler/unit-test": false,
6565
"solution_id": "SO0276",
6666
"solution_name": "generative-ai-application-builder-on-aws",
67-
"solution_version": "v3.0.0",
67+
"solution_version": "v3.0.1",
6868
"app_registry_name": "GAAB",
6969
"application_type": "AWS-Solutions",
7070
"application_trademark_name": "Generative AI Application Builder on AWS",

source/infrastructure/lib/auth/cognito-setup.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -411,15 +411,24 @@ export class CognitoSetup extends Construct {
411411
}
412412

413413
protected createUserAndUserGroup(props: UserPoolProps) {
414-
// cognito user is created only if user provides their own email address for notifications
415-
const cognitoUserCondition = new cdk.CfnCondition(this, 'CognitoUserCondition', {
414+
415+
const cognitoGroupCondition = new cdk.CfnCondition(this, 'CognitoGroupCondition', {
416416
expression: cdk.Fn.conditionNot(
417-
cdk.Fn.conditionOr(
418-
cdk.Fn.conditionEquals(props.defaultUserEmail, PLACEHOLDER_EMAIL),
419-
cdk.Fn.conditionEquals(props.defaultUserEmail, '')
420-
)
417+
cdk.Fn.conditionEquals(props.defaultUserEmail, '')
421418
)
422419
});
420+
421+
const cognitoUserCondition = new cdk.CfnCondition(this, 'CognitoUserCondition', {
422+
expression:
423+
cdk.Fn.conditionAnd(
424+
cdk.Fn.conditionNot(
425+
cdk.Fn.conditionEquals(props.defaultUserEmail, PLACEHOLDER_EMAIL)
426+
),
427+
cognitoGroupCondition
428+
)
429+
430+
});
431+
423432
const cognitoUser = new CfnUserPoolUser(this, 'DefaultUser', {
424433
desiredDeliveryMediums: ['EMAIL'],
425434
forceAliasCreation: false,
@@ -440,6 +449,7 @@ export class CognitoSetup extends Construct {
440449
groupName: props.userGroupName,
441450
precedence: 1
442451
});
452+
this.userPoolGroup.cfnOptions.condition = cognitoGroupCondition;
443453

444454
const userPoolUserToGroupAttachment = new cognito.CfnUserPoolUserToGroupAttachment(
445455
this,

source/infrastructure/lib/bedrock-agent-stack.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ export class BedrockAgent extends UseCaseStack {
126126
CONVERSATION_TABLE_NAME: this.chatStorageSetup.chatStorage.conversationTable.tableName
127127
}
128128
});
129+
const updateLLMConfigTablePolicy = new iam.Policy(this, 'UpdateLLMConfigTablePolicy', {
130+
statements: [
131+
new iam.PolicyStatement({
132+
effect: iam.Effect.ALLOW,
133+
actions: ['dynamodb:UpdateItem'],
134+
resources: [
135+
`arn:${cdk.Aws.PARTITION}:dynamodb:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:table/${this.stackParameters.useCaseConfigTableName.valueAsString}`
136+
]
137+
})
138+
]
139+
});
140+
updateLLMConfigTablePolicy.attachToRole(this.applicationSetup.customResourceRole);
129141

130142
const feedbackEnabledCondition = new cdk.CfnCondition(this, 'FeedbackEnabledCondition', {
131143
expression: cdk.Fn.conditionEquals(this.stackParameters.feedbackEnabled, 'Yes')

source/infrastructure/lib/deployment-platform-stack.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { UseCaseManagementSetup } from './use-case-management/setup';
1616
import { generateSourceCodeMapping } from './utils/common-utils';
1717
import {
1818
INTERNAL_EMAIL_DOMAIN,
19-
MANDATORY_EMAIL_REGEX_PATTERN,
19+
OPTIONAL_EMAIL_REGEX_PATTERN,
2020
REST_API_NAME_ENV_VAR,
2121
UIAssetFolders,
2222
USE_CASE_UUID_ENV_VAR,
@@ -73,8 +73,8 @@ export class DeploymentPlatformStack extends BaseStack {
7373

7474
const adminUserEmail = new cdk.CfnParameter(this, 'AdminUserEmail', {
7575
type: 'String',
76-
description: 'Email required to create the default user for the admin platform',
77-
allowedPattern: MANDATORY_EMAIL_REGEX_PATTERN,
76+
description: 'Optional - Email used to create the default cognito user for the admin platform. If empty, the Cognito User, Group and Attachment will not be created.',
77+
allowedPattern: OPTIONAL_EMAIL_REGEX_PATTERN,
7878
constraintDescription: 'Please provide a valid email'
7979
});
8080

@@ -148,15 +148,15 @@ export class DeploymentPlatformStack extends BaseStack {
148148
existingParameterGroups.push({
149149
Label: {
150150
default:
151-
'Optional: If you would like to provide a Cognito UserPool and UserPoolClient, you can pass their IDs here. Otherwise, a new pool and client will be created for you'
151+
'Optional: Provide existing Cognito UserPool and UserPoolClient IDs if you want to use your own managed resources. If left empty, the solution will manage these resources for you. Note: To prevent the creation of Cognito resources within the user pool (Users/Groups), simply leave the AdminUserEmail parameter empty.'
152152
},
153153
Parameters: [existingCognitoUserPoolId.logicalId, existingUserPoolClientId.logicalId]
154154
});
155155

156156
// internal users are identified by being of the form "[email protected]"
157157
const isInternalUserCondition: cdk.CfnCondition = new cdk.CfnCondition(this, 'IsInternalUserCondition', {
158158
expression: cdk.Fn.conditionEquals(
159-
cdk.Fn.select(0, cdk.Fn.split('.', cdk.Fn.select(1, cdk.Fn.split('@', adminUserEmail.valueAsString)))),
159+
cdk.Fn.select(0, cdk.Fn.split('.', cdk.Fn.select(1, cdk.Fn.split('@', cdk.Fn.join("", [adminUserEmail.valueAsString, "@example.com"]))))),
160160
INTERNAL_EMAIL_DOMAIN
161161
)
162162
});

source/infrastructure/lib/framework/bundler/runtime/langchain-layer.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,13 @@ export class LangChainLayerDockerBuild extends PythonLayerDockerBuild {
7373
if (process.env.SKIP_PRE_BUILD?.toLowerCase() === 'true') {
7474
commandList.push('python3 -m pip install poetry --upgrade');
7575
}
76+
commandList.push('python3 -m pip install poetry-plugin-export --upgrade');
77+
commandList.push(`poetry export -f requirements.txt --output ${outputDir}/requirements.txt --without-hashes`);
7678
commandList.push(
77-
`poetry run pip install --python-version ${this.evaluatedPipOptions.pythonVersion} --platform ${this.evaluatedPipOptions.platform} --implementation ${this.evaluatedPipOptions.implementation} --only-binary=${this.evaluatedPipOptions.onlyBinary} -t ${outputDir}/python/ dist/*.whl`
79+
`poetry run pip install -r ${outputDir}/requirements.txt --python-version ${this.evaluatedPipOptions.pythonVersion} --platform ${this.evaluatedPipOptions.platform} --implementation ${this.evaluatedPipOptions.implementation} --only-binary=${this.evaluatedPipOptions.onlyBinary} -t ${outputDir}/python/`
80+
);
81+
commandList.push(
82+
`poetry run pip install --no-deps -t ${outputDir}/python/ dist/*.whl`
7883
);
7984
return commandList;
8085
}
@@ -94,8 +99,10 @@ export class LangChainLayerLocalBuild extends PythonLayerLocalBuild {
9499
protected postBuild(moduleName: string, outputDir: string): string[] {
95100
return [
96101
`cd ${moduleName}`,
97-
`python3 -m pip install poetry --upgrade`,
98-
`poetry run pip install --python-version ${this.evaluatedPipOptions.pythonVersion} --platform ${this.evaluatedPipOptions.platform} --implementation ${this.evaluatedPipOptions.implementation} --only-binary=${this.evaluatedPipOptions.onlyBinary} -t ${outputDir}/python/ dist/*.whl`
102+
`python3 -m pip install poetry poetry-plugin-export --upgrade`,
103+
`poetry export -f requirements.txt --output ${outputDir}/requirements.txt --without-hashes`,
104+
`poetry run pip install -r ${outputDir}/requirements.txt --python-version ${this.evaluatedPipOptions.pythonVersion} --platform ${this.evaluatedPipOptions.platform} --implementation ${this.evaluatedPipOptions.implementation} --only-binary=${this.evaluatedPipOptions.onlyBinary} -t ${outputDir}/python/`,
105+
`poetry run pip install --no-deps -t ${outputDir}/python/ dist/*.whl`
99106
];
100107
}
101108
}

source/infrastructure/lib/framework/bundler/runtime/langchain-py-version.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export class LangchainPythonVersionAssetOptions extends PythonAssetOptions {
3333
entry = path.resolve(entry);
3434
const pipOptions = packagingOptions as PipInstallArguments;
3535
this.dockerBuild = new LangChainPythonVersionDockerBuild(pipOptions);
36+
this.localBuild = new LangChainPythonVersionLocalBuild(pipOptions);
3637

3738
return {
3839
...(assetHash && { assetHash: assetHash, assetHashType: cdk.AssetHashType.CUSTOM }),
@@ -63,9 +64,10 @@ export class LangChainPythonVersionDockerBuild extends PythonDockerBuild {
6364
if (process.env.SKIP_PRE_BUILD?.toLowerCase() === 'true') {
6465
commandList.push('python3 -m pip install poetry --upgrade');
6566
}
66-
commandList.push(
67-
`poetry run pip install --python-version ${this.evaluatedPipOptions.pythonVersion} --platform ${this.evaluatedPipOptions.platform} --implementation ${this.evaluatedPipOptions.implementation} --only-binary=${this.evaluatedPipOptions.onlyBinary} -t ${outputDir}/ dist/*.whl`
68-
);
67+
commandList.push('python3 -m pip install poetry-plugin-export --upgrade');
68+
commandList.push(`poetry export -f requirements.txt --output ${outputDir}/requirements.txt --without-hashes`);
69+
commandList.push(`poetry run pip install -r ${outputDir}/requirements.txt --python-version ${this.evaluatedPipOptions.pythonVersion} --platform ${this.evaluatedPipOptions.platform} --implementation ${this.evaluatedPipOptions.implementation} --only-binary=${this.evaluatedPipOptions.onlyBinary} -t ${outputDir}/`);
70+
commandList.push(`poetry run pip install --no-deps -t ${outputDir}/ dist/*.whl`);
6971
return commandList;
7072
}
7173
}
@@ -81,8 +83,10 @@ export class LangChainPythonVersionLocalBuild extends PythonLocalBuild {
8183
protected postBuild(moduleName: string, outputDir: string): string[] {
8284
return [
8385
`cd ${moduleName}`,
84-
'python3 -m pip install poetry --upgrade',
85-
`poetry run pip install --python-version ${this.evaluatedPipOptions.pythonVersion} --platform ${this.evaluatedPipOptions.platform} --implementation ${this.evaluatedPipOptions.implementation} --only-binary=${this.evaluatedPipOptions.onlyBinary} -t ${outputDir}/ dist/*.whl`
86+
'python3 -m pip install poetry poetry-plugin-export --upgrade',
87+
`poetry export -f requirements.txt --output ${outputDir}/requirements.txt --without-hashes`,
88+
`poetry run pip install -r ${outputDir}/requirements.txt --python-version ${this.evaluatedPipOptions.pythonVersion} --platform ${this.evaluatedPipOptions.platform} --implementation ${this.evaluatedPipOptions.implementation} --only-binary=${this.evaluatedPipOptions.onlyBinary} -t ${outputDir}/`,
89+
`poetry run pip install --no-deps -t ${outputDir}/ dist/*.whl`
8690
];
8791
}
8892
}

source/infrastructure/lib/framework/bundler/runtime/python-layer.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ export class PythonLayerDockerBuild extends PythonDockerBuild {
4545
commandList.push('python3 -m pip install poetry --upgrade');
4646
}
4747

48-
commandList.push(`poetry run pip install -t ${outputDir}/python/ dist/*.whl`);
48+
commandList.push('python3 -m pip install poetry-plugin-export --upgrade')
49+
commandList.push(`poetry export -f requirements.txt --output ${outputDir}/requirements.txt --without-hashes`);
50+
commandList.push(`poetry run pip install -r ${outputDir}/requirements.txt -t ${outputDir}/python/`);
51+
commandList.push(`poetry run pip install --no-deps -t ${outputDir}/python/ dist/*.whl`)
4952
return commandList;
5053
}
5154
}
@@ -61,6 +64,12 @@ export class PythonLayerLocalBuild extends PythonLocalBuild {
6164
}
6265

6366
protected postBuild(moduleName: string, outputDir: string): string[] {
64-
return [`cd ${moduleName}`, `poetry run pip install -t ${outputDir}/python/ dist/*.whl`];
67+
return [
68+
`cd ${moduleName}`,
69+
`python3 -m pip install poetry poetry-plugin-export --upgrade`,
70+
`poetry export -f requirements.txt --output ${outputDir}/requirements.txt --without-hashes`,
71+
`poetry run pip install -r ${outputDir}/requirements.txt -t ${outputDir}/python/`,
72+
`poetry run pip install --no-deps -t ${outputDir}/python/ dist/*.whl`
73+
];
6574
}
6675
}

0 commit comments

Comments
 (0)