Skip to content

Commit afba905

Browse files
committed
Merge branch 'develop' v0.7.9
2 parents 8da4c92 + e04b15b commit afba905

24 files changed

+1479
-161
lines changed

CHANGELOG.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [0.7.9] - 2024-05-24
910
### Added
11+
- Support for Anthropic Claude Haiku and Sonnet models to perform call summarization and queries.
12+
- Upgraded Python runtime to 3.11 and NodeJS to version 18.x
13+
1014
## [0.7.8] - 2024-03-29
15+
### Fixed
1116
- Fix an issue with job status indicator (step function workflow) inserting duplicate entries into DynamoDB.
1217
- Fix regression in the mediasearch finder to re-enable hyperlink to PCA call detail page
1318

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

184-
[Unreleased]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/compare/v0.7.8...develop
185-
[0.7.8]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.6
186-
[0.7.7]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.6
189+
[Unreleased]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/compare/main...develop
190+
[0.7.9]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.9
191+
[0.7.8]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.8
192+
[0.7.7]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.7
187193
[0.7.6]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.6
188194
[0.7.5]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.5
189195
[0.7.4]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.4

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.7.7
1+
0.7.9

patches/mediasearch/msfinder.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ Resources:
331331
Type: AWS::Lambda::Function
332332
Properties:
333333
Handler: lambda_function.lambda_handler
334-
Runtime: python3.8
334+
Runtime: python3.11
335335
Role: !GetAtt 'MediaLambdaRole.Arn'
336336
Timeout: 300
337337
Code: ../lambda/build-trigger
@@ -387,7 +387,7 @@ Resources:
387387
Condition: EnableAccess
388388
Properties:
389389
Handler: lambda_function.lambda_handler
390-
Runtime: python3.8
390+
Runtime: python3.11
391391
Role: !GetAtt 'TokenEnablerLambdaRole.Arn'
392392
Timeout: 900
393393
MemorySize: 1024

pca-boto3-bedrock/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Description: >
66
Parameters:
77
Boto3Version:
88
Type: String
9-
Default: "1.34.40"
9+
Default: "1.34.101"
1010

1111
Resources:
1212

pca-main-nokendra.template

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AWSTemplateFormatVersion: "2010-09-09"
22

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

55
Parameters:
66

@@ -363,8 +363,10 @@ Parameters:
363363

364364
GenAIQueryBedrockModelId:
365365
Type: String
366-
Default: anthropic.claude-v2
366+
Default: anthropic.claude-3-haiku-20240307-v1:0
367367
AllowedValues:
368+
- anthropic.claude-3-haiku-20240307-v1:0
369+
- anthropic.claude-3-sonnet-20240229-v1:0
368370
- amazon.titan-text-express-v1
369371
- anthropic.claude-v1
370372
- anthropic.claude-instant-v1
@@ -394,8 +396,10 @@ Parameters:
394396

