Skip to content

Commit

Permalink
Merge branch 'develop' v0.7.9
Browse files Browse the repository at this point in the history
  • Loading branch information
kishd committed May 24, 2024
2 parents 8da4c92 + e04b15b commit afba905
Show file tree
Hide file tree
Showing 24 changed files with 1,479 additions and 161 deletions.
12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.7.9] - 2024-05-24
### Added
- Support for Anthropic Claude Haiku and Sonnet models to perform call summarization and queries.
- Upgraded Python runtime to 3.11 and NodeJS to version 18.x

## [0.7.8] - 2024-03-29
### Fixed
- Fix an issue with job status indicator (step function workflow) inserting duplicate entries into DynamoDB.
- Fix regression in the mediasearch finder to re-enable hyperlink to PCA call detail page

Expand Down Expand Up @@ -181,9 +186,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Initial release

[Unreleased]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/compare/v0.7.8...develop
[0.7.8]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.6
[0.7.7]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.6
[Unreleased]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/compare/main...develop
[0.7.9]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.9
[0.7.8]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.8
[0.7.7]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.7
[0.7.6]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.6
[0.7.5]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.5
[0.7.4]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.4
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.7
0.7.9
4 changes: 2 additions & 2 deletions patches/mediasearch/msfinder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ Resources:
Type: AWS::Lambda::Function
Properties:
Handler: lambda_function.lambda_handler
Runtime: python3.8
Runtime: python3.11
Role: !GetAtt 'MediaLambdaRole.Arn'
Timeout: 300
Code: ../lambda/build-trigger
Expand Down Expand Up @@ -387,7 +387,7 @@ Resources:
Condition: EnableAccess
Properties:
Handler: lambda_function.lambda_handler
Runtime: python3.8
Runtime: python3.11
Role: !GetAtt 'TokenEnablerLambdaRole.Arn'
Timeout: 900
MemorySize: 1024
Expand Down
2 changes: 1 addition & 1 deletion pca-boto3-bedrock/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Description: >
Parameters:
Boto3Version:
Type: String
Default: "1.34.40"
Default: "1.34.101"

Resources:

Expand Down
35 changes: 26 additions & 9 deletions pca-main-nokendra.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AWSTemplateFormatVersion: "2010-09-09"

Description: Amazon Transcribe Post Call Analytics - PCA (v0.7.8) (uksb-1sn29lk73)
Description: Amazon Transcribe Post Call Analytics - PCA (v0.7.9) (uksb-1sn29lk73)

Parameters:

Expand Down Expand Up @@ -363,8 +363,10 @@ Parameters:

GenAIQueryBedrockModelId:
Type: String
Default: anthropic.claude-v2
Default: anthropic.claude-3-haiku-20240307-v1:0
AllowedValues:
- anthropic.claude-3-haiku-20240307-v1:0
- anthropic.claude-3-sonnet-20240229-v1:0
- amazon.titan-text-express-v1
- anthropic.claude-v1
- anthropic.claude-instant-v1
Expand Down Expand Up @@ -394,8 +396,10 @@ Parameters:

SummarizationBedrockModelId:
Type: String
Default: anthropic.claude-instant-v1
Default: anthropic.claude-3-haiku-20240307-v1:0
AllowedValues:
- anthropic.claude-3-haiku-20240307-v1:0
- anthropic.claude-3-sonnet-20240229-v1:0
- amazon.titan-text-express-v1
- anthropic.claude-v1
- anthropic.claude-instant-v1
Expand Down Expand Up @@ -685,10 +689,18 @@ Resources:
provider = modelId.split(".")[0]
request_body = None
if provider == "anthropic":
request_body = {
"prompt": prompt,
"max_tokens_to_sample": DEFAULT_MAX_TOKENS
}
if 'claude-3' in modelId:
request_body = {
"max_tokens": DEFAULT_MAX_TOKENS,
"messages": [{"role": "user", "content": prompt}],
"anthropic_version": "bedrock-2023-05-31"
}
else:
request_body = {
"prompt": prompt,
"max_tokens_to_sample": DEFAULT_MAX_TOKENS
}

