Skip to content

fix(anthropic): say what Anthropic documents in the sampling parameter deprecation warning - #486

Open
pcbeingused333 wants to merge 1 commit into
posit-dev:mainfrom
pcbeingused333:fix/anthropic-sampling-warning-text
Open

pcbeingused333 wants to merge 1 commit into
posit-dev:mainfrom
pcbeingused333:fix/anthropic-sampling-warning-text

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

The DeprecationWarning that ChatAnthropic() raises when temperature, top_p or top_k are set says they "no longer have an effect on current Anthropic models". Anthropic's deprecations page says otherwise: these parameters return a 400 error when set to a non-default value on Claude 4.7 and later models (and Claude Mythos Preview), and API version 2026-10-21 removes them for every model. Someone following the warning and keeping the setting on a recent model would get an error instead of a harmless no-op.

The warning now says that, with a link to the page. What is forwarded through extra_body is unchanged, and so is the code comment's claim (it now matches the warning).

A question for the maintainers, not part of this change: translate_model_params forwards these parameters for any Claude model. Would you rather skip them for Claude 4.7+ and later models (with the warning) instead of letting the API reject the request?

Tests: the two existing tests now match the new wording, and a new test pins its content (the parameter names, the Claude 4.7 and 2026-10-21 facts, and that the old claim is gone). The three fail on main and pass here; a CHANGELOG entry is included.

This change was made with Claude Code.

🤖 Generated with Claude Code

…r deprecation warning

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant