Extended Thinking を Sonnet 4.5 でも使えるようにする #1306
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Changes
Extended Thinking を行うためには Output Token を追加で使う必要があり、今までの実装では、Extended Thinking の Budget Token を MaxTokens に追加(足し算)する仕様であった。
しかし、Sonnet 4.5 対応時に最初から MaxTokens を最大値の 64000 に設定していたため、足し算を行うと必ず不正な値(>64000)になり extended thinking を使うと必ずエラーが起きていた。
今まで足し算にしていた理由として、LLM が過去に repetition 等を起こしてトークンを浪費してしまうケースがあった。昨今の LLM に repetition が見られなくなってきたため、足し算の処理をやめ、最初からモデルの最大トークンを設定するように修正する。
Checklist
npm run cdk:testand if there are snapshot differences, executenpm run cdk:test:update-snapshotto update snapshotsRelated Issues
#1297