Merge pull request #41203 from clonylu/fix/anthropic-thinking-binding-beta-header

fix(anthropic): register thinking-binding-controls-2026-08-01 in beta headers config
This commit is contained in:
Mateo Wang 2026-09-18 12:50:55 -07:00 committed by GitHub
commit a7a3f6802e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 0 deletions

View file

@ -28,6 +28,7 @@
"structured-outputs-2025-11-13": "structured-outputs-2025-11-13",
"text_editor_20241022": null,
"text_editor_20250124": null,
"thinking-binding-controls-2026-08-01": "thinking-binding-controls-2026-08-01",
"token-efficient-tools-2025-02-19": "token-efficient-tools-2025-02-19",
"web-fetch-2025-09-10": "web-fetch-2025-09-10",
"web-search-2025-03-05": "web-search-2025-03-05"
@ -59,6 +60,7 @@
"structured-outputs-2025-11-13": "structured-outputs-2025-11-13",
"text_editor_20241022": null,
"text_editor_20250124": null,
"thinking-binding-controls-2026-08-01": null,
"token-efficient-tools-2025-02-19": null,
"web-fetch-2025-09-10": "web-fetch-2025-09-10",
"web-search-2025-03-05": "web-search-2025-03-05"
@ -90,6 +92,7 @@
"structured-outputs-2025-11-13": "structured-outputs-2025-11-13",
"text_editor_20241022": null,
"text_editor_20250124": null,
"thinking-binding-controls-2026-08-01": "thinking-binding-controls-2026-08-01",
"token-efficient-tools-2025-02-19": null,
"tool-search-tool-2025-10-19": null,
"web-fetch-2025-09-10": null,
@ -122,6 +125,7 @@
"structured-outputs-2025-11-13": null,
"text_editor_20241022": null,
"text_editor_20250124": null,
"thinking-binding-controls-2026-08-01": "thinking-binding-controls-2026-08-01",
"token-efficient-tools-2025-02-19": null,
"tool-search-tool-2025-10-19": "tool-search-tool-2025-10-19",
"web-fetch-2025-09-10": null,
@ -154,6 +158,7 @@
"structured-outputs-2025-11-13": null,
"text_editor_20241022": null,
"text_editor_20250124": null,
"thinking-binding-controls-2026-08-01": "thinking-binding-controls-2026-08-01",
"token-efficient-tools-2025-02-19": null,
"tool-search-tool-2025-10-19": "tool-search-tool-2025-10-19",
"web-fetch-2025-09-10": null,
@ -187,6 +192,7 @@
"structured-outputs-2025-11-13": "structured-outputs-2025-11-13",
"text_editor_20241022": null,
"text_editor_20250124": null,
"thinking-binding-controls-2026-08-01": "thinking-binding-controls-2026-08-01",
"token-efficient-tools-2025-02-19": "token-efficient-tools-2025-02-19",
"web-fetch-2025-09-10": "web-fetch-2025-09-10",
"web-search-2025-03-05": "web-search-2025-03-05"

View file

@ -426,6 +426,22 @@ class TestAnthropicBetaHeadersFiltering:
assert filtered == ["fine-grained-tool-streaming-2025-05-14"]
@pytest.mark.parametrize(
"provider", ["anthropic", "bedrock", "bedrock_converse", "vertex_ai", "databricks"]
)
def test_thinking_binding_controls_forwarded(self, provider):
"""`thinking.block_binding` (preserved thinking, Claude Fable 5.1) is only
accepted alongside thinking-binding-controls-2026-08-01. The body field is
forwarded untouched, so stripping the header (previously unknown, hence
dropped) makes Bedrock and Vertex reject the request with
"thinking.adaptive.block_binding: Extra inputs are not permitted"."""
filtered = filter_and_transform_beta_headers(
beta_headers=["thinking-binding-controls-2026-08-01"],
provider=provider,
)
assert filtered == ["thinking-binding-controls-2026-08-01"]
def test_null_value_headers_filtered(self):
"""Test that headers with null values are always filtered out."""
for provider in [