-
[issue-7526][BE] fix: make Anthropic adaptive-thinking opt-out sync-proof (#7590)
发布于
2026-07-23 13:49:50 +00:00 - [issue-7526][BE] fix: make Anthropic adaptive-thinking opt-out sync-proof
PR #7531 opted claude-opus-4-7/4-8 and claude-sonnet-5 out of sampling
params via a per-constant flag (NAME("value", false)) in the
AnthropicModelName enum. The enum constant list is regenerated by the
recurring "sync provider model definitions" chore, which emits single-arg
NAME("value") constants and has no notion of the extra argument. #7582
ran that sync ~18h later and silently dropped all three flags, reverting
supportsSamplingParams() to true for these models and reopening #7526:
online LLM-as-judge rules on adaptive-thinking models 400 again with
"temperature is deprecated for this model".Move the opt-out out of the generated constant list into a hand-maintained
ADAPTIVE_THINKING_MODELS set that supportsSamplingParams() consults, so
syncs can add/remove/reorder constants freely without clobbering the
capability. Behavior and the public API are unchanged.Add a regression test asserting each adaptive model id still maps to a
real enum constant (so the set can't drift when a sync renames/removes a
constant) and reports no sampling-param support.Verified on staging: with the flag lost, an API-created judge rule on
claude-opus-4-8 with a temperature 400s; with no temperature it scores
cleanly (max_tokens defaulting from #7531 is intact).Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
- refactor(anthropic): DRY adaptive-thinking set and tighten regression guard
- Build ADAPTIVE_THINKING_MODELS from enum constant values instead of
duplicated string literals, giving compile-time drift protection. - Add Lombok @Getter and use getValue() instead of toString().
- Drive the regression guard from @EnumSource so renaming/removing a
constant fails at discovery time. - Soften docs to keep the "add new adaptive models by hand" step visible.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
- refactor(anthropic): rename ADAPTIVE_THINKING_MODELS to ADAPTIVE_THINKING_MODEL_IDS
The set holds serialized Anthropic API id strings used as lookup keys in
supportsSamplingParams(String); the "_IDS" suffix makes that explicit.Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
- fix(anthropic): make supportsSamplingParams null-safe
Set.of(...).contains(null) throws NPE. Guard null/blank via StringUtils.isBlank
so the method honors its documented "unknown model names default to true"
contract. Covered by a new test.Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
- test(anthropic): cover blank model names in sampling-params fallback
Parameterize the null default-true test with @NullAndEmptySource + a
whitespace case so the StringUtils.isBlank branch is exercised for null,
empty, and whitespace inputs.Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Co-authored-by: Claude Opus 4.8 (1M context) noreply@anthropic.com
下载附件