@@ -724,6 +724,37 @@ describe("AwsBedrockHandler", () => {
724724 const model = handler . getModel ( )
725725 expect ( model . id ) . toBe ( "global.anthropic.claude-fable-5" )
726726 } )
727+
728+ it ( "should return Claude Sonnet 5 model info" , ( ) => {
729+ const handler = new AwsBedrockHandler ( {
730+ apiModelId : "anthropic.claude-sonnet-5" ,
731+ awsAccessKey : "test" ,
732+ awsSecretKey : "test" ,
733+ awsRegion : "us-east-1" ,
734+ } )
735+
736+ const model = handler . getModel ( )
737+ expect ( model . id ) . toBe ( "anthropic.claude-sonnet-5" )
738+ expect ( model . info . contextWindow ) . toBe ( 1_000_000 )
739+ expect ( model . info . supportsReasoningBinary ) . toBe ( true )
740+ expect ( model . info . supportsReasoningBudget ) . toBe ( true )
741+ expect ( model . info . supportsPromptCache ) . toBe ( true )
742+ expect ( model . info . supportsTemperature ) . toBe ( false )
743+ expect ( model . maxTokens ) . toBe ( 8192 )
744+ } )
745+
746+ it ( "should apply global inference prefix for Claude Sonnet 5 when awsUseGlobalInference is true" , ( ) => {
747+ const handler = new AwsBedrockHandler ( {
748+ apiModelId : "anthropic.claude-sonnet-5" ,
749+ awsAccessKey : "test" ,
750+ awsSecretKey : "test" ,
751+ awsRegion : "us-east-1" ,
752+ awsUseGlobalInference : true ,
753+ } )
754+
755+ const model = handler . getModel ( )
756+ expect ( model . id ) . toBe ( "global.anthropic.claude-sonnet-5" )
757+ } )
727758 } )
728759
729760 describe ( "1M context beta feature" , ( ) => {
@@ -1426,6 +1457,36 @@ describe("AwsBedrockHandler", () => {
14261457 expect ( commandArg . inferenceConfig ?. temperature ) . toBeUndefined ( )
14271458 } )
14281459
1460+ it ( "should send adaptive thinking with effort xhigh for Claude Sonnet 5 when reasoning is enabled" , async ( ) => {
1461+ // End-to-end regression guard for the Sonnet 5 handler branch. The
1462+ // isAdaptiveThinkingModel predicate is unit-covered, but a regression in
1463+ // the createMessage adaptive-thinking branch for this specific model
1464+ // wouldn't be caught without a request-level test (see review feedback).
1465+ const sonnet5Handler = new AwsBedrockHandler ( {
1466+ apiModelId : "anthropic.claude-sonnet-5" ,
1467+ awsAccessKey : "test-access-key" ,
1468+ awsSecretKey : "test-secret-key" ,
1469+ awsRegion : "us-east-1" ,
1470+ enableReasoningEffort : true ,
1471+ } )
1472+
1473+ const generator = sonnet5Handler . createMessage ( "System prompt" , messages )
1474+ await generator . next ( )
1475+
1476+ expect ( mockConverseStreamCommand ) . toHaveBeenCalled ( )
1477+ const commandArg = mockConverseStreamCommand . mock . calls [ 0 ] [ 0 ] as any
1478+
1479+ // Sonnet 5 uses the same adaptive-thinking contract as Opus 4.7/4.8 —
1480+ // budget_tokens causes a 400, so thinking.type is "adaptive" with effort.
1481+ expect ( commandArg . additionalModelRequestFields ?. thinking ) . toEqual ( {
1482+ type : "adaptive" ,
1483+ display : "summarized" ,
1484+ } )
1485+ expect ( commandArg . additionalModelRequestFields ?. output_config ) . toEqual ( { effort : "xhigh" } )
1486+ // Sonnet 5 rejects sampling parameters: temperature must be omitted entirely.
1487+ expect ( commandArg . inferenceConfig ?. temperature ) . toBeUndefined ( )
1488+ } )
1489+
14291490 it ( "should omit thinking and temperature for Claude Opus 4.8 when reasoning is disabled" , async ( ) => {
14301491 const opus48Handler = new AwsBedrockHandler ( {
14311492 apiModelId : "anthropic.claude-opus-4-8" ,
@@ -1558,6 +1619,7 @@ describe("AwsBedrockHandler", () => {
15581619 expect ( isAdaptiveThinkingModel ( "anthropic.claude-opus-4-7" ) ) . toBe ( true )
15591620 expect ( isAdaptiveThinkingModel ( "anthropic.claude-opus-4-8" ) ) . toBe ( true )
15601621 expect ( isAdaptiveThinkingModel ( "anthropic.claude-fable-5" ) ) . toBe ( true )
1622+ expect ( isAdaptiveThinkingModel ( "anthropic.claude-sonnet-5" ) ) . toBe ( true )
15611623 // Future-proof Sonnet patterns — guarded even before a registry entry exists.
15621624 expect ( isAdaptiveThinkingModel ( "anthropic.claude-sonnet-4-7" ) ) . toBe ( true )
15631625 expect ( isAdaptiveThinkingModel ( "anthropic.claude-sonnet-4-8" ) ) . toBe ( true )
@@ -1566,6 +1628,7 @@ describe("AwsBedrockHandler", () => {
15661628 it ( "returns true when the id carries a cross-region or global prefix" , ( ) => {
15671629 expect ( isAdaptiveThinkingModel ( "us.anthropic.claude-opus-4-8" ) ) . toBe ( true )
15681630 expect ( isAdaptiveThinkingModel ( "global.anthropic.claude-fable-5" ) ) . toBe ( true )
1631+ expect ( isAdaptiveThinkingModel ( "global.anthropic.claude-sonnet-5" ) ) . toBe ( true )
15691632 expect ( isAdaptiveThinkingModel ( "eu.anthropic.claude-sonnet-4-7" ) ) . toBe ( true )
15701633 expect ( isAdaptiveThinkingModel ( "global.anthropic.claude-opus-4-8" ) ) . toBe ( true )
15711634 } )
0 commit comments