Skip to content

Commit d19fb4a

Browse files
authored
Extended Thinking を Sonnet 4.5 でも使えるようにする (#1306)
1 parent d2569f6 commit d19fb4a

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

packages/cdk/lambda/utils/models.ts

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,21 @@ export const defaultVideoGenerationModel: Model = {
108108
};
109109

110110
// Model Params
111-
const CLAUDE_4_5_DEFAULT_PARAMS: ConverseInferenceParams = {
111+
const CLAUDE_SONNET_4_DEFAULT_PARAMS: ConverseInferenceParams = {
112112
inferenceConfig: {
113113
maxTokens: 64000,
114114
temperature: 1,
115115
},
116116
};
117117

118+
const CLAUDE_OPUS_4_DEFAULT_PARAMS: ConverseInferenceParams = {
119+
inferenceConfig: {
120+
maxTokens: 32000,
121+
temperature: 1,
122+
topP: 0.999,
123+
},
124+
};
125+
118126
const CLAUDE_3_5_DEFAULT_PARAMS: ConverseInferenceParams = {
119127
inferenceConfig: {
120128
maxTokens: 8192,
@@ -472,9 +480,7 @@ const createConverseCommandInput = (
472480
...params.inferenceConfig,
473481
temperature: 1, // reasoning requires temperature to be 1
474482
topP: undefined, // reasoning does not require topP
475-
maxTokens:
476-
(model.modelParameters?.reasoningConfig?.budgetTokens || 0) +
477-
(params.inferenceConfig?.maxTokens || 0),
483+
maxTokens: params.inferenceConfig?.maxTokens,
478484
};
479485
converseCommandInput.additionalModelRequestFields = {
480486
reasoning_config: {
@@ -929,79 +935,79 @@ export const BEDROCK_TEXT_GEN_MODELS: {
929935
};
930936
} = {
931937
'us.anthropic.claude-opus-4-1-20250805-v1:0': {
932-
defaultParams: CLAUDE_3_5_DEFAULT_PARAMS,
938+
defaultParams: CLAUDE_OPUS_4_DEFAULT_PARAMS,
933939
usecaseParams: USECASE_DEFAULT_PARAMS,
934940
createConverseCommandInput: createConverseCommandInput,
935941
createConverseStreamCommandInput: createConverseStreamCommandInput,
936942
extractConverseOutput: extractConverseOutput,
937943
extractConverseStreamOutput: extractConverseStreamOutput,
938944
},
939945
'us.anthropic.claude-opus-4-20250514-v1:0': {
940-
defaultParams: CLAUDE_3_5_DEFAULT_PARAMS,
946+
defaultParams: CLAUDE_OPUS_4_DEFAULT_PARAMS,
941947
usecaseParams: USECASE_DEFAULT_PARAMS,
942948
createConverseCommandInput: createConverseCommandInput,
943949
createConverseStreamCommandInput: createConverseStreamCommandInput,
944950
extractConverseOutput: extractConverseOutput,
945951
extractConverseStreamOutput: extractConverseStreamOutput,
946952
},
947953
'global.anthropic.claude-sonnet-4-5-20250929-v1:0': {
948-
defaultParams: CLAUDE_4_5_DEFAULT_PARAMS,
954+
defaultParams: CLAUDE_SONNET_4_DEFAULT_PARAMS,
949955
usecaseParams: USECASE_DEFAULT_PARAMS,
950956
createConverseCommandInput: createConverseCommandInput,
951957
createConverseStreamCommandInput: createConverseStreamCommandInput,
952958
extractConverseOutput: extractConverseOutput,
953959
extractConverseStreamOutput: extractConverseStreamOutput,
954960
},
955961
'us.anthropic.claude-sonnet-4-5-20250929-v1:0': {
956-
defaultParams: CLAUDE_4_5_DEFAULT_PARAMS,
962+
defaultParams: CLAUDE_SONNET_4_DEFAULT_PARAMS,
957963
usecaseParams: USECASE_DEFAULT_PARAMS,
958964
createConverseCommandInput: createConverseCommandInput,
959965
createConverseStreamCommandInput: createConverseStreamCommandInput,
960966
extractConverseOutput: extractConverseOutput,
961967
extractConverseStreamOutput: extractConverseStreamOutput,
962968
},
963969
'eu.anthropic.claude-sonnet-4-5-20250929-v1:0': {
964-
defaultParams: CLAUDE_4_5_DEFAULT_PARAMS,
970+
defaultParams: CLAUDE_SONNET_4_DEFAULT_PARAMS,
965971
usecaseParams: USECASE_DEFAULT_PARAMS,
966972
createConverseCommandInput: createConverseCommandInput,
967973
createConverseStreamCommandInput: createConverseStreamCommandInput,
968974
extractConverseOutput: extractConverseOutput,
969975
extractConverseStreamOutput: extractConverseStreamOutput,
970976
},
971977
'jp.anthropic.claude-sonnet-4-5-20250929-v1:0': {
972-
defaultParams: CLAUDE_4_5_DEFAULT_PARAMS,
978+
defaultParams: CLAUDE_SONNET_4_DEFAULT_PARAMS,
973979
usecaseParams: USECASE_DEFAULT_PARAMS,
974980
createConverseCommandInput: createConverseCommandInput,
975981
createConverseStreamCommandInput: createConverseStreamCommandInput,
976982
extractConverseOutput: extractConverseOutput,
977983
extractConverseStreamOutput: extractConverseStreamOutput,
978984
},
979985
'global.anthropic.claude-sonnet-4-20250514-v1:0': {
980-
defaultParams: CLAUDE_3_5_DEFAULT_PARAMS,
986+
defaultParams: CLAUDE_SONNET_4_DEFAULT_PARAMS,
981987
usecaseParams: USECASE_DEFAULT_PARAMS,
982988
createConverseCommandInput: createConverseCommandInput,
983989
createConverseStreamCommandInput: createConverseStreamCommandInput,
984990
extractConverseOutput: extractConverseOutput,
985991
extractConverseStreamOutput: extractConverseStreamOutput,
986992
},
987993
'us.anthropic.claude-sonnet-4-20250514-v1:0': {
988-
defaultParams: CLAUDE_3_5_DEFAULT_PARAMS,
994+
defaultParams: CLAUDE_SONNET_4_DEFAULT_PARAMS,
989995
usecaseParams: USECASE_DEFAULT_PARAMS,
990996
createConverseCommandInput: createConverseCommandInput,
991997
createConverseStreamCommandInput: createConverseStreamCommandInput,
992998
extractConverseOutput: extractConverseOutput,
993999
extractConverseStreamOutput: extractConverseStreamOutput,
9941000
},
9951001
'eu.anthropic.claude-sonnet-4-20250514-v1:0': {
996-
defaultParams: CLAUDE_3_5_DEFAULT_PARAMS,
1002+
defaultParams: CLAUDE_SONNET_4_DEFAULT_PARAMS,
9971003
usecaseParams: USECASE_DEFAULT_PARAMS,
9981004
createConverseCommandInput: createConverseCommandInput,
9991005
createConverseStreamCommandInput: createConverseStreamCommandInput,
10001006
extractConverseOutput: extractConverseOutput,
10011007
extractConverseStreamOutput: extractConverseStreamOutput,
10021008
},
10031009
'apac.anthropic.claude-sonnet-4-20250514-v1:0': {
1004-
defaultParams: CLAUDE_3_5_DEFAULT_PARAMS,
1010+
defaultParams: CLAUDE_SONNET_4_DEFAULT_PARAMS,
10051011
usecaseParams: USECASE_DEFAULT_PARAMS,
10061012
createConverseCommandInput: createConverseCommandInput,
10071013
createConverseStreamCommandInput: createConverseStreamCommandInput,
@@ -1041,23 +1047,23 @@ export const BEDROCK_TEXT_GEN_MODELS: {
10411047
extractConverseStreamOutput: extractConverseStreamOutput,
10421048
},
10431049
'us.anthropic.claude-3-7-sonnet-20250219-v1:0': {
1044-
defaultParams: CLAUDE_3_5_DEFAULT_PARAMS,
1050+
defaultParams: CLAUDE_SONNET_4_DEFAULT_PARAMS,
10451051
usecaseParams: USECASE_DEFAULT_PARAMS,
10461052
createConverseCommandInput: createConverseCommandInput,
10471053
createConverseStreamCommandInput: createConverseStreamCommandInput,
10481054
extractConverseOutput: extractConverseOutput,
10491055
extractConverseStreamOutput: extractConverseStreamOutput,
10501056
},
10511057
'eu.anthropic.claude-3-7-sonnet-20250219-v1:0': {
1052-
defaultParams: CLAUDE_3_5_DEFAULT_PARAMS,
1058+
defaultParams: CLAUDE_SONNET_4_DEFAULT_PARAMS,
10531059
usecaseParams: USECASE_DEFAULT_PARAMS,
10541060
createConverseCommandInput: createConverseCommandInput,
10551061
createConverseStreamCommandInput: createConverseStreamCommandInput,
10561062
extractConverseOutput: extractConverseOutput,
10571063
extractConverseStreamOutput: extractConverseStreamOutput,
10581064
},
10591065
'apac.anthropic.claude-3-7-sonnet-20250219-v1:0': {
1060-
defaultParams: CLAUDE_3_5_DEFAULT_PARAMS,
1066+
defaultParams: CLAUDE_SONNET_4_DEFAULT_PARAMS,
10611067
usecaseParams: USECASE_DEFAULT_PARAMS,
10621068
createConverseCommandInput: createConverseCommandInput,
10631069
createConverseStreamCommandInput: createConverseStreamCommandInput,

0 commit comments

Comments
 (0)