Skip to content

Commit ff70559

Browse files
authored
Merge pull request #1 from Constantinople-AI/GGGG-29-aws-retry
GGGG-29 Configurable AWS retries via environment variable
2 parents d77567e + d133e2f commit ff70559

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/api/models/bedrock.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,15 @@
3838
Usage,
3939
UserMessage,
4040
)
41-
from api.setting import AWS_REGION, CUSTOM_MODEL_LIST, DEBUG, DEFAULT_MODEL, ENABLE_CROSS_REGION_INFERENCE
41+
from api.setting import AWS_REGION, CUSTOM_MODEL_LIST, DEBUG, DEFAULT_MODEL, ENABLE_CROSS_REGION_INFERENCE, MAX_RETRIES_AWS
4242

4343
logger = logging.getLogger(__name__)
4444

45-
config = Config(connect_timeout=60, read_timeout=120, retries={"max_attempts": 1})
45+
config = Config(
46+
connect_timeout=60,
47+
read_timeout=120,
48+
retries={"mode": "standard", "max_attempts": MAX_RETRIES_AWS}
49+
)
4650

4751
bedrock_runtime = boto3.client(
4852
service_name="bedrock-runtime",

src/api/setting.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@
1818
CUSTOM_MODEL_CSV = os.environ.get("CUSTOM_MODEL_LIST", "")
1919
CUSTOM_MODEL_LIST = [m.strip() for m in CUSTOM_MODEL_CSV.split(",") if m.strip()]
2020
ENABLE_CROSS_REGION_INFERENCE = os.environ.get("ENABLE_CROSS_REGION_INFERENCE", "true").lower() != "false"
21+
MAX_RETRIES_AWS = int(os.environ.get("MAX_RETRIES_AWS", "3"))

0 commit comments

Comments
 (0)