@@ -73,6 +73,24 @@ describe("AwsBedrockHandler", () => {
7373 expect ( modelInfo . info . contextWindow ) . toBeDefined ( )
7474 } )
7575
76+ it ( "should return the correct model info for Claude Opus 4.7" , ( ) => {
77+ const opusHandler = new AwsBedrockHandler ( {
78+ apiModelId : "anthropic.claude-opus-4-7" ,
79+ awsAccessKey : "test-access-key" ,
80+ awsSecretKey : "test-secret-key" ,
81+ awsRegion : "us-east-1" ,
82+ modelTemperature : 0.2 ,
83+ } )
84+
85+ const modelInfo = opusHandler . getModel ( )
86+
87+ expect ( modelInfo . id ) . toBe ( "anthropic.claude-opus-4-7" )
88+ expect ( modelInfo . info . contextWindow ) . toBe ( 1_000_000 )
89+ expect ( modelInfo . info . maxTokens ) . toBe ( 128_000 )
90+ expect ( modelInfo . info . supportsTemperature ) . toBe ( false )
91+ expect ( modelInfo . temperature ) . toBeUndefined ( )
92+ } )
93+
7694 it ( "should use custom ARN when provided" , ( ) => {
7795 // This test is incompatible with the refactored implementation
7896 // The implementation now extracts the model ID from the ARN instead of using the ARN directly
@@ -843,6 +861,53 @@ describe("AwsBedrockHandler", () => {
843861 expect ( commandArg . additionalModelRequestFields . anthropic_beta ) . not . toContain ( "context-1m-2025-08-07" )
844862 } )
845863
864+ it ( "should use adaptive thinking and omit temperature for Claude Opus 4.7" , async ( ) => {
865+ const handler = new AwsBedrockHandler ( {
866+ apiModelId : "anthropic.claude-opus-4-7" ,
867+ awsAccessKey : "test" ,
868+ awsSecretKey : "test" ,
869+ awsRegion : "us-east-1" ,
870+ enableReasoningEffort : true ,
871+ reasoningEffort : "medium" ,
872+ modelTemperature : 0.4 ,
873+ } )
874+
875+ const messages : Anthropic . Messages . MessageParam [ ] = [
876+ {
877+ role : "user" ,
878+ content : "Test message" ,
879+ } ,
880+ ]
881+
882+ const generator = handler . createMessage ( "" , messages )
883+ await generator . next ( )
884+
885+ expect ( mockConverseStreamCommand ) . toHaveBeenCalled ( )
886+ const commandArg = mockConverseStreamCommand . mock . calls [ 0 ] [ 0 ] as any
887+
888+ expect ( commandArg . additionalModelRequestFields ) . toBeDefined ( )
889+ expect ( commandArg . additionalModelRequestFields . thinking ) . toEqual ( {
890+ type : "adaptive" ,
891+ effort : "medium" ,
892+ } )
893+ expect ( commandArg . additionalModelRequestFields . thinking . budget_tokens ) . toBeUndefined ( )
894+ expect ( commandArg . inferenceConfig . temperature ) . toBeUndefined ( )
895+ } )
896+
897+ it ( "should use global inference for Claude Opus 4.7 when enabled" , ( ) => {
898+ const handler = new AwsBedrockHandler ( {
899+ apiModelId : "anthropic.claude-opus-4-7" ,
900+ awsAccessKey : "test" ,
901+ awsSecretKey : "test" ,
902+ awsRegion : "us-east-1" ,
903+ awsUseGlobalInference : true ,
904+ } )
905+
906+ const model = handler . getModel ( )
907+
908+ expect ( model . id ) . toBe ( "global.anthropic.claude-opus-4-7" )
909+ } )
910+
846911 it ( "should enable 1M context window with cross-region inference for Claude Sonnet 4" , ( ) => {
847912 const handler = new AwsBedrockHandler ( {
848913 apiModelId : BEDROCK_1M_CONTEXT_MODEL_IDS [ 0 ] ,
0 commit comments