Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/converters/anthropic_to_bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def convert_request(
additional_fields.update(thinking_config)

# Add anthropic_beta features for Claude models (from client-provided headers)
# Rules loaded from DynamoDB (blocklist → filter, mapping → translate, else → passthrough)
# Rules loaded from DynamoDB (blocklist → filter, mapping → translate, else → drop)
if self._is_claude_model() and anthropic_beta:
from app.db.beta_header_cache import BetaHeaderConfigCache
cache = BetaHeaderConfigCache.instance()
Expand All @@ -159,8 +159,8 @@ def convert_request(
bedrock_beta.extend(mapped)
print(f"[CONVERTER] Mapped beta header '{beta_value}' → {mapped}")
else:
bedrock_beta.append(beta_value)
print(f"[CONVERTER] Passing through beta header: {beta_value}")
# Drop unknown beta flags — Bedrock rejects unrecognized Anthropic-specific values
print(f"[CONVERTER] Dropping unknown beta header (not supported by Bedrock): {beta_value}")

if bedrock_beta:
additional_fields["anthropic_beta"] = bedrock_beta
Expand Down
8 changes: 7 additions & 1 deletion app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,13 @@ class Settings(BaseSettings):
default=[
"prompt-caching-scope-2026-01-05",
"redact-thinking-2026-02-12",
"advisor-tool-2026-03-01"
"advisor-tool-2026-03-01",
# Claude Code client headers — Anthropic-specific, not supported by Bedrock
"claude-code-20250219",
"context-1m-2025-08-07",
"interleaved-thinking-2025-05-14",
"context-management-2025-06-27",
"effort-2025-11-24",
],
alias="BETA_HEADERS_BLOCKLIST",
description="Beta headers that should NOT be passed to Bedrock (unsupported)",
Expand Down
12 changes: 4 additions & 8 deletions app/services/bedrock_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,13 +510,9 @@ def _convert_to_anthropic_native_request(
if request.metadata:
native_request["metadata"] = request.metadata.model_dump() if hasattr(request.metadata, "model_dump") else request.metadata

# Add output_config if present (e.g., effort level)
if request.output_config:
native_request["output_config"] = request.output_config
# output_config (effort level) is not supported by Bedrock — drop it

# Add context_management if present (e.g., compact-2026-01-12 beta)
if request.context_management:
native_request["context_management"] = request.context_management
# context_management (compact-2026-01-12 beta) is not supported by Bedrock — drop it

# Auto-inject advanced-tool-use beta header if tools contain defer_loading
# but the client didn't send the required beta header.
Expand Down Expand Up @@ -554,8 +550,8 @@ def _convert_to_anthropic_native_request(
bedrock_beta.extend(mapped)
print(f"[BEDROCK NATIVE] Mapped beta header '{beta_value}' → {mapped}")
else:
bedrock_beta.append(beta_value)
print(f"[BEDROCK NATIVE] Passing through beta header: {beta_value}")
# Drop unknown beta flags — Bedrock rejects unrecognized Anthropic-specific values
print(f"[BEDROCK NATIVE] Dropping unknown beta header (not supported by Bedrock): {beta_value}")

if bedrock_beta:
native_request["anthropic_beta"] = bedrock_beta
Expand Down