From 10053fa412f383eb021ade09c4469d64e5e0e721 Mon Sep 17 00:00:00 2001 From: namanvats Date: Sun, 16 Jun 2024 19:02:59 +0530 Subject: [PATCH] Added Support to fetch aws region from aws config file .aws/config Signed-off-by: namanvats --- src/anthropic/lib/bedrock/_client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/anthropic/lib/bedrock/_client.py b/src/anthropic/lib/bedrock/_client.py index b3f388e5..a14d051a 100644 --- a/src/anthropic/lib/bedrock/_client.py +++ b/src/anthropic/lib/bedrock/_client.py @@ -1,6 +1,7 @@ from __future__ import annotations import os +import boto3 from typing import Any, Union, Mapping, TypeVar from typing_extensions import Self, override @@ -116,6 +117,8 @@ def __init__( self.aws_access_key = aws_access_key + session = boto3.Session() + aws_region = session.region_name if aws_region is None: aws_region = os.environ.get("AWS_REGION") or "us-east-1" self.aws_region = aws_region