Skip to content

Commit

Permalink
Merge pull request #710 from aws-solutions/feature/v5.5.1
Browse files Browse the repository at this point in the history
Update to version v5.5.1
  • Loading branch information
fhoueto-amz committed Apr 1, 2024
2 parents ca09fb8 + d0d1936 commit 7a58747
Show file tree
Hide file tree
Showing 73 changed files with 456 additions and 228 deletions.
9 changes: 0 additions & 9 deletions .nightswatch/deployment/taskcat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ tests:
FulfillmentConcurrency: '0'
EmbeddingsApi: SAGEMAKER
SagemakerInitialInstanceCount: 1
LLMSagemakerInitialInstanceCount: 1
LLMApi: SAGEMAKER
LLMSagemakerInstanceType: ml.g5.12xlarge
regions:
- ap-southeast-2
qnabot-t5:
Expand Down Expand Up @@ -188,9 +185,6 @@ tests:
FulfillmentConcurrency: '0'
EmbeddingsApi: SAGEMAKER
SagemakerInitialInstanceCount: 1
LLMSagemakerInitialInstanceCount: 1
LLMApi: SAGEMAKER
LLMSagemakerInstanceType: ml.g5.12xlarge
regions:
- eu-west-2
qnabot-t10:
Expand All @@ -208,9 +202,6 @@ tests:
FulfillmentConcurrency: '0'
EmbeddingsApi: SAGEMAKER
SagemakerInitialInstanceCount: 1
LLMSagemakerInitialInstanceCount: 1
LLMApi: SAGEMAKER
LLMSagemakerInstanceType: ml.g5.12xlarge
regions:
- ap-northeast-2
##ca-central-1 only supports Lexv2 not Lexv1
4 changes: 4 additions & 0 deletions .nightswatch/functional/helpers/cfn_parameter_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from typing import Optional
import boto3
import re
import os

class ParameterFetcher:
"""
Expand All @@ -34,6 +35,9 @@ def __init__(self, region: str, stack_name: str) -> None:
"""
self.region = region
self.stack_name = stack_name
profile_name = os.environ.get('TEST_ACCOUNT_PROFILE_NAMES')
if profile_name is not None and profile_name != '':
boto3.setup_default_session(profile_name=profile_name)
self.cloudformation_client = boto3.client('cloudformation', region_name=region)

def get_user_pool_id(self) -> Optional[str]:
Expand Down
4 changes: 3 additions & 1 deletion .nightswatch/functional/test_1_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ def test_designer_logout(self, designer_login, dom_operator: DomOperator):

assert title == 'Signin'

def test_client_login(self, client_login):
def test_client_login(self, client_login, dom_operator: DomOperator):
"""
Test login to client
"""
title = client_login
url = dom_operator.get_current_url()
assert title == 'QnABot Client'
assert 'code' in url

2 changes: 1 addition & 1 deletion .nightswatch/functional/test_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
QUESTION_FILEPATH = './question_bank/llm_questions.json'

region = os.environ.get('CURRENT_STACK_REGION')
g5_instance_regions = ['us-east-1', 'us-west-2', 'ap-northeast-2', 'ap-northeast-1', 'ap-southeast-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2']
g5_instance_regions = ['us-east-1', 'us-west-2', 'ap-northeast-1', 'ca-central-1', 'eu-central-1', 'eu-west-1']
unsupported_region_reason = 'Region Not Supported'

@pytest.mark.skipif(region not in g5_instance_regions, reason=unsupported_region_reason)
Expand Down
3 changes: 2 additions & 1 deletion .nightswatch/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pytest
pytest-json
boto3
selenium==4.16
selenium==4.16
pyyaml
4 changes: 4 additions & 0 deletions .nightswatch/scripts/delete_admin_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
######################################################################################################################

import boto3
import os

profile_name = os.environ.get('TEST_ACCOUNT_PROFILE_NAMES')
boto3.setup_default_session(profile_name=profile_name)

cloudformation_client = boto3.client('cloudformation', region_name=region)
cognito_idp_client = boto3.client('cognito-idp', region_name=region)
Expand Down
4 changes: 4 additions & 0 deletions .nightswatch/scripts/delete_kendra_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
######################################################################################################################

import boto3
import os

profile_name = os.environ.get('TEST_ACCOUNT_PROFILE_NAMES')
boto3.setup_default_session(profile_name=profile_name)

kendra_regions = ['us-east-1', 'us-west-2', 'ap-southeast-1', 'ap-southeast-2', 'ca-central-1', 'eu-west-1']

Expand Down
3 changes: 3 additions & 0 deletions .nightswatch/scripts/delete_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
######################################################################################################################

import boto3
import os
import sys

profile_name = os.environ.get('TEST_ACCOUNT_PROFILE_NAMES')
boto3.setup_default_session(profile_name=profile_name)
client = boto3.client('iam')

def delete_role():
Expand Down
6 changes: 5 additions & 1 deletion .nightswatch/scripts/delete_s3_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@

