# -*- coding: utf-8 -*-"""Bedrock Converse API wrapper."""importtypingasTifT.TYPE_CHECKING:frommypy_boto3_bedrock_runtimeimportBedrockRuntimeClient
[docs]defconverse(client:"BedrockRuntimeClient",model_id:str,system:list[dict],messages:list[dict],)->str:"""Call Bedrock Converse API and return the assistant's text response."""response=client.converse(modelId=model_id,system=system,messages=messages,)returnresponse["output"]["message"]["content"][0]["text"]