Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Bedrock service name to "bedrock-runtime" and model identifiers #11161

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/extras/integrations/llms/bedrock.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"\n",
"llm = Bedrock(\n",
" credentials_profile_name=\"bedrock-admin\",\n",
" model_id=\"amazon.titan-tg1-large\"\n",
" model_id=\"amazon.titan-text-express-v1\"\n",
")"
]
},
Expand Down Expand Up @@ -82,7 +82,7 @@
"\n",
"llm = Bedrock(\n",
" credentials_profile_name=\"bedrock-admin\",\n",
" model_id=\"amazon.titan-tg1-large\",\n",
" model_id=\"amazon.titan-text-express-v1\",\n",
" streaming=True,\n",
" callbacks=[StreamingStdOutCallbackHandler()],\n",
")"
Expand Down
8 changes: 4 additions & 4 deletions libs/langchain/langchain/embeddings/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BedrockEmbeddings(BaseModel, Embeddings):

region_name ="us-east-1"
credentials_profile_name = "default"
model_id = "amazon.titan-e1t-medium"
model_id = "amazon.titan-embed-text-v1"

be = BedrockEmbeddings(
credentials_profile_name=credentials_profile_name,
Expand All @@ -54,8 +54,8 @@ class BedrockEmbeddings(BaseModel, Embeddings):
See: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
"""

model_id: str = "amazon.titan-e1t-medium"
"""Id of the model to call, e.g., amazon.titan-e1t-medium, this is
model_id: str = "amazon.titan-embed-text-v1"
"""Id of the model to call, e.g., amazon.titan-embed-text-v1, this is
equivalent to the modelId property in the list-foundation-models api"""

model_kwargs: Optional[Dict] = None
Expand Down Expand Up @@ -92,7 +92,7 @@ def validate_environment(cls, values: Dict) -> Dict:
if values["endpoint_url"]:
client_params["endpoint_url"] = values["endpoint_url"]

values["client"] = session.client("bedrock", **client_params)
values["client"] = session.client("bedrock-runtime", **client_params)

except ImportError:
raise ModuleNotFoundError(
Expand Down
6 changes: 3 additions & 3 deletions libs/langchain/langchain/llms/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class BedrockBase(BaseModel, ABC):
"""

model_id: str
"""Id of the model to call, e.g., amazon.titan-tg1-large, this is
"""Id of the model to call, e.g., amazon.titan-text-express-v1, this is
equivalent to the modelId property in the list-foundation-models api"""

model_kwargs: Optional[Dict] = None
Expand Down Expand Up @@ -184,7 +184,7 @@ def validate_environment(cls, values: Dict) -> Dict:
if values["endpoint_url"]:
client_params["endpoint_url"] = values["endpoint_url"]

values["client"] = session.client("bedrock", **client_params)
mani2348 marked this conversation as resolved.
Show resolved Hide resolved
values["client"] = session.client("bedrock-runtime", **client_params)

except ImportError:
raise ModuleNotFoundError(
Expand Down Expand Up @@ -307,7 +307,7 @@ class Bedrock(LLM, BedrockBase):

llm = BedrockLLM(
credentials_profile_name="default",
model_id="amazon.titan-tg1-large",
model_id="amazon.titan-text-express-v1",
streaming=True
)

Expand Down