Skip to content

fix: drop sampling parameters when Anthropic thinking is enabled (WI-1798) - #424

Merged
stefan-ernst merged 1 commit into
mainfrom
wi-1798-llm-adapter
Nov 2, 2026
Merged

stefan-ernst merged 1 commit into
mainfrom
wi-1798-llm-adapter

Conversation

@stefan-ernst

Copy link
Copy Markdown
Contributor

Anthropic rejects temperature and top_p alongside thinking, but Fantasy clears them only on its explicit-budget thinking path. The effort path used for coding agents — and an operator thinking override forwarded via ExtraBody — left them set, so the hard-coded Standard-agent temperature and configured top_p reached the provider.

Change

callProviderOptions now reports whether the adapter enabled Anthropic thinking (effort, or an enabled operator thinking override), and Generate clears temperature/top_p on the call when it did. A thinking: {type: disabled} override is treated as disabled, so sampling is preserved there.

Sampling is still preserved whenever thinking is off, and the verbatim forwarding of an operator thinking override is unchanged.

Tests

Windshiftapp/core-tests-internal#24 — wire-level Anthropic bodies for configured effort, coding-agent effort, an operator thinking override, thinking disabled, and a disabled override. Fails against the pre-fix code with sampling parameters leaking alongside thinking.

… (WI-1798)

Anthropic rejects temperature and top_p alongside thinking, but Fantasy
clears them only on its explicit-budget thinking path. The effort path used
for coding agents, and an operator thinking override forwarded via ExtraBody,
left them set, so Standard-agent temperature and configured top_p reached the
provider.

Report whether the adapter enabled thinking from callProviderOptions and clear
temperature/top_p on the call whenever it did, covering both the effort path
and an enabled operator thinking override.
@stefan-ernst
stefan-ernst merged commit dc618c0 into main Nov 2, 2026
18 checks passed
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