@@ -217,20 +217,27 @@ def test_anthropic_thinking_blocks_with_tool_calls():
217217 "Signature should be preserved in thinking block"
218218 )
219219
220- first_content = content [1 ]
221- assert first_content .get ("type" ) == "thinking" , (
220+ second_content = content [1 ]
221+ assert second_content .get ("type" ) == "thinking" , (
222222 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' )} '"
224224 )
225225 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 , (
227227 "Thinking content should be preserved"
228228 )
229229 # Signature should also be preserved
230- assert first_content .get ("signature" ) == "TestSignature456" , (
230+ assert second_content .get ("signature" ) == "TestSignature456" , (
231231 "Signature should be preserved in thinking block"
232232 )
233233
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+
234241 # Verify tool calls are preserved
235242 tool_calls = assistant_msg .get ("tool_calls" , [])
236243 assert len (cast (list [Any ], tool_calls )) == 1 , "Tool calls should be preserved"
0 commit comments