@@ -755,6 +755,37 @@ describe("AwsBedrockHandler", () => {
755755 const model = handler . getModel ( )
756756 expect ( model . id ) . toBe ( "global.anthropic.claude-sonnet-5" )
757757 } )
758+
759+ it ( "should return Claude Opus 5 model info" , ( ) => {
760+ const handler = new AwsBedrockHandler ( {
761+ apiModelId : "anthropic.claude-opus-5" ,
762+ awsAccessKey : "test" ,
763+ awsSecretKey : "test" ,
764+ awsRegion : "us-east-1" ,
765+ } )
766+
767+ const model = handler . getModel ( )
768+ expect ( model . id ) . toBe ( "anthropic.claude-opus-5" )
769+ expect ( model . info . contextWindow ) . toBe ( 1_000_000 )
770+ expect ( model . info . supportsReasoningBinary ) . toBe ( true )
771+ expect ( model . info . supportsReasoningBudget ) . toBe ( true )
772+ expect ( model . info . supportsPromptCache ) . toBe ( true )
773+ expect ( model . info . supportsTemperature ) . toBe ( false )
774+ expect ( model . maxTokens ) . toBe ( 8192 )
775+ } )
776+
777+ it ( "should apply global inference prefix for Claude Opus 5 when awsUseGlobalInference is true" , ( ) => {
778+ const handler = new AwsBedrockHandler ( {
779+ apiModelId : "anthropic.claude-opus-5" ,
780+ awsAccessKey : "test" ,
781+ awsSecretKey : "test" ,
782+ awsRegion : "us-east-1" ,
783+ awsUseGlobalInference : true ,
784+ } )
785+
786+ const model = handler . getModel ( )
787+ expect ( model . id ) . toBe ( "global.anthropic.claude-opus-5" )
788+ } )
758789 } )
759790
760791 describe ( "1M context beta feature" , ( ) => {
@@ -1487,6 +1518,36 @@ describe("AwsBedrockHandler", () => {
14871518 expect ( commandArg . inferenceConfig ?. temperature ) . toBeUndefined ( )
14881519 } )
14891520
1521+ it ( "should send adaptive thinking with effort xhigh for Claude Opus 5 when reasoning is enabled" , async ( ) => {
1522+ // End-to-end regression guard for the Opus 5 handler branch. The
1523+ // isAdaptiveThinkingModel predicate is unit-covered, but a regression in
1524+ // the createMessage adaptive-thinking branch for this specific model
1525+ // wouldn't be caught without a request-level test.
1526+ const opus5Handler = new AwsBedrockHandler ( {
1527+ apiModelId : "anthropic.claude-opus-5" ,
1528+ awsAccessKey : "test-access-key" ,
1529+ awsSecretKey : "test-secret-key" ,
1530+ awsRegion : "us-east-1" ,
1531+ enableReasoningEffort : true ,
1532+ } )
1533+
1534+ const generator = opus5Handler . createMessage ( "System prompt" , messages )
1535+ await generator . next ( )
1536+
1537+ expect ( mockConverseStreamCommand ) . toHaveBeenCalled ( )
1538+ const commandArg = mockConverseStreamCommand . mock . calls [ 0 ] [ 0 ] as any
1539+
1540+ // Opus 5 uses the same adaptive-thinking contract as Opus 4.7/4.8 —
1541+ // budget_tokens causes a 400, so thinking.type is "adaptive" with effort.
1542+ expect ( commandArg . additionalModelRequestFields ?. thinking ) . toEqual ( {
1543+ type : "adaptive" ,
1544+ display : "summarized" ,
1545+ } )
1546+ expect ( commandArg . additionalModelRequestFields ?. output_config ) . toEqual ( { effort : "xhigh" } )
1547+ // Opus 5 rejects sampling parameters: temperature must be omitted entirely.
1548+ expect ( commandArg . inferenceConfig ?. temperature ) . toBeUndefined ( )
1549+ } )
1550+
14901551 it ( "should omit thinking and temperature for Claude Opus 4.8 when reasoning is disabled" , async ( ) => {
14911552 const opus48Handler = new AwsBedrockHandler ( {
14921553 apiModelId : "anthropic.claude-opus-4-8" ,
@@ -1620,6 +1681,7 @@ describe("AwsBedrockHandler", () => {
16201681 expect ( isAdaptiveThinkingModel ( "anthropic.claude-opus-4-8" ) ) . toBe ( true )
16211682 expect ( isAdaptiveThinkingModel ( "anthropic.claude-fable-5" ) ) . toBe ( true )
16221683 expect ( isAdaptiveThinkingModel ( "anthropic.claude-sonnet-5" ) ) . toBe ( true )
1684+ expect ( isAdaptiveThinkingModel ( "anthropic.claude-opus-5" ) ) . toBe ( true )
16231685 // Future-proof Sonnet patterns — guarded even before a registry entry exists.
16241686 expect ( isAdaptiveThinkingModel ( "anthropic.claude-sonnet-4-7" ) ) . toBe ( true )
16251687 expect ( isAdaptiveThinkingModel ( "anthropic.claude-sonnet-4-8" ) ) . toBe ( true )
@@ -1629,12 +1691,14 @@ describe("AwsBedrockHandler", () => {
16291691 expect ( isAdaptiveThinkingModel ( "us.anthropic.claude-opus-4-8" ) ) . toBe ( true )
16301692 expect ( isAdaptiveThinkingModel ( "global.anthropic.claude-fable-5" ) ) . toBe ( true )
16311693 expect ( isAdaptiveThinkingModel ( "global.anthropic.claude-sonnet-5" ) ) . toBe ( true )
1694+ expect ( isAdaptiveThinkingModel ( "global.anthropic.claude-opus-5" ) ) . toBe ( true )
16321695 expect ( isAdaptiveThinkingModel ( "eu.anthropic.claude-sonnet-4-7" ) ) . toBe ( true )
16331696 expect ( isAdaptiveThinkingModel ( "global.anthropic.claude-opus-4-8" ) ) . toBe ( true )
16341697 } )
16351698
16361699 it ( "returns false for older / non-adaptive models" , ( ) => {
16371700 expect ( isAdaptiveThinkingModel ( "anthropic.claude-opus-4-6-v1" ) ) . toBe ( false )
1701+ expect ( isAdaptiveThinkingModel ( "anthropic.claude-opus-4-5-20251101-v1:0" ) ) . toBe ( false )
16381702 expect ( isAdaptiveThinkingModel ( "anthropic.claude-sonnet-4-6" ) ) . toBe ( false )
16391703 expect ( isAdaptiveThinkingModel ( "anthropic.claude-3-5-sonnet-20241022-v2:0" ) ) . toBe ( false )
16401704 expect ( isAdaptiveThinkingModel ( "amazon.nova-lite-v1:0" ) ) . toBe ( false )
0 commit comments