@@ -47,6 +47,7 @@ import type { Anthropic } from "@anthropic-ai/sdk"
4747
4848// Get access to the mocked functions
4949const mockConverseStreamCommand = vi . mocked ( ConverseStreamCommand )
50+ const mockConverseCommand = vi . mocked ( ConverseCommand )
5051const mockBedrockRuntimeClient = vi . mocked ( BedrockRuntimeClient )
5152
5253describe ( "AwsBedrockHandler" , ( ) => {
@@ -894,6 +895,35 @@ describe("AwsBedrockHandler", () => {
894895 expect ( commandArg . inferenceConfig . temperature ) . toBeUndefined ( )
895896 } )
896897
898+ it ( "should map xhigh reasoning effort to max for Claude Opus 4.7 adaptive thinking" , async ( ) => {
899+ const handler = new AwsBedrockHandler ( {
900+ apiModelId : "anthropic.claude-opus-4-7" ,
901+ awsAccessKey : "test" ,
902+ awsSecretKey : "test" ,
903+ awsRegion : "us-east-1" ,
904+ enableReasoningEffort : true ,
905+ reasoningEffort : "xhigh" ,
906+ } )
907+
908+ const messages : Anthropic . Messages . MessageParam [ ] = [
909+ {
910+ role : "user" ,
911+ content : "Test message" ,
912+ } ,
913+ ]
914+
915+ const generator = handler . createMessage ( "" , messages )
916+ await generator . next ( )
917+
918+ expect ( mockConverseStreamCommand ) . toHaveBeenCalled ( )
919+ const commandArg = mockConverseStreamCommand . mock . calls [ 0 ] [ 0 ] as any
920+
921+ expect ( commandArg . additionalModelRequestFields . thinking ) . toEqual ( {
922+ type : "adaptive" ,
923+ effort : "max" ,
924+ } )
925+ } )
926+
897927 it ( "should use global inference for Claude Opus 4.7 when enabled" , ( ) => {
898928 const handler = new AwsBedrockHandler ( {
899929 apiModelId : "anthropic.claude-opus-4-7" ,
@@ -1392,4 +1422,22 @@ describe("AwsBedrockHandler", () => {
13921422 expect ( hasCachePoint ) . toBe ( false )
13931423 } )
13941424 } )
1425+
1426+ describe ( "completePrompt" , ( ) => {
1427+ it ( "should omit temperature for Claude Opus 4.7" , async ( ) => {
1428+ const handler = new AwsBedrockHandler ( {
1429+ apiModelId : "anthropic.claude-opus-4-7" ,
1430+ awsAccessKey : "test" ,
1431+ awsSecretKey : "test" ,
1432+ awsRegion : "us-east-1" ,
1433+ modelTemperature : 0.4 ,
1434+ } )
1435+
1436+ await handler . completePrompt ( "Test prompt" )
1437+
1438+ expect ( mockConverseCommand ) . toHaveBeenCalled ( )
1439+ const commandArg = mockConverseCommand . mock . calls [ 0 ] [ 0 ] as any
1440+ expect ( commandArg . inferenceConfig . temperature ) . toBeUndefined ( )
1441+ } )
1442+ } )
13951443} )
0 commit comments