BedrockClient

BedrockClient(**kwargs: Any)

Client for Amazon’s Bedrock Converse API.
Initialises BedrockClient for Amazon’s Bedrock Converse API

Parameters:
NameDescription
**kwargsType: Any

Instance Methods

cost

cost(self, response: ChatCompletion) -> float

Calculate the cost of the response.

Parameters:
NameDescription
responseType: ChatCompletion

create

create(self, params) -> ChatCompletionExtended

Run Amazon Bedrock inference and return AG2 response

Parameters:
NameDescription
params

get_usage

get_usage(response) -> dict

Get the usage of tokens and their cost information.

Parameters:
NameDescription
response

message_retrieval

message_retrieval(self, response) -> 

Retrieve the messages from the response.

Parameters:
NameDescription
response

parse_custom_params

parse_custom_params(self, params: dict[str, Any]) -> 

Parses custom parameters for logic in this client class

Parameters:
NameDescription
paramsType: dict[str, Any]

parse_params

parse_params(self, params: dict[str, Any]) -> tuple[dict[str, Any], dict[str, Any]]

Loads the valid parameters required to invoke Bedrock Converse Returns a tuple of (base_params, additional_params)

Parameters:
NameDescription
paramsType: dict[str, Any]