@@ -1080,28 +1080,30 @@ def _lc_content_to_bedrock(
10801080 elif block ["type" ] == "guard_content" :
10811081 bedrock_content .append ({"guardContent" : {"text" : {"text" : block ["text" ]}}})
10821082 elif block ["type" ] == "thinking" :
1083- bedrock_content .append (
1084- {
1085- "reasoningContent" : {
1086- "reasoningText" : {
1087- "text" : block .get ("thinking" , "" ),
1088- "signature" : block .get ("signature" , "" )
1083+ if block .get ("signature" , "" ):
1084+ bedrock_content .append (
1085+ {
1086+ "reasoningContent" : {
1087+ "reasoningText" : {
1088+ "text" : block .get ("thinking" , "" ),
1089+ "signature" : block .get ("signature" , "" ),
1090+ }
10891091 }
10901092 }
1091- }
1092- )
1093+ )
10931094 elif block ["type" ] == "reasoning_content" :
10941095 reasoning_content = block .get ("reasoningContent" , {})
1095- bedrock_content .append (
1096- {
1097- "reasoningContent" : {
1098- "reasoningText" : {
1099- "text" : reasoning_content .get ("text" , "" ),
1100- "signature" : reasoning_content .get ("signature" , "" )
1096+ if reasoning_content .get ("signature" , "" ):
1097+ bedrock_content .append (
1098+ {
1099+ "reasoningContent" : {
1100+ "reasoningText" : {
1101+ "text" : reasoning_content .get ("text" , "" ),
1102+ "signature" : reasoning_content .get ("signature" , "" ),
1103+ }
11011104 }
11021105 }
1103- }
1104- )
1106+ )
11051107 else :
11061108 raise ValueError (f"Unsupported content block type:\n { block } " )
11071109 # drop empty text blocks
0 commit comments