Skip to content

Allow AnthropicBedrockChatCompletionClient use in an AWS environment #6560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
GeorgeEfstathiadis opened this issue May 19, 2025 · 0 comments · Fixed by #6561
Closed

Allow AnthropicBedrockChatCompletionClient use in an AWS environment #6560

GeorgeEfstathiadis opened this issue May 19, 2025 · 0 comments · Fixed by #6561

Comments

@GeorgeEfstathiadis
Copy link
Contributor

What happened?

Describe the bug
If using AnthropicBedrockChatCompletionClient from an AWS sagemaker notebook or having logged into AWS with SSO, then AWS credentials are set implicitly from environment variables. Current implementation requires them to be explicitly set which shouldn't be required in the mentioned scenarios.

To Reproduce

from autogen_ext.models.anthropic import AnthropicBedrockChatCompletionClient

aws_config = {
    "model": 'us.anthropic.claude-3-5-sonnet-20241022-v2:0',
    "temperature": 0.5,
    "model_info": {
        "vision": False,
        "function_calling": True,
        "json_output": True,
        "structured_output": True,
        "family": 'claude-3-5-sonnet',
    },
    "bedrock_info": {
        "aws_region": 'us-east-1',
    },
}

model_client=AnthropicBedrockChatCompletionClient(**aws_config)

---

File "/workspaces/autogen/python/packages/autogen-ext/src/autogen_ext/models/anthropic/_anthropic_client.py", line 1198, in __init__
  aws_access_key = bedrock_info["aws_access_key"]
                     ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'aws_access_key'

Expected behavior
If having logged in with SSO, I would expect this to use those credentials

Screenshots
NA

Additional context
NA

Which packages was the bug in?

Python Extensions (autogen-ext)

AutoGen library version.

Python dev (main branch)

Other library version.

No response

Model used

claude 3.5 sonnet

Model provider

AWS Bedrock

Other model provider

No response

Python version

3.10

.NET version

None

Operating system

Ubuntu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant