@@ -271,6 +271,7 @@ def nonstreaming_multi_candidate_google_genai_model_response():
271271 cached_content_token_count = 4 ,
272272 prompt_token_count = 10 ,
273273 candidates_token_count = 20 ,
274+ thoughts_token_count = 5 ,
274275 total_token_count = 30 ,
275276 ),
276277 )
@@ -591,7 +592,7 @@ def test_langchain_multi_choice_response(
591592 assert len (chat_spans ) == 1
592593
593594 assert chat_spans [0 ]["attributes" ]["gen_ai.usage.input_tokens" ] == 10
594- assert chat_spans [0 ]["attributes" ]["gen_ai.usage.output_tokens" ] == 20
595+ assert chat_spans [0 ]["attributes" ]["gen_ai.usage.output_tokens" ] == 25
595596 assert chat_spans [0 ]["attributes" ]["gen_ai.usage.total_tokens" ] == 30
596597
597598 assert (
@@ -616,7 +617,7 @@ def test_langchain_multi_choice_response(
616617 assert len (chat_spans ) == 1
617618
618619 assert chat_spans [0 ]["data" ]["gen_ai.usage.input_tokens" ] == 10
619- assert chat_spans [0 ]["data" ]["gen_ai.usage.output_tokens" ] == 20
620+ assert chat_spans [0 ]["data" ]["gen_ai.usage.output_tokens" ] == 25
620621 assert chat_spans [0 ]["data" ]["gen_ai.usage.total_tokens" ] == 30
621622
622623 assert chat_spans [0 ]["data" ][SPANDATA .GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS ] == 4
@@ -817,6 +818,11 @@ def test_langchain_create_agent(
817818 == 6
818819 )
819820
821+ assert (
822+ chat_spans [0 ]["attributes" ][SPANDATA .GEN_AI_USAGE_REASONING_OUTPUT_TOKENS ]
823+ == 5
824+ )
825+
820826 if LANGCHAIN_OPENAI_VERSION >= (0 , 3 , 13 ):
821827 assert (
822828 chat_spans [0 ]["attributes" ][SPANDATA .GEN_AI_RESPONSE_MODEL ] == "gpt-4"
@@ -904,6 +910,11 @@ def test_langchain_create_agent(
904910 == 6
905911 )
906912
913+ assert (
914+ chat_spans [0 ]["attributes" ][SPANDATA .GEN_AI_USAGE_REASONING_OUTPUT_TOKENS ]
915+ == 5
916+ )
917+
907918 if LANGCHAIN_OPENAI_VERSION >= (0 , 3 , 13 ):
908919 assert (
909920 chat_spans [0 ]["attributes" ][SPANDATA .GEN_AI_RESPONSE_MODEL ] == "gpt-4"
@@ -970,7 +981,7 @@ def test_langchain_create_agent(
970981 assert chat_spans [0 ]["data" ]["gen_ai.agent.name" ] == "word_length_agent"
971982
972983 assert chat_spans [0 ]["data" ]["gen_ai.usage.input_tokens" ] == 10
973- assert chat_spans [0 ]["data" ]["gen_ai.usage.output_tokens" ] == 20
984+ assert chat_spans [0 ]["data" ]["gen_ai.usage.output_tokens" ] == 25
974985 assert chat_spans [0 ]["data" ]["gen_ai.usage.total_tokens" ] == 30
975986
976987 assert chat_spans [0 ]["data" ][SPANDATA .GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS ] == 4
@@ -979,6 +990,8 @@ def test_langchain_create_agent(
979990 == 6
980991 )
981992
993+ assert chat_spans [0 ]["data" ][SPANDATA .GEN_AI_USAGE_REASONING_OUTPUT_TOKENS ] == 5
994+
982995 if LANGCHAIN_OPENAI_VERSION >= (0 , 3 , 13 ):
983996 assert chat_spans [0 ]["data" ][SPANDATA .GEN_AI_RESPONSE_MODEL ] == "gpt-4"
984997
@@ -1054,7 +1067,7 @@ def test_tool_execution_span(
10541067 ),
10551068 output_tokens = 50 ,
10561069 output_tokens_details = OutputTokensDetails (
1057- reasoning_tokens = 0 ,
1070+ reasoning_tokens = 10 ,
10581071 ),
10591072 total_tokens = 192 ,
10601073 ),
@@ -1066,7 +1079,7 @@ def test_tool_execution_span(
10661079 ),
10671080 output_tokens = 28 ,
10681081 output_tokens_details = OutputTokensDetails (
1069- reasoning_tokens = 0 ,
1082+ reasoning_tokens = 11 ,
10701083 ),
10711084 total_tokens = 117 ,
10721085 ),
@@ -1153,6 +1166,10 @@ def test_tool_execution_span(
11531166 ]
11541167 == 31
11551168 )
1169+ assert (
1170+ chat_spans [0 ]["attributes" ][SPANDATA .GEN_AI_USAGE_REASONING_OUTPUT_TOKENS ]
1171+ == 10
1172+ )
11561173 assert chat_spans [0 ]["attributes" ]["gen_ai.system" ] == "openai-chat"
11571174
11581175 assert chat_spans [1 ]["attributes" ]["gen_ai.usage.input_tokens" ] == 89
@@ -1168,6 +1185,10 @@ def test_tool_execution_span(
11681185 ]
11691186 == 10
11701187 )
1188+ assert (
1189+ chat_spans [1 ]["attributes" ][SPANDATA .GEN_AI_USAGE_REASONING_OUTPUT_TOKENS ]
1190+ == 11
1191+ )
11711192 assert chat_spans [1 ]["attributes" ]["gen_ai.system" ] == "openai-chat"
11721193
11731194 if LANGCHAIN_OPENAI_VERSION >= (0 , 3 , 13 ):
@@ -1286,6 +1307,10 @@ def test_tool_execution_span(
12861307 ]
12871308 == 31
12881309 )
1310+ assert (
1311+ chat_spans [0 ]["attributes" ][SPANDATA .GEN_AI_USAGE_REASONING_OUTPUT_TOKENS ]
1312+ == 10
1313+ )
12891314 assert chat_spans [0 ]["attributes" ]["gen_ai.system" ] == "openai-chat"
12901315
12911316 assert chat_spans [1 ]["attributes" ]["gen_ai.usage.input_tokens" ] == 89
@@ -1301,6 +1326,10 @@ def test_tool_execution_span(
13011326 ]
13021327 == 10
13031328 )
1329+ assert (
1330+ chat_spans [1 ]["attributes" ][SPANDATA .GEN_AI_USAGE_REASONING_OUTPUT_TOKENS ]
1331+ == 11
1332+ )
13041333 assert chat_spans [1 ]["attributes" ]["gen_ai.system" ] == "openai-chat"
13051334
13061335 if LANGCHAIN_OPENAI_VERSION >= (0 , 3 , 13 ):
@@ -1416,6 +1445,9 @@ def test_tool_execution_span(
14161445 chat_spans [0 ]["data" ][SPANDATA .GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS ]
14171446 == 31
14181447 )
1448+ assert (
1449+ chat_spans [0 ]["data" ][SPANDATA .GEN_AI_USAGE_REASONING_OUTPUT_TOKENS ] == 10
1450+ )
14191451 assert chat_spans [0 ]["data" ]["gen_ai.system" ] == "openai-chat"
14201452
14211453 assert chat_spans [1 ]["data" ]["gen_ai.usage.input_tokens" ] == 89
@@ -1428,6 +1460,9 @@ def test_tool_execution_span(
14281460 chat_spans [1 ]["data" ][SPANDATA .GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS ]
14291461 == 10
14301462 )
1463+ assert (
1464+ chat_spans [1 ]["data" ][SPANDATA .GEN_AI_USAGE_REASONING_OUTPUT_TOKENS ] == 11
1465+ )
14311466 assert chat_spans [1 ]["data" ]["gen_ai.system" ] == "openai-chat"
14321467
14331468 if LANGCHAIN_OPENAI_VERSION >= (0 , 3 , 13 ):
0 commit comments