Skip to content

Not able to use AnthropicsBedrockClient, Not able to import #6483

Closed
@amardeepjaiman

Description

@amardeepjaiman

What happened?

Describe the bug
I am getting following import while using the AnthroipcsBedrockClient using Autogen-ext[Anthropics]==0.5.6 package:

File "C:\Users\ajaiman\Projects\code\Official\AgenticAI-ITSM\app\utils\bedrock_llm_anthropics.py", line 8, in
from autogen_ext.models.anthropic import AnthropicBedrockChatCompletionClient
ImportError: cannot import name 'AnthropicBedrockChatCompletionClient' from 'autogen_ext.models.anthropic' (C:\Users\ajaiman\Projects\code\Official\AgenticAI-ITSM.venv2\Lib\site-packages\autogen_ext\models\anthropic_init_.py)

To Reproduce
Using the following code:

config = {
"model": "anthropic.claude-3-5-sonnet-20240620-v1:0",
"temperature": 0.1,
"model_info": {
"vision": True,
"function_calling": True,
"json_output": True,
"family": ModelFamily.CLAUDE_3_5_SONNET,
"structured_output": True
},
"bedrock_info": {
"aws_access_key": AWS_ACCESS_KEY_ID,
"aws_secret_key": AWS_SECRET_ACCESS_KEY,
"aws_region": AWS_REGION,
},
}
anthropic_client = AnthropicBedrockChatCompletionClient(**config)
model_result = await anthropic_client.create(
messages=[UserMessage(content="Whats the weather in Paris?", source="User")]
)
print(model_result)

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Which packages was the bug in?

Python AgentChat (autogen-agentchat>=0.4.0)

AutoGen library version.

Python 0.5.6

Other library version.

No response

Model used

anthropic.claude-3-5-sonnet-20240620-v1:0

Model provider

AWS Bedrock

Other model provider

No response

Python version

3.11

.NET version

None

Operating system

Windows

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions