Skip to content

The agent engineering platform.

feat(anthropic): add Claude Fable 5.1 support (#40106)

Hunter Lovellcf22b84d752d
diff --git a/libs/partners/anthropic/langchain_anthropic/chat_models.py b/libs/partners/anthropic/langchain_anthropic/chat_models.py
index 10298786b2..b8ea0d2cb1 100644
--- a/libs/partners/anthropic/langchain_anthropic/chat_models.py
+++ b/libs/partners/anthropic/langchain_anthropic/chat_models.py
@@ -1511,8 +1511,34 @@ class ChatAnthropic(BaseChatModel):
if effort:
output_config["effort"] = effort
+ is_fable_model = self.model.startswith("claude-fable-5")
+ if is_fable_model:
+ top_k = request_config.get("top_k", self.top_k)
+ top_p = request_config.get("top_p", self.top_p)
+ temperature = request_config.get("temperature", self.temperature)
+ if top_k is not None:
+ msg = f"`top_k` is not supported for {self.model}."
+ raise ValueError(msg)
+ if top_p is not None and top_p != 1:
+ msg = (
+ f"`top_p` is not supported for {self.model} at non-default values."
+ )
+ raise ValueError(msg)
+ if temperature is not None and temperature != 1:
+ msg = (
+ f"`temperature` is not supported for {self.model} at "
+ "non-default values."
+ )
+ raise ValueError(msg)
+ if isinstance(thinking, Mapping) and thinking.get("type") == "disabled":
+ msg = (
+ '`thinking={"type": "disabled"}` is not supported for '
+ f"{self.model}; omit `thinking` to use adaptive thinking."
+ )
+ raise ValueError(msg)
+
if (
- self.model.startswith("claude-opus-5")
+ (self.model.startswith("claude-opus-5") or is_fable_model)
and isinstance(thinking, Mapping)
and thinking.get("type") == "enabled"
):
@@ -1625,6 +1651,10 @@ class ChatAnthropic(BaseChatModel):
payload["thinking"] = self.thinking
if self.inference_geo is not None:
payload["inference_geo"] = self.inference_geo
+ if self.model.startswith("claude-fable-5"):
+ payload.pop("temperature", None)
+ payload.pop("top_k", None)
+ payload.pop("top_p", None)
# Handle output_config and effort parameter
# Priority: kwarg `effort`/`reasoning_effort` > kwarg `output_config`
diff --git a/libs/partners/anthropic/langchain_anthropic/data/_profiles.py b/libs/partners/anthropic/langchain_anthropic/data/_profiles.py
index 6d3df5dc9f..449ae369d5 100644
--- a/libs/partners/anthropic/langchain_anthropic/data/_profiles.py
+++ b/libs/partners/anthropic/langchain_anthropic/data/_profiles.py
@@ -50,6 +50,40 @@ _PROFILES: dict[str, dict[str, Any]] = {
],
"reasoning_effort_default": "high",
},
+ "claude-fable-5-1": {
+ "name": "Claude Fable 5.1",
+ "release_date": "2026-09-01",
+ "last_updated": "2026-09-01",
+ "open_weights": False,
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "text_inputs": True,
+ "image_inputs": True,
+ "audio_inputs": False,
+ "pdf_inputs": True,
+ "video_inputs": False,
+ "text_outputs": True,
+ "image_outputs": False,
+ "audio_outputs": False,
+ "video_outputs": False,
+ "reasoning_output": True,
+ "tool_calling": True,
+ "structured_output": True,
+ "attachment": True,
+ "temperature": False,
+ "image_url_inputs": True,
+ "pdf_tool_message": True,
+ "image_tool_message": True,
+ "tool_call_streaming": True,
+ "reasoning_effort_levels": [
+ "low",
+ "medium",
+ "high",
+ "xhigh",
+ "max",
+ ],
+ "reasoning_effort_default": "high",
+ },
"claude-haiku-4-5": {
"name": "Claude Haiku 4.5 (latest)",
"release_date": "2025-10-15",
diff --git a/libs/partners/anthropic/langchain_anthropic/data/profile_augmentations.toml b/libs/partners/anthropic/langchain_anthropic/data/profile_augmentations.toml
index cc7c3864aa..38c3000f6f 100644
--- a/libs/partners/anthropic/langchain_anthropic/data/profile_augmentations.toml
+++ b/libs/partners/anthropic/langchain_anthropic/data/profile_augmentations.toml
@@ -57,3 +57,8 @@ reasoning_effort_default = "high"
structured_output = true
reasoning_effort_levels = ["low", "medium", "high", "xhigh", "max"]
reasoning_effort_default = "high"
+
+[overrides."claude-fable-5-1"]
+structured_output = true
+reasoning_effort_levels = ["low", "medium", "high", "xhigh", "max"]
+reasoning_effort_default = "high"
diff --git a/libs/partners/anthropic/tests/unit_tests/test_chat_models.py b/libs/partners/anthropic/tests/unit_tests/test_chat_models.py
index 6c40ccf632..e7fd0f40d3 100644
--- a/libs/partners/anthropic/tests/unit_tests/test_chat_models.py
+++ b/libs/partners/anthropic/tests/unit_tests/test_chat_models.py
@@ -3911,6 +3911,36 @@ def test_reasoning_effort_yields_to_effort() -> None:
assert payload["output_config"]["effort"] == "high"
+ ("kwargs", "match"),
+ [
+ ({"thinking": {"type": "disabled"}}, r"not supported for claude-fable-5-1"),
+ ({"top_k": 1}, r"`top_k` is not supported"),
+ ({"top_p": 0.9}, r"`top_p` is not supported"),
+ ({"temperature": 0.1}, r"`temperature` is not supported"),
+ ],
+)
+def test_fable_5_1_rejects_unsupported_parameters(
+ kwargs: dict[str, object], match: str
+) -> None:
+ """Fable 5.1 only supports adaptive thinking and default sampling."""
+ model = ChatAnthropic(model="claude-fable-5-1", **kwargs)
+
+ with pytest.raises(ValueError, match=match):
+ model._get_request_payload("Test query")
+
+
+def test_fable_5_1_rejects_manual_thinking() -> None:
+ """Fable 5.1 does not support manual thinking budgets."""
+ model = ChatAnthropic(
+ model="claude-fable-5-1",
+ thinking={"type": "enabled", "budget_tokens": 1_024},
+ )
+
+ with pytest.raises(ValueError, match=r"use adaptive thinking"):
+ model._get_request_payload("Test query")
+
+
def test_reasoning_effort_defaults_adaptive_thinking() -> None:
"""Test that `reasoning_effort` also defaults `thinking` to adaptive.