A programming framework for agentic AI
Allow implicit aws credential setting for AnthropicBedrockChatCompletionClient (#6561)
GeorgiosEfstathiadis113aca0b811d
diff --git a/python/packages/autogen-ext/src/autogen_ext/models/anthropic/_anthropic_client.py b/python/packages/autogen-ext/src/autogen_ext/models/anthropic/_anthropic_client.pyindex 5dff5813c..d5f9d62b7 100644--- a/python/packages/autogen-ext/src/autogen_ext/models/anthropic/_anthropic_client.py+++ b/python/packages/autogen-ext/src/autogen_ext/models/anthropic/_anthropic_client.py@@ -1193,11 +1193,15 @@ class AnthropicBedrockChatCompletionClient(if bedrock_info is None:raise ValueError("bedrock_info is required for AnthropicBedrockChatCompletionClient")- # Handle bedrock_info as secretestr+ # Handle bedrock_infoaws_region = bedrock_info["aws_region"]- aws_access_key = bedrock_info["aws_access_key"]- aws_secret_key = bedrock_info["aws_secret_key"]- aws_session_token = bedrock_info["aws_session_token"]+ aws_access_key: Optional[str] = None+ aws_secret_key: Optional[str] = None+ aws_session_token: Optional[str] = None+ if all(key in bedrock_info for key in ("aws_access_key", "aws_secret_key", "aws_session_token")):+ aws_access_key = bedrock_info["aws_access_key"]+ aws_secret_key = bedrock_info["aws_secret_key"]+ aws_session_token = bedrock_info["aws_session_token"]client = AsyncAnthropicBedrock(aws_access_key=aws_access_key,