Skip to content

Commit

Permalink
Merge branch '0.2' into fix-async-calls-parent-context
Browse files Browse the repository at this point in the history
  • Loading branch information
rysweet authored Dec 12, 2024
2 parents 61b70b9 + 837b2e0 commit 6be1691
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions autogen/oai/anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions autogen/oai/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
6 changes: 3 additions & 3 deletions test/oai/test_anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 6be1691

Please sign in to comment.