# Deletes S3 buckets created by stack deployment

import boto3
import logging
import os
import time

import boto3
from botocore.exceptions import ClientError

profile_name = os.environ.get('TEST_ACCOUNT_PROFILE_NAMES')
boto3.setup_default_session(profile_name=profile_name)

s3 = boto3.resource("s3")

bucket_name = ["tcat-qnabot"]
Expand Down
2 changes: 0 additions & 2 deletions .nightswatch/scripts/post_undeploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# and limitations under the License. #
######################################################################################################################

set -e -x

python3 ${NIGHTSWATCH_TEST_DIR}/scripts/delete_s3_bucket.py
sleep 20

Expand Down
19 changes: 12 additions & 7 deletions .nightswatch/scripts/run_regression_tests.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,21 @@ cd ${NIGHTSWATCH_TEST_DIR}/functional/

aws configure list

### Issue: Test are taking too long to run sequentially and tests fail when run in parallel when Selenium operating within the same browser instance.
### Action: So running functional test in one random regions
REGIONS=($(${NIGHTSWATCH_TEST_DIR}/scripts/utils/listregions.py yaml-filename=taskcat.yml | tr -d "[],'"))
NUMBER_OF_REGIONS=${#REGIONS[@]}
RANDOM_NUM=$(( $RANDOM % $NUMBER_OF_REGIONS ))
echo "Regression test selected for region: ${REGIONS[RANDOM_NUM]}"
if [ -z "$CURRENT_STACK_REGION" ]; then
### Issue: Test are taking too long to run sequentially and tests fail when run in parallel when Selenium operating within the same browser instance.
### Action: So running functional test in one random regions
chmod +x ${NIGHTSWATCH_TEST_DIR}/scripts/utils/listregions.py
REGIONS=($(${NIGHTSWATCH_TEST_DIR}/scripts/utils/listregions.py yaml-filename=taskcat.yml | tr -d "[],'"))
NUMBER_OF_REGIONS=${#REGIONS[@]}
RANDOM_NUM=$(( $RANDOM % $NUMBER_OF_REGIONS ))
CURRENT_STACK_REGION=${REGIONS[RANDOM_NUM]}
fi

echo "Regression test selected for region: ${CURRENT_STACK_REGION}"

function runRegressionTest {
export STACK_FILE_NAME=$1
regex="(.*)-(${REGIONS[RANDOM_NUM]})-cfnlogs.txt"
regex="(.*)-(${CURRENT_STACK_REGION})-cfnlogs.txt"
if [[ $STACK_FILE_NAME =~ $regex ]];
then
export CURRENT_STACK_NAME=${BASH_REMATCH[1]};
Expand Down
2 changes: 1 addition & 1 deletion .nightswatch/scripts/utils/listregions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
######################################################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
Expand All @@ -10,7 +11,6 @@
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions #
# and limitations under the License. #
######################################################################################################################
#!/usr/bin/env python3

import os
import yaml
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.5.1] - 2024-04-01
### Fixed
- Document chaining was not working when using Lambda functions for chaining. This has been resolved. ([issue #687](https://github.com/aws-solutions/qnabot-on-aws/issues/687))
- ESWarmer lambda was generating a big amount of log data in CloudWatch. This is now fixed. ([issue #692](https://github.com/aws-solutions/qnabot-on-aws/issues/692))

### Updated
- QnaBot Client to now use code grant instead of implicit grant for Cognito Authorization
- Security patch for webpack-dev-middleware
- Template to ensure an embedding instance size of 1 is at least choosen since serverless is no longer available for the embedding model

## [5.5.0] - 2024-01-04
### Added
- Added Core-Language parameter to the QnABot deployment. This parameter allows the user to select during the deployment a core language which will be used by the OpenSearch language analyzers to look for question and answers. With this update, QnABot can now be deployed natively in 33 Languages with a more syntactical accuracy for matching questions and answers
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ If you'd like to see to start and end time for each test:
export TIMESTAMPS='true'
```
If you want to use a specific AWS profile for the test. If not set, the regression test will use the current AWS session that it's running in.

```bash
export TEST_ACCOUNT_PROFILE_NAMES=<AWS profile name>
```

5. The LLM and Kendra tests will only run if the deployed bot has these features enabled. Follow the steps in the Implementation Guide to enable these features to test them:
- LLM
- Set LLMApi to SAGEMAKER. For more information, please [Enabling LLM support](https://docs.aws.amazon.com/solutions/latest/qnabot-on-aws/enabling-llm-support.html). If stack update fails, check your quota for __ml.g5.12xlarge for endpoint__ usage as mentioned in the note of this article.
Expand Down Expand Up @@ -299,6 +305,7 @@ As QnABot evolves over the years, it makes use of various services and functiona
_Note: **Deployable solution versions** refers to the ability to deploy the version of QnABot in their AWS accounts. **Actively supported versions** for QnABot is only available for the latest version of QnABot._
### Deployable Versions
- [v5.5.1](https://github.com/aws-solutions/qnabot-on-aws/releases/tag/v5.5.1) - [Public](https://solutions-reference.s3.amazonaws.com/qnabot-on-aws/v5.5.1/qnabot-on-aws-main.template)/[VPC](https://solutions-reference.s3.amazonaws.com/qnabot-on-aws/v5.5.1/qnabot-on-aws-vpc.template)
- [v5.5.0](https://github.com/aws-solutions/qnabot-on-aws/releases/tag/v5.5.0) - [Public](https://solutions-reference.s3.amazonaws.com/qnabot-on-aws/v5.5.0/qnabot-on-aws-main.template)/[VPC](https://solutions-reference.s3.amazonaws.com/qnabot-on-aws/v5.5.0/qnabot-on-aws-vpc.template)
- _Vue has been upgraded from Vue 2 to 3. We highly recommend to use or upgrade to this version due to Vue 2 reaching End of Life (EOL), which affects all previous versions of QnABot. For more information, see [below](#upcomingrecent-deprecations)._
- [v5.4.5](https://github.com/aws-solutions/qnabot-on-aws/releases/tag/v5.4.5) - [Public](https://solutions-reference.s3.amazonaws.com/qnabot-on-aws/v5.4.5/qnabot-on-aws-main.template)/[VPC](https://solutions-reference.s3.amazonaws.com/qnabot-on-aws/v5.4.5/qnabot-on-aws-vpc.template)
Expand Down
2 changes: 0 additions & 2 deletions docs/semantic_matching_using_LLM_embeddings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ With this release, QnaBot can now use
QnABot provisions a Sagemaker endpoint running the Hugging Face el5-large model - see https://huggingface.co/intfloat/e5-large.

By default a 1-node ml.m5.xlarge endpoint is automatically provisioned. For large volume deployments, add additional nodes by setting the parameter `SagemakerInitialInstanceCount`. Please check [SageMaker pricing documentation](https://aws.amazon.com/sagemaker/pricing/) for relevant costs and information on Free Tier eligibility.

By setting the parameter `SagemakerInitialInstanceCount` to `0`, a [Serverless Sagemaker endpoint](https://docs.aws.amazon.com/sagemaker/latest/dg/serverless-endpoints.html) is enabled. A serverless endpoint can save you money by scaling down to zero when not in use, however, there is a 'cold start' time of approximately 2 minutes during which QnABot requests, imports, or add/modify items operations will time out or be delayed. QnABot creates the endpoint with default 4GB model memory, and max concurrency of 50 requests.


### Deploy Stack for SageMaker Embeddings
Expand Down
4 changes: 2 additions & 2 deletions lambda/aws-sdk-layer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lambda/aws-sdk-layer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aws-layer",
"version": "5.5.0",
"version": "5.5.1",
"description": "QnABot Lambda aws-sdk-layer",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions lambda/cfn-lambda-layer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lambda/cfn-lambda-layer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cfn-lambda-layer",
"version": "5.5.0",
"version": "5.5.1",
"description": "QnABot Cfn Lambda Layer",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion lambda/cfn/lib/CognitoLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = class CognitoLogin extends require('./base') {
ExplicitAuthFlows: ['ADMIN_NO_SRP_AUTH'],
RefreshTokenValidity: 1,
SupportedIdentityProviders: ['COGNITO'],
AllowedOAuthFlows: ['code', 'implicit'],
AllowedOAuthFlows: ['code'],
AllowedOAuthScopes: ['phone', 'email', 'openid', 'profile'],
AllowedOAuthFlowsUserPoolClient: true,
}
Expand Down
2 changes: 1 addition & 1 deletion lambda/cfn/lib/CognitoUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = class CognitoUrl extends require('./base') {
reply(null, params.Domain, {
Domain,
loginUrl,
logoutUrl: `${Domain}/logout?redirect_uri=${encodeURIComponent(loginUrl)}&response_type=token&client_id=${params.ClientId}`,
logoutUrl: `${Domain}/logout?redirect_uri=${encodeURIComponent(loginUrl)}&response_type=${params.response_type}&client_id=${params.ClientId}`,
});
}
};
4 changes: 2 additions & 2 deletions lambda/cfn/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lambda/cfn/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cfn",
"version": "5.5.0",
"version": "5.5.1",
"description": "QnABot Cfn Lambda",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions lambda/common-modules-layer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lambda/common-modules-layer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "common-modules-layer",
"version": "5.5.0",
"version": "5.5.1",
"description": "QnABot Common-modules-layer lambda",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions lambda/connect/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lambda/connect/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "connect",
"version": "5.5.0",
"version": "5.5.1",
"description": "Lambda function used to support the Connect setup wizard",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ async function invokeLambda(lambdaRef, req, res) {
// response is not JSON - noop
}
qnabot.log('Lambda returned payload: ', payload);
return [req, res];
return [req, res, payload];
}
exports.invokeLambda = invokeLambda;
Loading

0 comments on commit 7a58747

Please sign in to comment.