diff --git a/autogen/oai/anthropic.py b/autogen/oai/anthropic.py index 7bb4608bd258..16a8c5d01bc0 100644 --- a/autogen/oai/anthropic.py +++ b/autogen/oai/anthropic.py @@ -94,13 +94,13 @@ def __init__(self, **kwargs: Any): self._api_key = os.getenv("ANTHROPIC_API_KEY") if not self._aws_access_key: - self._aws_access_key = os.getenv("AWS_ACCESS_KEY") + self._aws_access_key = os.getenv("AWS_ACCESS_KEY_ID") if not self._aws_secret_key: - self._aws_secret_key = os.getenv("AWS_SECRET_KEY") + self._aws_secret_key = os.getenv("AWS_SECRET_ACCESS_KEY") if not self._aws_region: - self._aws_region = os.getenv("AWS_REGION") + self._aws_region = os.getenv("AWS_DEFAULT_REGION") if self._api_key is None and ( self._aws_access_key is None or self._aws_secret_key is None or self._aws_region is None diff --git a/autogen/oai/bedrock.py b/autogen/oai/bedrock.py index 7894781e3ee5..a07073eef299 100644 --- a/autogen/oai/bedrock.py +++ b/autogen/oai/bedrock.py @@ -58,16 +58,16 @@ def __init__(self, **kwargs: Any): self._aws_profile_name = kwargs.get("aws_profile_name", None) if not self._aws_access_key: - self._aws_access_key = os.getenv("AWS_ACCESS_KEY") + self._aws_access_key = os.getenv("AWS_ACCESS_KEY_ID") if not self._aws_secret_key: - self._aws_secret_key = os.getenv("AWS_SECRET_KEY") + self._aws_secret_key = os.getenv("AWS_SECRET_ACCESS_KEY") if not self._aws_session_token: self._aws_session_token = os.getenv("AWS_SESSION_TOKEN") if not self._aws_region: - self._aws_region = os.getenv("AWS_REGION") + self._aws_region = os.getenv("AWS_DEFAULT_REGION") if self._aws_region is None: raise ValueError("Region is required to use the Amazon Bedrock API.") diff --git a/test/oai/test_anthropic.py b/test/oai/test_anthropic.py index 53926dbd18d6..8c275e33cb4e 100644 --- a/test/oai/test_anthropic.py +++ b/test/oai/test_anthropic.py @@ -50,10 +50,10 @@ def anthropic_client(): @pytest.mark.skipif(skip, reason=reason) def test_initialization_missing_api_key(): os.environ.pop("ANTHROPIC_API_KEY", None) - os.environ.pop("AWS_ACCESS_KEY", None) - os.environ.pop("AWS_SECRET_KEY", None) + os.environ.pop("AWS_ACCESS_KEY_ID", None) + os.environ.pop("AWS_SECRET_ACCESS_KEY", None) os.environ.pop("AWS_SESSION_TOKEN", None) - os.environ.pop("AWS_REGION", None) + os.environ.pop("AWS_DEFAULT_REGION", None) with pytest.raises(ValueError, match="API key or AWS credentials are required to use the Anthropic API."): AnthropicClient()