@@ -217,20 +217,27 @@ def test_anthropic_thinking_blocks_with_tool_calls():
217
217
"Signature should be preserved in thinking block"
218
218
)
219
219
220
- first_content = content [1 ]
221
- assert first_content .get ("type" ) == "thinking" , (
220
+ second_content = content [1 ]
221
+ assert second_content .get ("type" ) == "thinking" , (
222
222
f"Second content must be 'thinking' type for Anthropic compatibility, "
223
- f"but got '{ first_content .get ('type' )} '"
223
+ f"but got '{ second_content .get ('type' )} '"
224
224
)
225
225
expected_thinking = "We should use the city Tokyo as the city."
226
- assert first_content .get ("thinking" ) == expected_thinking , (
226
+ assert second_content .get ("thinking" ) == expected_thinking , (
227
227
"Thinking content should be preserved"
228
228
)
229
229
# Signature should also be preserved
230
- assert first_content .get ("signature" ) == "TestSignature456" , (
230
+ assert second_content .get ("signature" ) == "TestSignature456" , (
231
231
"Signature should be preserved in thinking block"
232
232
)
233
233
234
+ last_content = content [2 ]
235
+ assert last_content .get ("type" ) == "text" , (
236
+ f"First content must be 'text' type but got '{ last_content .get ('type' )} '"
237
+ )
238
+ expected_text = "I'll check the weather for you."
239
+ assert last_content .get ("text" ) == expected_text , "Content text should be preserved"
240
+
234
241
# Verify tool calls are preserved
235
242
tool_calls = assistant_msg .get ("tool_calls" , [])
236
243
assert len (cast (list [Any ], tool_calls )) == 1 , "Tool calls should be preserved"
0 commit comments