Skip to content

Reject invalid Amazon Bedrock model IDs in the Anthropic provider#69404

Open
guan404ming wants to merge 1 commit into
apache:mainfrom
guan404ming:fix-anthropic-bedrock-model-id
Open

Reject invalid Amazon Bedrock model IDs in the Anthropic provider#69404
guan404ming wants to merge 1 commit into
apache:mainfrom
guan404ming:fix-anthropic-bedrock-model-id

Conversation

@guan404ming

Copy link
Copy Markdown
Member

Why

The default model claude-opus-4-8 is a bare first-party ID that Amazon Bedrock rejects, so a Bedrock connection without an overridden model failed with an opaque 400.

Reference: https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock-legacy

How

  • Add _resolve_model to validate the resolved model on the bedrock platform, raising AnthropicError with the correct prefixed-ID guidance.
  • Route create_message through the validator; leave Vertex, Foundry, and first-party unchanged.
  • Cover with tests for Bedrock rejection, prefixed-ID acceptance, and Vertex passthrough.

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)
    Claude Code with opus 4.8

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@guan404ming guan404ming marked this pull request as ready for review July 5, 2026 13:38
@Vamsi-klu

Copy link
Copy Markdown
Contributor

Could the Bedrock check be a stricter prefix/format check instead of "anthropic." not in resolved? Any string containing that substring passes, even if it is not a valid Bedrock model ID. Checking known prefixes like global.anthropic. / region prefixes, or at least resolved.startswith(...), would better match the intended guard.


Drafted-by: Codex (GPT-5); reviewed by @Vamsi-klu before posting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants