mirror of
https://github.com/microsoft/autogen.git
synced 2025-08-16 04:31:17 +00:00

<!-- Thank you for your contribution! Please review https://microsoft.github.io/autogen/docs/Contribute before opening a pull request. --> Some fixes with the AnthropicBedrockChatCompletionClient - Ensure `AnthropicBedrockChatCompletionClient` exported and can be imported. - Update the BedrockInfo keys serialization - client argument can be string (similar to api key in this ) but exported config should be Secret - Replace `AnthropicBedrock` with `AsyncAnthropicBedrock` : client should be async to work with the ag stack and the BaseAnthropicClient it inherits from - Improve `AnthropicBedrockChatCompletionClient` docstring to use the correct client arguments rather than serialized dict format. Expect ```python from autogen_ext.models.anthropic import AnthropicBedrockChatCompletionClient, BedrockInfo from autogen_core.models import UserMessage, ModelInfo async def main(): anthropic_client = AnthropicBedrockChatCompletionClient( model="anthropic.claude-3-5-sonnet-20240620-v1:0", temperature=0.1, model_info=ModelInfo(vision=False, function_calling=True, json_output=False, family="unknown", structured_output=True), bedrock_info=BedrockInfo( aws_access_key="<aws_access_key>", aws_secret_key="<aws_secret_key>", aws_session_token="<aws_session_token>", aws_region="<aws_region>", ), ) # type: ignore result = await anthropic_client.create([UserMessage(content="What is the capital of France?", source="user")]) print(result) await main() ``` <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? <!-- Please give a short summary of the change and the problem this solves. --> ## Related issue number <!-- For example: "Closes #1234" --> Closes #6483 ## Checks - [ ] I've included any doc changes needed for <https://microsoft.github.io/autogen/>. See <https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to build and test documentation locally. - [ ] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [ ] I've made sure all auto checks have passed. --------- Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>