feat(langchain): support Bedrock Mantle chat models in init_chat_model (#40837)

Co-authored-by: ccurme <ccurme@users.noreply.github.com>
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-09-25 18:19:51 +00:00
1 parent 40fe8d6e02
commit 80b7409051
3 files changed
+22 -3

No files matched your search

@@ -61,6 +61,8 @@ _BUILTIN_PROVIDERS: dict[str, tuple[str, str, Callable[..., BaseChatModel]]] = {
"baseten": ("langchain_baseten", "ChatBaseten", _call),
"bedrock": ("langchain_aws", "ChatBedrock", _call),
"bedrock_converse": ("langchain_aws", "ChatBedrockConverse", _call),
"bedrock_mantle_anthropic": ("langchain_aws", "ChatAnthropicMantle", _call),
"bedrock_mantle_openai": ("langchain_aws", "ChatOpenAIMantle", _call),
"cohere": ("langchain_cohere", "ChatCohere", _call),
"deepseek": ("langchain_deepseek", "ChatDeepSeek", _call),
"fireworks": ("langchain_fireworks", "ChatFireworks", _call),
@@ -310,6 +312,8 @@ def init_chat_model(
- `anthropic_bedrock` -> [`langchain-aws`](https://docs.langchain.com/oss/python/integrations/providers/aws)
- `bedrock` -> [`langchain-aws`](https://docs.langchain.com/oss/python/integrations/providers/aws)
- `bedrock_converse` -> [`langchain-aws`](https://docs.langchain.com/oss/python/integrations/providers/aws)
- `bedrock_mantle_openai` -> [`langchain-aws[openai]`](https://docs.langchain.com/oss/python/integrations/providers/aws) — install with `pip install "langchain-aws[openai]"`
- `bedrock_mantle_anthropic` -> [`langchain-aws[anthropic]`](https://docs.langchain.com/oss/python/integrations/providers/aws) — install with `pip install "langchain-aws[anthropic]"`
- `cohere` -> [`langchain-cohere`](https://docs.langchain.com/oss/python/integrations/providers/cohere)
- `fireworks` -> [`langchain-fireworks`](https://docs.langchain.com/oss/python/integrations/providers/fireworks)
- `together` -> [`langchain-together`](https://docs.langchain.com/oss/python/integrations/providers/together)
@@ -155,6 +155,18 @@ def test_supported_providers_is_sorted() -> None:
assert list(_BUILTIN_PROVIDERS) == sorted(_BUILTIN_PROVIDERS.keys())
def test_bedrock_mantle_providers_registered() -> None:
"""Mantle providers map to the `langchain_aws` Mantle chat model classes."""
assert _BUILTIN_PROVIDERS["bedrock_mantle_openai"][:2] == (
"langchain_aws",
"ChatOpenAIMantle",
)
assert _BUILTIN_PROVIDERS["bedrock_mantle_anthropic"][:2] == (
"langchain_aws",
"ChatAnthropicMantle",
)
@pytest.mark.parametrize(
("model_name", "expected_provider"),
[
+6 -3
View File
@@ -2442,7 +2442,7 @@ typing = [
[[package]]
name = "langchain-anthropic"
version = "1.7.2"
version = "1.7.4"
source = { editable = "../partners/anthropic" }
dependencies = [
{ name = "anthropic" },
@@ -2581,7 +2581,7 @@ wheels = [
[[package]]
name = "langchain-core"
version = "1.6.3"
version = "1.6.5"
source = { editable = "../core" }
dependencies = [
{ name = "httpx" },
@@ -2785,7 +2785,7 @@ wheels = [
[[package]]
name = "langchain-openai"
version = "1.6.2"
version = "1.6.6"
source = { editable = "../partners/openai" }
dependencies = [
{ name = "certifi" },
@@ -2796,11 +2796,14 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "aiohttp", marker = "extra == 'azure-identity'", specifier = ">=3.11.0,<4.0.0" },
{ name = "azure-identity", marker = "extra == 'azure-identity'", specifier = ">=1.25.0,<2.0.0" },
{ name = "certifi", specifier = ">=2024.6.2" },
{ name = "langchain-core", editable = "../core" },
{ name = "openai", specifier = ">=2.45.0,<4.0.0" },
{ name = "tiktoken", specifier = ">=0.7.0,<1.0.0" },
]
provides-extras = ["azure-identity"]
[package.metadata.requires-dev]
dev = []