@@ -24,18 +24,20 @@ def _setup_boto3_env():
2424@unittest .skipIf (None == os .getenv ("TEST_AWS" ), "tests skipped because TEST_AWS is not set" )
2525class TestClient (unittest .TestCase ):
2626 platform : str = "bedrock"
27- client : cohere .AwsClient = cohere .BedrockClient (
28- aws_access_key = aws_access_key ,
29- aws_secret_key = aws_secret_key ,
30- aws_session_token = aws_session_token ,
31- aws_region = aws_region ,
32- )
3327 models : typing .Dict [str , str ] = {
3428 "chat_model" : "cohere.command-r-plus-v1:0" ,
3529 "embed_model" : "cohere.embed-multilingual-v3" ,
3630 "generate_model" : "cohere.command-text-v14" ,
3731 }
3832
33+ def setUp (self ) -> None :
34+ self .client = cohere .BedrockClient (
35+ aws_access_key = aws_access_key ,
36+ aws_secret_key = aws_secret_key ,
37+ aws_session_token = aws_session_token ,
38+ aws_region = aws_region ,
39+ )
40+
3941 def test_rerank (self ) -> None :
4042 if self .platform != "sagemaker" :
4143 self .skipTest ("Only sagemaker supports rerank" )
@@ -130,12 +132,13 @@ class TestBedrockClientV2(unittest.TestCase):
130132 since the request would fail with a signature mismatch otherwise.
131133 """
132134
133- client : cohere .ClientV2 = cohere .BedrockClientV2 (
134- aws_access_key = aws_access_key ,
135- aws_secret_key = aws_secret_key ,
136- aws_session_token = aws_session_token ,
137- aws_region = aws_region ,
138- )
135+ def setUp (self ) -> None :
136+ self .client = cohere .BedrockClientV2 (
137+ aws_access_key = aws_access_key ,
138+ aws_secret_key = aws_secret_key ,
139+ aws_session_token = aws_session_token ,
140+ aws_region = aws_region ,
141+ )
139142
140143 def test_embed (self ) -> None :
141144 response = self .client .embed (
0 commit comments