From d360800cbf49d572fdef844ed900b873c93193ce Mon Sep 17 00:00:00 2001 From: TorgemanTarak Date: Mon, 16 Dec 2024 15:04:49 +0100 Subject: [PATCH 1/2] pass the reigion name to the boto3.session.client to use region gated models on bedrock --- metagpt/provider/bedrock_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metagpt/provider/bedrock_api.py b/metagpt/provider/bedrock_api.py index 4e783f579..e42079d00 100644 --- a/metagpt/provider/bedrock_api.py +++ b/metagpt/provider/bedrock_api.py @@ -38,7 +38,7 @@ def __init_client(self, service_name: Literal["bedrock-runtime", "bedrock"]): "region_name": os.environ.get("AWS_DEFAULT_REGION", self.config.region_name), } session = boto3.Session(**self.__credential_kwargs) - client = session.client(service_name) + client = session.client(service_name,region_name = self.__credential_kwargs["region_name"]) return client @property From f439c6717b32e71dc3cef37fd851050453e460f9 Mon Sep 17 00:00:00 2001 From: TorgemanTarak Date: Tue, 17 Dec 2024 16:35:06 +0100 Subject: [PATCH 2/2] sorry i forgot the pre commit hooks --- metagpt/provider/bedrock_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metagpt/provider/bedrock_api.py b/metagpt/provider/bedrock_api.py index e42079d00..72eefa7e5 100644 --- a/metagpt/provider/bedrock_api.py +++ b/metagpt/provider/bedrock_api.py @@ -38,7 +38,7 @@ def __init_client(self, service_name: Literal["bedrock-runtime", "bedrock"]): "region_name": os.environ.get("AWS_DEFAULT_REGION", self.config.region_name), } session = boto3.Session(**self.__credential_kwargs) - client = session.client(service_name,region_name = self.__credential_kwargs["region_name"]) + client = session.client(service_name, region_name=self.__credential_kwargs["region_name"]) return client @property