Bugfix: Pick AWS region from the environment variable correctly (#3384)

This commit is contained in:
Srishti Gureja
2025-08-30 01:43:02 +05:30
committed by GitHub
parent 3d0ece1bcf
commit 0b2aa36e98
3 changed files with 12 additions and 9 deletions
+3 -3
View File
@@ -28,15 +28,15 @@ class AWSBedrockEmbedding(EmbeddingBase):
aws_access_key = os.environ.get("AWS_ACCESS_KEY_ID", "")
aws_secret_key = os.environ.get("AWS_SECRET_ACCESS_KEY", "")
aws_session_token = os.environ.get("AWS_SESSION_TOKEN", "")
aws_region = os.environ.get("AWS_REGION", "us-west-2")
# Check if AWS config is provided in the config
if hasattr(self.config, "aws_access_key_id"):
aws_access_key = self.config.aws_access_key_id
if hasattr(self.config, "aws_secret_access_key"):
aws_secret_key = self.config.aws_secret_access_key
if hasattr(self.config, "aws_region"):
aws_region = self.config.aws_region
# AWS region is always set in config - see BaseEmbedderConfig
aws_region = self.config.aws_region or "us-west-2"
self.client = boto3.client(
"bedrock-runtime",