[integrations][anthropic] Update the stale default model to claude-sonnet-4-5 - #1039
[integrations][anthropic] Update the stale default model to claude-sonnet-4-5#1039weiqingy wants to merge 1 commit into
Conversation
…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)
|
Thanks for updating the stale default and keeping Java, Python, and the docs aligned. One concern: Also, |
Linked issue: #1038
Purpose of change
The Anthropic chat model defaults to
claude-sonnet-4-20250514when the caller omitsmodel. 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-5in 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-5keeps 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_MODELinstead 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
modelexplicitly are unaffected. The constant is consulted only when the resource descriptor omitsmodel.Tests
AnthropicChatModelSetupTest.testGetParametersDefaultsasserts 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-neededdoc-not-neededdoc-includedWas this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code 2.1.234 (Claude Opus 5)