langchain[patch]: init_chat_model support ChatBedrockConverse (#24564)

This commit is contained in:
Bagatur 2024-07-23 11:07:38 -07:00 committed by GitHub
parent 9b7db08184
commit 55e66aa40c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -366,6 +366,11 @@ def _init_chat_model_helper(
# TODO: update to use model= once ChatBedrock supports
return ChatBedrock(model_id=model, **kwargs)
elif model_provider == "bedrock_converse":
_check_pkg("langchain_aws")
from langchain_aws import ChatBedrockConverse
return ChatBedrockConverse(model=model, **kwargs)
else:
supported = ", ".join(_SUPPORTED_PROVIDERS)
raise ValueError(
@ -388,6 +393,7 @@ _SUPPORTED_PROVIDERS = {
"huggingface",
"groq",
"bedrock",
"bedrock_converse",
}