fix(anthropic): honor adaptive thinking config for newer Claude models#12909
fix(anthropic): honor adaptive thinking config for newer Claude models#12909syf2211 wants to merge 3 commits into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
1 issue found across 5 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
I have read the CLA Document and I hereby sign the CLA |
|
recheck |
- Parse thinking and output_config in completion options schema - Forward adaptive thinking/output_config to Anthropic API requests - Skip legacy reasoning toggle when model config specifies thinking - Add regression tests for adaptive thinking request bodies - test: add required model field to completionOptions in vitest Fixes continuedev#12908
5b16ed6 to
8f4d77d
Compare
|
recheck |
|
Solid implementation! The buildThinkingParams method cleanly handles the three thinking modes (enabled/adaptive/disabled) with proper budget_tokens fallback. Adding thinking and output_config to the type definitions is important for API compatibility. |
Address cubic P2 review: output_config was only included when thinking.type was set, so configs with output_config alone (or on the legacy reasoning path) were dropped from API requests. Add regression test for output_config-only completion options.
|
Addressed cubic P2 review in 9d1784e: |
Summary
Parse and forward Anthropic
thinking/output_configcompletion options from config.yaml instead of always mapping the legacy reasoning toggle tothinking.type: enabled.Motivation
Claude Opus 4.x models reject
thinking.type.enabledand requirethinking.type.adaptivewithoutput_config.effort. Users who configured adaptive thinking in YAML still got API errors because Continue stripped unknown completion-option fields and the chat UI forcedreasoning: true.Fixes #12908
Changes
packages/config-yaml/src/schemas/models.tsthinkingandoutput_configto completion options schemacore/index.d.tsBaseCompletionOptionstypescore/llm/llms/Anthropic.tsreasoningbooleangui/src/redux/thunks/streamNormalInput.tsthinking.typecore/llm/llms/Anthropic.vitest.tsTests
Anthropic.vitest.tscases for adaptive thinking +output_config, and for config precedence over legacyreasoning: trueNotes
reasoning: truebehavior is unchanged when nothinkingblock is configuredoutput_config.effortenum currently covers low/medium/high; API may add more values laterSummary by cubic
Honor Anthropic
thinkingandoutput_configfrom YAML and per-request options, preferring them over the legacyreasoningflag. Fixes Claude Opus 4.x errors by supportingthinking.type: adaptivewithoutput_config.effort, and forwardsoutput_configeven when set withoutthinking(fixes #12908).thinkingandoutput_configinpackages/config-yaml; add types incore/index.d.ts.thinking(budget_tokens forenabled) and always includeoutput_config; fall back to legacyreasoningonly ifthinkingisn’t set.gui, skip adding the legacyreasoningtoggle whenthinking.typeis configured.thinking/output_config,output_config-only,output_configon the legacyreasoningpath, and config precedence over legacyreasoning; include requiredmodelincompletionOptions.Written for commit 69f7f0f. Summary will update on new commits.