1414import  json 
1515import  os 
1616from  io  import  BytesIO 
17+ from  pprint  import  pformat 
1718
1819import  boto3 
1920import  botocore .eventstream 
@@ -814,9 +815,17 @@ def test_bedrock_chat_completion_functions_marked_as_wrapped_for_sdk_compatibili
814815    assert  bedrock_server ._nr_wrapped 
815816
816817
817- def  test_chat_models_instrumented ():
818-     SUPPORTED_MODELS  =  [model  for  model , _ , _ , _  in  MODEL_EXTRACTORS  if  "embed"  not  in   model ]
818+ SUPPORTED_MODELS  =  [model  for  model , _ , _ , _  in  MODEL_EXTRACTORS  if  "embed"  not  in   model ]
819+ 
820+ 
821+ def  _is_supported_model (model ):
822+     for  supported_model  in  SUPPORTED_MODELS :
823+         if  supported_model  in  model :
824+             return  True 
825+     return  False 
819826
827+ 
828+ def  test_chat_models_instrumented ():
820829    _id  =  os .environ .get ("AWS_ACCESS_KEY_ID" )
821830    key  =  os .environ .get ("AWS_SECRET_ACCESS_KEY" )
822831    if  not  _id  or  not  key :
@@ -825,10 +834,6 @@ def test_chat_models_instrumented():
825834    client  =  boto3 .client ("bedrock" , "us-east-1" )
826835    response  =  client .list_foundation_models (byOutputModality = "TEXT" )
827836    models  =  [model ["modelId" ] for  model  in  response ["modelSummaries" ]]
828-     not_supported  =  []
829-     for  model  in  models :
830-         is_supported  =  any (model .startswith (supported_model ) for  supported_model  in  SUPPORTED_MODELS )
831-         if  not  is_supported :
832-             not_supported .append (model )
837+     not_supported  =  [model  for  model  in  models  if  not  _is_supported_model (model )]
833838
834-     assert  not  not_supported , f"The following unsupported models were found: { not_supported }  " 
839+     assert  not  not_supported , f"The following unsupported models were found: { pformat ( not_supported ) }  " 
0 commit comments