From 93a84f6182d01c7cd954d0ffe7c6d7496e95885f Mon Sep 17 00:00:00 2001 From: Ducasse-Arthur <139344153+Ducasse-Arthur@users.noreply.github.com> Date: Wed, 12 Jul 2023 16:43:23 +0200 Subject: [PATCH] =?UTF-8?q?Update=20bedrock.py=20-=20support=20of=20other?= =?UTF-8?q?=20endpoint=20url=20(esp.=20for=20users=20of=20=E2=80=A6=20(#75?= =?UTF-8?q?92)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added an _endpoint_url_ attribute to Bedrock(LLM) class - I have access to Bedrock only via us-west-2 endpoint and needed to change the endpoint url, this could be useful to other users --- langchain/llms/bedrock.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/langchain/llms/bedrock.py b/langchain/llms/bedrock.py index 884202a5a43..f923e0e5a3c 100644 --- a/langchain/llms/bedrock.py +++ b/langchain/llms/bedrock.py @@ -95,6 +95,9 @@ class Bedrock(LLM): model_kwargs: Optional[Dict] = None """Key word arguments to pass to the model.""" + endpoint_url: Optional[str] = None + """Needed if you don't want to default to us-east-1 endpoint""" + class Config: """Configuration for this pydantic object.""" @@ -120,6 +123,8 @@ class Bedrock(LLM): client_params = {} if values["region_name"]: client_params["region_name"] = values["region_name"] + if values["endpoint_url"]: + client_params["endpoint_url"] = values["endpoint_url"] values["client"] = session.client("bedrock", **client_params)