request_body.update(parameters)
elif provider == "ai21":
request_body = {
Expand All @@ -713,8 +725,13 @@ Resources:
provider = modelId.split(".")[0]
generated_text = None
if provider == "anthropic":
response_body = json.loads(response.get("body").read().decode())
generated_text = response_body.get("completion")
if 'claude-3' in modelId:
response_raw = json.loads(response.get("body").read().decode())
generated_text = response_raw.get('content')[0].get('text')

else:
response_body = json.loads(response.get("body").read().decode())
generated_text = response_body.get("completion")
elif provider == "ai21":
response_body = json.loads(response.get("body").read())
generated_text = response_body.get("completions")[0].get("data").get("text")
Expand Down
35 changes: 26 additions & 9 deletions pca-main.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AWSTemplateFormatVersion: "2010-09-09"

Description: Amazon Transcribe Post Call Analytics - PCA (v0.7.8) (uksb-1sn29lk73)
Description: Amazon Transcribe Post Call Analytics - PCA (v0.7.9) (uksb-1sn29lk73)

Parameters:

Expand Down Expand Up @@ -365,8 +365,10 @@ Parameters:

GenAIQueryBedrockModelId:
Type: String
Default: anthropic.claude-v2
Default: anthropic.claude-3-haiku-20240307-v1:0
AllowedValues:
- anthropic.claude-3-haiku-20240307-v1:0
- anthropic.claude-3-sonnet-20240229-v1:0
- amazon.titan-text-express-v1
- anthropic.claude-v1
- anthropic.claude-instant-v1
Expand Down Expand Up @@ -396,8 +398,10 @@ Parameters:

SummarizationBedrockModelId:
Type: String
Default: anthropic.claude-instant-v1
Default: anthropic.claude-3-haiku-20240307-v1:0
AllowedValues:
- anthropic.claude-3-haiku-20240307-v1:0
- anthropic.claude-3-sonnet-20240229-v1:0
- amazon.titan-text-express-v1
- anthropic.claude-v1
- anthropic.claude-instant-v1
Expand Down Expand Up @@ -816,10 +820,18 @@ Resources:
provider = modelId.split(".")[0]
request_body = None
if provider == "anthropic":
request_body = {
"prompt": prompt,
"max_tokens_to_sample": DEFAULT_MAX_TOKENS
}
if 'claude-3' in modelId:
request_body = {
"max_tokens": DEFAULT_MAX_TOKENS,
"messages": [{"role": "user", "content": prompt}],
"anthropic_version": "bedrock-2023-05-31"
}
else:
request_body = {
"prompt": prompt,
"max_tokens_to_sample": DEFAULT_MAX_TOKENS
}

request_body.update(parameters)
elif provider == "ai21":
request_body = {
Expand All @@ -844,8 +856,13 @@ Resources:
provider = modelId.split(".")[0]
generated_text = None
if provider == "anthropic":
response_body = json.loads(response.get("body").read().decode())
generated_text = response_body.get("completion")
if 'claude-3' in modelId:
response_raw = json.loads(response.get("body").read().decode())
generated_text = response_raw.get('content')[0].get('text')

else:
response_body = json.loads(response.get("body").read().decode())
generated_text = response_body.get("completion")
elif provider == "ai21":
response_body = json.loads(response.get("body").read())
generated_text = response_body.get("completions")[0].get("data").get("text")
Expand Down
2 changes: 1 addition & 1 deletion pca-server/cfn/lib/trigger.template
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Resources:
Properties:
Code: ../../src/trigger
Handler: index.handler
Runtime: nodejs16.x
Runtime: nodejs18.x
Role: !GetAtt ConfigureBucketRole.Arn
Environment:
Variables:
Expand Down
4 changes: 3 additions & 1 deletion pca-server/cfn/pca-server.template
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ Parameters:

SummarizationBedrockModelId:
Type: String
Default: anthropic.claude-instant-v1
Default: anthropic.claude-3-haiku-20240307-v1:0
AllowedValues:
- anthropic.claude-3-haiku-20240307-v1:0
- anthropic.claude-3-sonnet-20240229-v1:0
- amazon.titan-text-express-v1
- anthropic.claude-v1
- anthropic.claude-instant-v1
Expand Down
24 changes: 18 additions & 6 deletions pca-server/src/pca/pca-aws-sf-summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,17 @@ def get_bedrock_request_body(modelId, parameters, prompt):
provider = modelId.split(".")[0]
request_body = None
if provider == "anthropic":
request_body = {
"prompt": prompt,
"max_tokens_to_sample": MAX_TOKENS
}
if 'claude-3' in modelId:
request_body = {
"max_tokens": MAX_TOKENS,
"messages": [{"role": "user", "content": prompt}],
"anthropic_version": "bedrock-2023-05-31"
}
else:
request_body = {
"prompt": prompt,
"max_tokens_to_sample": MAX_TOKENS
}
request_body.update(parameters)
elif provider == "ai21":
request_body = {
Expand All @@ -92,8 +99,13 @@ def get_bedrock_generate_text(modelId, response):
provider = modelId.split(".")[0]
generated_text = None
if provider == "anthropic":
response_body = json.loads(response.get("body").read().decode())
generated_text = response_body.get("completion")
if 'claude-3' in modelId:
response_raw = json.loads(response.get("body").read().decode())
generated_text = response_raw.get('content')[0].get('text')

else:
response_body = json.loads(response.get("body").read().decode())
generated_text = response_body.get("completion")
elif provider == "ai21":
response_body = json.loads(response.get("body").read())
generated_text = response_body.get("completions")[0].get("data").get("text")
Expand Down
2 changes: 1 addition & 1 deletion pca-server/src/pca/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
boto3==1.15.7
boto3==1.34.101
31 changes: 16 additions & 15 deletions pca-server/src/trigger/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 pca-server/src/trigger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"main": "index.js",
"dependencies": {
"aws-sdk": "^2.757.0",
"aws-sdk": "^2.1620.0",
"cfn-response": "^1.0.1"
},
"devDependencies": {},
Expand Down
Loading

0 comments on commit afba905

Please sign in to comment.