Skip to content

Commit 7b5f054

Browse files
author
Bob Strahan
committed
Merge branch 'develop' of ssh.gitlab.aws.dev:genaiic-reusable-assets/engagement-artifacts/genaiic-idp-accelerator into develop
2 parents e0feaea + e217982 commit 7b5f054

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/idp_common_pkg/idp_common/bedrock/client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import random
1818
import socket
1919
from typing import Dict, Any, List, Optional, Union, Tuple
20+
from botocore.config import Config
2021
from botocore.exceptions import ClientError, ReadTimeoutError, ConnectTimeoutError, EndpointConnectionError
2122
from urllib3.exceptions import ReadTimeoutError as Urllib3ReadTimeoutError
2223
try:
@@ -73,8 +74,12 @@ def __init__(
7374
@property
7475
def client(self):
7576
"""Lazy-loaded Bedrock client."""
77+
config = Config(
78+
connect_timeout=10,
79+
read_timeout=120
80+
)
7681
if self._client is None:
77-
self._client = boto3.client('bedrock-runtime', region_name=self.region)
82+
self._client = boto3.client('bedrock-runtime', region_name=self.region, config=config)
7883
return self._client
7984

8085
def __call__(
@@ -445,7 +450,7 @@ def _invoke_with_retry(
445450

446451
return response_with_metering
447452

448-
except ClientError as e:
453+
except Exception as e:
449454
error_code = e.response['Error']['Code']
450455
error_message = e.response['Error']['Message']
451456

@@ -495,12 +500,7 @@ def _invoke_with_retry(
495500
self._put_metric('BedrockRequestsFailed', 1)
496501
self._put_metric('BedrockNonRetryableErrors', 1)
497502
raise
498-
499-
except Exception as e:
500-
logger.error(f"Unexpected error invoking Bedrock: {str(e)}", exc_info=True)
501-
self._put_metric('BedrockRequestsFailed', 1)
502-
self._put_metric('BedrockUnexpectedErrors', 1)
503-
raise
503+
504504

505505
def get_guardrail_config(self) -> Optional[Dict[str, str]]:
506506
"""

patterns/pattern-2/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ Resources:
246246
description: Confidence threshold for this specific attribute (0.0 to 1.0). If not set, the default confidence threshold from assessment section will be used.
247247
minimum: 0
248248
maximum: 1
249-
order: 5
249+
order: 6
250250
# This controls the layout of the form fields inside each attribute item
251251
columns: 2
252252
classification:

scripts/sdlc/idp-cli/src/idp_cli/cli/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def uninstall(
7474
def smoketest(
7575
stack_name: str = typer.Option("idp-Stack", "--stack-name", help="Name of the deployed stack to test"),
7676
file_path: str = typer.Option("../../../samples/lending_package.pdf", "--file-path", help="Path to the test file"),
77-
verify_string: str = typer.Option("475 ANY AVENUE ANYTOWN, USA", "--verify-string", help="String to verify in the processed output")
77+
verify_string: str = typer.Option("BIGTOWN, MA, 02801", "--verify-string", help="String to verify in the processed output")
7878
):
7979
"""
8080
Run a smoke test on the deployed IDP Accelerator

0 commit comments

Comments
 (0)