Bedrock: anthropic_beta body field keeps whitespace and empty entries from the anthropic-beta header
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- aws, python
調査の方向性
Start with src/anthropic/lib/bedrock/_client.py and the _prepare_options function, using the supplied FinalRequestOptions example to reproduce the header splitting behavior. Update parsing so each beta token is trimmed and empty entries are removed, then verify anthropic_beta contains only valid names for default and per-call headers. The open linked pull request indicates this work is already underway.
索引モデルが issue の本文から書いたものです。
説明
What happens
AnthropicBedrock copies the anthropic-beta header into the request body as anthropic_beta, because Bedrock reads betas from the body. It splits the header on , without trimming, so a header written with the usual comma and space separator produces entries with a leading space, and a trailing comma produces an empty entry.
from anthropic._models import FinalRequestOptions
from anthropic.lib.bedrock._client import _prepare_options
options = _prepare_options(
FinalRequestOptions(
method="post",
url="/v1/messages",
json_data={"model": "anthropic.claude-sonnet-4-5"},
headers={"anthropic-beta": "context-1m-2025-08-07, interleaved-thinking-2025-05-14"},
)
)
print(options.json_data["anthropic_beta"])
# ['context-1m-2025-08-07', ' interleaved-thinking-2025-05-14']
The same happens for default_headers={"anthropic-beta": "a, b"} on the client or extra_headers on a call. Bedrock then receives " interleaved-thinking-2025-05-14", which is not a valid beta name.
What should happen
Each entry is trimmed and empty entries are dropped, giving ['context-1m-2025-08-07', 'interleaved-thinking-2025-05-14']. The TypeScript Bedrock client already trims (betas.split(',').map((beta) => beta.trim())), and the other places in this SDK that parse the header (credentials auth, the fallback middleware, tracing) strip each token.
Root cause
src/anthropic/lib/bedrock/_client.py, _prepare_options:
betas = build_headers(options.headers)[0].get("anthropic-beta")
if betas:
options.json_data.setdefault("anthropic_beta", betas.split(","))
- 主要言語
- Python
- スター
- 4.1k
- フォーク
- 915
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
anthropics/anthropic-sdk-python のほかの issue
-
beta_tool validation errors reach the model as "Invalid arguments for function X" with no detail対応中かも @mangeshraut712 が 32 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
anthropics/anthropic-sdk-python#2033 · コメント 3 件 ·
-
`AnthropicBedrock` 2.x sends `anthropic_version: 2026-10-21`, which Bedrock rejects for Claude Sonnet 4.5, Opus 4.5 and Opus 4.6対応中かも @charan-rathore が 36 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
anthropics/anthropic-sdk-python#2031 · コメント 1 件 ·
-
Three symlink tests in test_agent_toolset.py are missing the needs_symlinks marker対応中かも @okxint が 82 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
anthropics/anthropic-sdk-python#1915 · コメント 3 件 ·
-
Messages.parse (and AsyncMessages.parse) don't take cache_control?対応中かも @AlphaFDE が 86 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
anthropics/anthropic-sdk-python#1907 · コメント 2 件 ·
-
Windows: os.fchmod in credential write-back bricks the OAuth refresh token対応中かも @OllieinCanada が 98 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
anthropics/anthropic-sdk-python#1868 · コメント 1 件 ·
anthropics/anthropic-sdk-python の issue をすべて見る
似ている issue
-
bug harness
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
mruangutai/harness#2687 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modal-labs/modal-client#4158 ·
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 72/100
The-Swarm-Corporation/swarms-rs#168 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] SMTP listener now binds to EMAIL_PORT instead of 2525 since the gunicorn switch 5.0.3-ls373オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
linuxserver/docker-healthchecks#137 · コメント 1 件 ·