395397
SummarizationBedrockModelId:
396398
Type: String
397-
Default: anthropic.claude-instant-v1
399+
Default: anthropic.claude-3-haiku-20240307-v1:0
398400
AllowedValues:
401+
- anthropic.claude-3-haiku-20240307-v1:0
402+
- anthropic.claude-3-sonnet-20240229-v1:0
399403
- amazon.titan-text-express-v1
400404
- anthropic.claude-v1
401405
- anthropic.claude-instant-v1
@@ -685,10 +689,18 @@ Resources:
685689
provider = modelId.split(".")[0]
686690
request_body = None
687691
if provider == "anthropic":
688-
request_body = {
689-
"prompt": prompt,
690-
"max_tokens_to_sample": DEFAULT_MAX_TOKENS
691-
}
692+
if 'claude-3' in modelId:
693+
request_body = {
694+
"max_tokens": DEFAULT_MAX_TOKENS,
695+
"messages": [{"role": "user", "content": prompt}],
696+
"anthropic_version": "bedrock-2023-05-31"
697+
}
698+
else:
699+
request_body = {
700+
"prompt": prompt,
701+
"max_tokens_to_sample": DEFAULT_MAX_TOKENS
702+
}
703+
692704
request_body.update(parameters)
693705
elif provider == "ai21":
694706
request_body = {
@@ -713,8 +725,13 @@ Resources:
713725
provider = modelId.split(".")[0]
714726
generated_text = None
715727
if provider == "anthropic":
716-
response_body = json.loads(response.get("body").read().decode())
717-
generated_text = response_body.get("completion")
728+
if 'claude-3' in modelId:
729+
response_raw = json.loads(response.get("body").read().decode())
730+
generated_text = response_raw.get('content')[0].get('text')
731+
732+
else:
733+
response_body = json.loads(response.get("body").read().decode())
734+
generated_text = response_body.get("completion")
718735
elif provider == "ai21":
719736
response_body = json.loads(response.get("body").read())
720737
generated_text = response_body.get("completions")[0].get("data").get("text")

pca-main.template

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AWSTemplateFormatVersion: "2010-09-09"
22

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

55
Parameters:
66

@@ -365,8 +365,10 @@ Parameters:
365365

366366
GenAIQueryBedrockModelId:
367367
Type: String
368-
Default: anthropic.claude-v2
368+
Default: anthropic.claude-3-haiku-20240307-v1:0
369369
AllowedValues:
370+
- anthropic.claude-3-haiku-20240307-v1:0
371+
- anthropic.claude-3-sonnet-20240229-v1:0
370372
- amazon.titan-text-express-v1
371373
- anthropic.claude-v1
372374
- anthropic.claude-instant-v1
@@ -396,8 +398,10 @@ Parameters:
396398

397399
SummarizationBedrockModelId:
398400
Type: String
399-
Default: anthropic.claude-instant-v1
401+
Default: anthropic.claude-3-haiku-20240307-v1:0
400402
AllowedValues:
403+
- anthropic.claude-3-haiku-20240307-v1:0
404+
- anthropic.claude-3-sonnet-20240229-v1:0
401405
- amazon.titan-text-express-v1
402406
- anthropic.claude-v1
403407
- anthropic.claude-instant-v1
@@ -816,10 +820,18 @@ Resources:
816820
provider = modelId.split(".")[0]
817821
request_body = None
818822
if provider == "anthropic":
819-
request_body = {
820-
"prompt": prompt,
821-
"max_tokens_to_sample": DEFAULT_MAX_TOKENS
822-
}
823+
if 'claude-3' in modelId:
824+
request_body = {
825+
"max_tokens": DEFAULT_MAX_TOKENS,
826+
"messages": [{"role": "user", "content": prompt}],
827+
"anthropic_version": "bedrock-2023-05-31"
828+
}
829+
else:
830+
request_body = {
831+
"prompt": prompt,
832+
"max_tokens_to_sample": DEFAULT_MAX_TOKENS
833+
}
834+
823835
request_body.update(parameters)
824836
elif provider == "ai21":
825837
request_body = {
@@ -844,8 +856,13 @@ Resources:
844856
provider = modelId.split(".")[0]
845857
generated_text = None
846858
if provider == "anthropic":
847-
response_body = json.loads(response.get("body").read().decode())
848-
generated_text = response_body.get("completion")
859+
if 'claude-3' in modelId:
860+
response_raw = json.loads(response.get("body").read().decode())
861+
generated_text = response_raw.get('content')[0].get('text')
862+
863+
else:
864+
response_body = json.loads(response.get("body").read().decode())
865+
generated_text = response_body.get("completion")
849866
elif provider == "ai21":
850867
response_body = json.loads(response.get("body").read())
851868
generated_text = response_body.get("completions")[0].get("data").get("text")

pca-server/cfn/lib/trigger.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Resources:
116116
Properties:
117117
Code: ../../src/trigger
118118
Handler: index.handler
119-
Runtime: nodejs16.x
119+
Runtime: nodejs18.x
120120
Role: !GetAtt ConfigureBucketRole.Arn
121121
Environment:
122122
Variables:

pca-server/cfn/pca-server.template

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ Parameters:
3131

3232
SummarizationBedrockModelId:
3333
Type: String
34-
Default: anthropic.claude-instant-v1
34+
Default: anthropic.claude-3-haiku-20240307-v1:0
3535
AllowedValues:
36+
- anthropic.claude-3-haiku-20240307-v1:0
37+
- anthropic.claude-3-sonnet-20240229-v1:0
3638
- amazon.titan-text-express-v1
3739
- anthropic.claude-v1
3840
- anthropic.claude-instant-v1

pca-server/src/pca/pca-aws-sf-summarize.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,17 @@ def get_bedrock_request_body(modelId, parameters, prompt):
6363
provider = modelId.split(".")[0]
6464
request_body = None
6565
if provider == "anthropic":
66-
request_body = {
67-
"prompt": prompt,
68-
"max_tokens_to_sample": MAX_TOKENS
69-
}
66+
if 'claude-3' in modelId:
67+
request_body = {
68+
"max_tokens": MAX_TOKENS,
69+
"messages": [{"role": "user", "content": prompt}],
70+
"anthropic_version": "bedrock-2023-05-31"
71+
}
72+
else:
73+
request_body = {
74+
"prompt": prompt,
75+
"max_tokens_to_sample": MAX_TOKENS
76+
}
7077
request_body.update(parameters)
7178
elif provider == "ai21":
7279
request_body = {
@@ -92,8 +99,13 @@ def get_bedrock_generate_text(modelId, response):
9299
provider = modelId.split(".")[0]
93100
generated_text = None
94101
if provider == "anthropic":
95-
response_body = json.loads(response.get("body").read().decode())
96-
generated_text = response_body.get("completion")
102+
if 'claude-3' in modelId:
103+
response_raw = json.loads(response.get("body").read().decode())
104+
generated_text = response_raw.get('content')[0].get('text')
105+
106+
else:
107+
response_body = json.loads(response.get("body").read().decode())
108+
generated_text = response_body.get("completion")
97109
elif provider == "ai21":
98110
response_body = json.loads(response.get("body").read())
99111
generated_text = response_body.get("completions")[0].get("data").get("text")

pca-server/src/pca/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
boto3==1.15.7
1+
boto3==1.34.101

pca-server/src/trigger/package-lock.json

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

pca-server/src/trigger/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "",
55
"main": "index.js",
66
"dependencies": {
7-
"aws-sdk": "^2.757.0",
7+
"aws-sdk": "^2.1620.0",
88
"cfn-response": "^1.0.1"
99
},
1010
"devDependencies": {},

0 commit comments

Comments
 (0)