3737)
3838def test_aws_bedrock_model (model_type : ModelType ):
3939 r"""Test AWSBedrockModel initialization with different model types."""
40- model = AWSBedrockModel (model_type )
40+ model = AWSBedrockModel (
41+ model_type ,
42+ api_key = "dummy_key" ,
43+ url = "http://dummy.url" ,
44+ )
4145 assert model .model_type == model_type
4246 assert model .model_config_dict == BedrockConfig ().as_dict ()
4347 assert isinstance (model .token_counter , OpenAITokenCounter )
@@ -47,12 +51,23 @@ def test_aws_bedrock_model(model_type: ModelType):
4751
4852@pytest .mark .model_backend
4953@pytest .mark .asyncio
50- async def test_aws_bedrock_async_not_implemented ():
51- r"""Test AWSBedrockModel async method raising NotImplementedError."""
52- model = AWSBedrockModel (ModelType .AWS_CLAUDE_3_HAIKU )
53-
54- with pytest .raises (
55- NotImplementedError ,
56- match = "AWS Bedrock does not support async inference." ,
57- ):
58- await model ._arun ("Test message" )
54+ async def test_aws_bedrock_async_supported ():
55+ r"""Test AWSBedrockModel async method is now supported.
56+
57+ This test verifies that async inference is supported by ensuring
58+ it doesn't raise NotImplementedError. Instead, it should attempt
59+ to make a connection and fail with APIConnectionError due to
60+ invalid credentials in the test environment.
61+ """
62+ from openai import APIConnectionError
63+
64+ model = AWSBedrockModel (
65+ ModelType .AWS_CLAUDE_3_HAIKU ,
66+ api_key = "dummy_key" ,
67+ url = "http://dummy.url" ,
68+ )
69+
70+ # Async should now be supported, so it should attempt to connect
71+ # and fail with a connection error (not NotImplementedError)
72+ with pytest .raises (APIConnectionError ):
73+ await model ._arun ([{"role" : "user" , "content" : "Test message" }])
0 commit comments