Skip to content

[integrations][anthropic] Update the stale default model to claude-sonnet-4-5 - #1039

Open
weiqingy wants to merge 1 commit into
apache:mainfrom
weiqingy:280-pr41-anthropic-default-model
Open

[integrations][anthropic] Update the stale default model to claude-sonnet-4-5#1039
weiqingy wants to merge 1 commit into
apache:mainfrom
weiqingy:280-pr41-anthropic-default-model

Conversation

@weiqingy

Copy link
Copy Markdown
Collaborator

Linked issue: #1038

Purpose of change

The Anthropic chat model defaults to claude-sonnet-4-20250514 when the caller omits model. That model is deprecated, so a user who takes the default silently gets a deprecated model today and will hit a hard failure whenever it retires. The same value is restated in a Javadoc parameter list, a Javadoc example, a Python docstring, two docs parameter tables and two docs examples, so it had drifted in nine places rather than one.

This change moves the default to claude-sonnet-4-5 in both language runtimes and updates every restatement. The undated alias matches every other chat model default in the repo (gpt-4o-mini, gpt-4o, gemini-3.1-pro-preview, qwen-plus); Anthropic was the only one pinned to a dated snapshot, which is why it went stale. Unlike a dated snapshot, an alias cannot decay into a retired id again.

claude-sonnet-4-5 keeps the same tier as the model it replaces, so a caller relying on the default sees no change in cost or class of model. It is also the name the connection tests introduced in #965 already use as their structured-output-capable example, on the grounds that it is the generation which is both capable and still accepts a JSON prefill.

Two smaller things ride along, both of the same defect class. The Python docstring now names DEFAULT_ANTHROPIC_MODEL instead of repeating its value, matching the OpenAI and Tongyi integrations, so it cannot drift from the constant a second time. The docs list of available models is pruned to three current entries, because three of its four entries named models that are deprecated or already retired, one of them past its retirement date.

Callers that pass model explicitly are unaffected. The constant is consulted only when the resource descriptor omits model.

Tests

AnthropicChatModelSetupTest.testGetParametersDefaults asserts the documented defaults and is updated to the new value. The existing Python test asserts against the imported constant rather than a hard-coded string, so it continues to pin the default without change.

Two test constants in the suites added by #965 named the old model as the shipped default. They keep their value, because those tests need a model the provider does not document native structured-output support for and that is still what it is, but their comments no longer describe it as the default.

No new tests. The default is already pinned on both sides, and an assertion that a private constant equals its own literal would not catch a bug the compiler misses.

API

No API signature change. Only the value of the default model changes.

Documentation

  • doc-needed
  • doc-not-needed
  • doc-included

Was this patch authored or co-authored using generative AI tooling?

  • Yes
  • No

Generated-by: Claude Code 2.1.234 (Claude Opus 5)

…nnet-4-5

The Anthropic chat model defaults to claude-sonnet-4-20250514 when the caller
omits model. That model is deprecated, so a user who takes the default silently
gets a deprecated model and will hit a hard failure once it retires.

Move the default to claude-sonnet-4-5 in both language runtimes, and update the
Javadoc, the Python docstring and the docs that restate the value. The alias
form matches every other chat model default in the repo (gpt-4o-mini, gpt-4o,
gemini-3.1-pro-preview, qwen-plus), and unlike a dated snapshot it cannot decay
into a retired id again. The Python docstring now names the constant instead of
repeating its value, matching the OpenAI and Tongyi integrations, so it cannot
drift from the constant a second time.

claude-sonnet-4-5 is the same tier as the model it replaces, so a caller who
relies on the default sees no change in cost or class of model. It is also the
name the connection tests already use as their structured-output-capable
example, being the generation that is both capable and still accepts a JSON
prefill.

Two test constants named the old value as the shipped default. They keep the
value, since the tests need a model without native structured-output support
and that is still what it is, but their comments no longer call it the default.
The docs list of available models is pruned to three current entries, because
three of its four entries named models that are deprecated or already retired.

Generated-by: Claude Code 2.1.234 (Claude Opus 5)
@github-actions github-actions Bot added doc-included Your PR already contains the necessary documentation updates. fixVersion/0.4.0 priority/major Default priority of the PR or issue. labels Aug 22, 2026
@wenjin272

wenjin272 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating the stale default and keeping Java, Python, and the docs aligned.

One concern: claude-sonnet-4-5 only tracks snapshots within the 4.5 version and does not advance to 4.6 or 5; Anthropic states that every model ID has its own retirement schedule, and the current 4.5 snapshot may retire as early as September 29, 2026 (model versioning, deprecations). Could we use the recommended replacement claude-sonnet-4-6, or require an explicit model, so the stale-default problem is not merely postponed? The Python default test should also assert the chosen literal, since comparing with the same imported constant does not validate the public default.

Also, ChatModelIntegrationAgent still hard-codes the retired claude-sonnet-4-20250514, so the Anthropic E2E path will fail when run with a real API key.

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

Labels

doc-included Your PR already contains the necessary documentation updates. fixVersion/0.4.0 priority/major Default priority of the PR or issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants