Coverage for mindsdb / integrations / handlers / bedrock_handler / utilities.py: 0%
6 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-21 00:36 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-21 00:36 +0000
1import boto3
2from typing import Text, Optional
5def create_amazon_bedrock_client(
6 client: Text,
7 aws_access_key_id: Text,
8 aws_secret_access_key: Text,
9 region_name: Text,
10 aws_session_token: Optional[Text] = None,
11) -> boto3.client:
12 """
13 Create an Amazon Bedrock client via boto3.
15 Parameters
16 ----------
17 client : Text
18 The type of client to create. It can be 'bedrock' or 'bedrock-runtime'.
20 aws_access_key_id : Text
21 The AWS access key ID.
23 aws_secret_access_key : Text
24 The AWS secret access key.
26 region_name : Text
27 The AWS region name.
29 aws_session_token : Text, Optional
30 The AWS session token. Optional, but required for temporary security credentials.
32 Returns
33 -------
34 boto3.client
35 Amazon Bedrock client.
36 """
37 if client not in ["bedrock", "bedrock-runtime"]:
38 raise ValueError("The client must be 'bedrock' or 'bedrock-runtime'")
40 return boto3.client(
41 client,
42 aws_access_key_id=aws_access_key_id,
43 aws_secret_access_key=aws_secret_access_key,
44 region_name=region_name,
45 aws_session_token=aws_session_token,
46 )